linux-gcc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* warnings appearing during preprocessor string concatenation (##)
@ 2003-03-05 20:34 Jamie Risk
  2003-03-06 13:10 ` Robert Schiele
  0 siblings, 1 reply; 2+ messages in thread
From: Jamie Risk @ 2003-03-05 20:34 UTC (permalink / raw)
  To: linux-gcc; +Cc: linux-newbie, linux-c-programming

I have the following line in my code,

#define FEATURE(select)     feature_structure. ## select ## .member
  ...
   FEATURE(test);

and when I run it through the compiler (gcc 3.2.2 on Linux x86) I get the
_warning_

  file.c:111:32: warning: pasting "." and "test" does not give a valid
preprocessing token
  file.c:111:32: warning: pasting "test" and "." does not give a valid
preprocessing token

If I look at the preprocessor output, (gcc's -E option) it produces what I'm
hoping for, although I'd like to avoid the warning.  Suggestions?

- Jamie

Reply to "gmane.linux.c-programming" or me directly.





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: warnings appearing during preprocessor string concatenation (##)
  2003-03-05 20:34 warnings appearing during preprocessor string concatenation (##) Jamie Risk
@ 2003-03-06 13:10 ` Robert Schiele
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Schiele @ 2003-03-06 13:10 UTC (permalink / raw)
  To: Jamie Risk; +Cc: linux-gcc, linux-newbie, linux-c-programming

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

On Wed, Mar 05, 2003 at 03:34:39PM -0500, Jamie Risk wrote:
> I have the following line in my code,
> 
> #define FEATURE(select)     feature_structure. ## select ## .member
>   ...
>    FEATURE(test);
> 
> and when I run it through the compiler (gcc 3.2.2 on Linux x86) I get the
> _warning_
> 
>   file.c:111:32: warning: pasting "." and "test" does not give a valid
> preprocessing token
>   file.c:111:32: warning: pasting "test" and "." does not give a valid
> preprocessing token
> 
> If I look at the preprocessor output, (gcc's -E option) it produces what I'm
> hoping for, although I'd like to avoid the warning.  Suggestions?

Just remove the '##' operator.  The preprocessor is right here, there
is nothing to concatenate to a token in your example.

Robert

-- 
Robert Schiele			Tel.: +49-621-181-2517
Dipl.-Wirtsch.informatiker	mailto:rschiele@uni-mannheim.de

[-- Attachment #2: Type: application/pgp-signature, Size: 481 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-06 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-05 20:34 warnings appearing during preprocessor string concatenation (##) Jamie Risk
2003-03-06 13:10 ` Robert Schiele

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).