This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: pasting "." and "something" does not give a valid preprocessing token..
- From: LLeweLLyn Reese <llewelly at lifesupport dot shutdown dot com>
- To: mskhan at hss dot hns dot com
- Cc: gcc-help at gcc dot gnu dot org
- Date: 23 Apr 2003 23:37:55 -0700
- Subject: Re: pasting "." and "something" does not give a valid preprocessing token..
- References: <OF592EF5A1.78F3D25F-ON65256D12.00233D38@hss.hns.com>
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]