This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: CPP warning while compiling linux-kernel-2.4, correct?
- To: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Subject: Re: CPP warning while compiling linux-kernel-2.4, correct?
- From: "Zack Weinberg" <zackw at stanford dot edu>
- Date: Mon, 13 Nov 2000 14:09:24 -0800
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <00111322364501.02383@enzo.bigblue.local>
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