This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/17638] New: gcc fails compilation with incorrect error
- From: "rstewart at xvdcorp dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Sep 2004 19:10:35 -0000
- Subject: [Bug c/17638] New: gcc fails compilation with incorrect error
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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