This is the mail archive of the gcc-bugs@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]

Re: Preprocessor Problems


Dave Brolley wrote:-

> Generally, this kind of misuse is an attempt to delay the pre-expansion 
> of a macro argument.

Ah yes, thanks for the reminder.  I suspect that is the original reason.

If you want to be rid of the warning, the library will have to change
to do something portable.  Dave had some suggestions; another
possibility is maybe to introduce another level of indirection and to
paste with a library-supplied empty argument (from within the extra
level of indirection).

Neil.

> This can be necessary if the argument is a macro 
> name intended to be pasted at the next nesting level. There are 3 
> portable solutions that I see:
> 
> 1) Move the pasting out of ETEMPLATE to within the invocation of ETEMPLATE
> 2) Define the macro named in the argument as function-like so that it 
> doesn't get pre-expanded before being passed to ETEMPLATE
> 3) pass the name in pieces and paste it in the invocation of ETEMPLATE
> 
> Solution  3) would require changes to the way these macros are used and 
> it appears that this is a well known library of macros.
> 
> In any case, Neil is right. The usage below is unportable and gcc is 
> correct to warn about it.
> 
> Dave

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