This is the mail archive of the gcc@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: `Cpp: 'ICOM_FN(##xfn)' generates a warning :-(


Francois Gouget wrote:-

> #define DECLARE2(xfn)    void ICOM_FN(##xfn) (void);
> 
>    I expect to get (blank and not relevant lines removed):
> 
> void fnGetObject    (void); 
> 
>    But more recent versions work again so this seems to be fixed. But I
> still get the following warning:
> test.c:11:1: warning: pasting "(" and "GetObject" does not give a valid
> preprocessing token
> 
>    Is this use of '##' still going to be supported in the future?

No.  GCC in future versions may even upgrade this warning to a hard
error.

>    Is it possible to not issue a warning in this situation (I know about
> the macro vararg problem).

No.  There may be other ways to achieve what you want; e.g. having an
extra empty argument and pasting that, or making it a varargs argument
if you don't want to have to enter the comma in invocations.

Neil.

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