This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: socketmodule.c's recvfrom on OSF/1 4.0
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: loewis, mmar
Priority: normal Keywords: patch

Created on 2005-04-27 15:02 by mmar, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-directive-inside-macro.patch mmar, 2005-04-27 15:02 "directives inside macro" patch
Messages (2)
msg48263 - (view) Author: Marcel Martin (mmar) Date: 2005-04-27 15:02
Compilation of Modules/socketmodule.c fails on OSF/1 4.0 
with GCC versions 3.1 and 3.2. 
 
The error message is: 
python/dist/src/Modules/socketmodule.c:2139:1: directives 
may not be used inside a macro argument 
 
Line 2139 is in function sock_recvfrom(). The problem is 
that the function recvfrom() on the machine I use is a macro 
and the parameters for it are pieced together by use of #if 
instructions to the preprocessor, similar to the following 
code: 
 
------- 
#include <stdio.h> 
 
#define macro(a, b) printf("Test: %d %d\n", a, b) 
 
int main(int argc, char** argv) { 
	macro(1, 2); // works 
 
	macro(1, 
#if defined(SOMETHING) 
	1 // error message here with older GCC 
#else 
 	2 
#endif 
	); 
	return 0; 
} 
------- 
This small test compiles with GCC 3.4, but with none of 
2.95.3, 3.1, or 3.2. 
 
The problem was in Python 2.3.4, 2.4.1 and CVS HEAD. 
 
The attached patch (against CVS HEAD) fixes the problem 
by pulling the "#if"s out of the parameter list. Not as nice as 
before, but it works for me. 
msg48264 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-15 08:36
Logged In: YES 
user_id=21627

Thanks for the patch. It didn't apply cleanly, so I redid it
and committed it as r45418 and r45419.
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41913
2005-04-27 15:02:59mmarcreate