CPP warning while compiling linux-kernel-2.4, correct?

Zack Weinberg zackw@stanford.edu
Mon Nov 13 14:10:00 GMT 2000


On Mon, Nov 13, 2000 at 10:36:45PM +0100, Franz Sirl wrote:
> Hi,
> 
> this has come up earlier already, but I couldn't find a final answer. If I 
> preprocess the following testcase with current CVS:

...

> #define dfprintk(fac,args...)  do { ifdebug( fac ) printk( ## args ); }

...

> kernel-cpp-warning.c:12:1: warning: pasting "(" and "KERN_WARNING" does not 


> Are these warnings correct? If yes, is removing the ## in dfprintk the right 
> solution?

Yes and yes.  This is a classic example of superstitious use of ##.
It has never been necessary in this context.  Probably someone thought
that you had to put ## before a varargs name, because it is commonly
used there to delete a preceding comma.

The other lines which use ## use it correctly.

> #define dprintk(args...)        dfprintk( FACILITY , ## args )
> #define ifdebug(fac)           if (rpc_debug & RPCDBG_##fac)

In dprintk, the effect is to delete the preceding comma if you ever
call dprintk with no arguments.  In ifdebug, the effect is to paste
RPCDBG_ together with the 'fac' argument.

zw


More information about the Gcc-bugs mailing list