This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: pasting "." and "something" does not give a valid preprocessing token..


mskhan at hss dot hns dot com writes:

> I've just installed gcc 3.2 and I get the warning from the subject line when
> compiling code that worked just fine with 2.95.3. Can anyone tell me what the
>  warning means and how it can be rectified.
> 
> The offending code is a macro :
> 
> #define EMUL_TRACE(level, format, args...) proc::theTrace->logTrace((level,  ##format , ##args)

I think you do not  want the token pasting ## before format or args.

#define EMUL_TRACE(level, format, args...) proc::theTrace->logTrace((level,  format , args)

should do the trick.

The token-pasting operator is only for making tokens - 'foo##bar'
    becomes the single token 'foobar' and its result must always
    produce a single valid token (or the results are undefined). Your
    examples would have pasted a comma onto the begining of a
    multichar token, and , is only a valid token by itself.

> 
> 
> where "Proc" is a class defined as
> 
> class Proc
> {
> 
> . ..........
> 
> static TraceLog * theTrace;
> 
> }
> 
> and TraceLog  is another class defined as
> 
> class TraceLog
> {
> .............
> public:
> ............
> void logTrace(int severity, char* stringToBeLogged, ...)
> .............
> 
> }
> 
[snip]


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