G++ preprocessor problem with unary ##

Neil Booth neil@daikokuya.demon.co.uk
Tue Mar 20 10:46:00 GMT 2001


Dave Martindale wrote:-

> Please read further down the message.  Yes, deleting most of the "unary ##"
> operators doesn't cause the code to break under 2.95, and does get rid of
> the warnings in 2.96.

Ah, my apologies.  I'd assumed your mail ended with the compiler output.
Yes, the use of ## solely to prevent macro expansion is not supported.  This
was a convenient kludge that works well with preprocessors that do text-based
macro expansion (like MS and Borland too I think) and re-lex the result, but
it doesn't work well when there is no re-lexing phase because the implementation
is to operate on tokens (like GCC now).

As to your problem, it seems that the lines

#define _DECLARE_EVENT_SYSTEM(name,ctypes,types) \
  _DECLARE_BASE_RECEIVER ( name, ##ctypes, ##types )

are the only non-conforming ones.  Since this is nothing but a wrapper macro,
maybe a search and replace would do, or maybe

#define _DECLARE_EVENT_SYSTEM _DECLARE_BASE_RECEIVER

would work too.  I've not tried either, though.

Neil.



More information about the Gcc-bugs mailing list