This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

preprocessor in ss-20000724 fumbles arglist expansion


[This seems to be a new problem, it was okay in ss-20000703]

When gcc compiles the following:

#define SYMBOL_COMMA ,
#define ECHO(x) x
#define GENERATE(sym)  ECHO(SYMBOL_##sym)
int x GENERATE(COMMA) y;

the preprocessor says 'too many arguments for macro "ECHO"'
(This is the preprocessor used by gcc for default compilations,
which in the gcc source directory is named "cpp"
and not "xcpp" or "tradcpp".  On Linux this binary
is in .../lib/gcc-lib/i686-pc-linux/2.96/cpp and not bin/cpp.
I find this quite confusing.  Anyway,
doing "gcc -c foo.c" on the above code is simplest.)

The correct behavior is to produce "int x , y;" without complaint.

Tom Truscott

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]