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..







Hi Reese,
       Thanks a lot for your reply. I have done as you had suggested.
However it has now started giving Parse Error wherever the macro is being
called.

The description of the error is as follows::

UIAProc.cpp: In member   function `virtual void
UIAProc::UDPEventHandler(void*, int, const char*,  int)':
UIAProc.cpp:275: parse error   before `)' token

expecting o hear from you asap

thanks-
Sanjay





LLeweLLyn Reese <llewelly at lifesupport dot shutdown dot com> on 04/24/2003 12:07:55
PM

To:    Mohammed Sanjay Khan/HSS at HSS
cc:    gcc-help at gcc dot gnu dot org

Subject:    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]