[Bug c/17638] New: gcc fails compilation with incorrect error
rstewart at xvdcorp dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 23 19:10:00 GMT 2004
gcc fails to compile the following file and gives an error message of
"junk.c:22:1: pasting ";" and "return" does not give a valid preprocessing token".
The compiler (actually probably the preprocessor) appears to be complaining
about a perfectly legal macro. If fact, if the macro substitution is manually
performed by "cutting" and "pasting" the preprocessed file's (saved by using the
-E command line option and directing stdout to a file) generated code instead of
using the macro the file compiles and executes as expected.
The command line used to compile the source file is "gcc -g -O0 junk.c"
The source file is:
#include <stdio.h>
#define ASSERT(expr, func) \
if(!(expr)) { \
printf( "Assertion failed! %s,%s,%s,line=%d\n", \
#expr,__FILE__,__FUNCTION__,__LINE__); \
##func }
static int sub_func( char * );
main()
{
int temp;
temp = sub_func( NULL );
printf( "sub_func() returned: %d\n", temp );
exit( 0 );
}
static int sub_func( char * task )
{
ASSERT(task != NULL, return(-1););
return( 0 );
}
--
Summary: gcc fails compilation with incorrect error
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rstewart at xvdcorp dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17638
More information about the Gcc-bugs
mailing list