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

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Mon Nov 13 13:36:00 GMT 2000


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 KERN_WARNING "<1>"
#define RPCDBG_FILEOP 0x0020
#define RPCDBG_FACILITY RPCDBG_FILEOP
 
#define dprintk(args...)        dfprintk( FACILITY , ## args )
#define ifdebug(fac)           if (rpc_debug & RPCDBG_##fac)
#define dfprintk(fac,args...)  do { ifdebug( fac ) printk( ## args ); } 
while(0)
 
dfprintk(FILEOP, "nfsd: fh_lock(%s)\n");
dfprintk(FILEOP, "nfsd: fh_lock(%s)\n", SVCFH_fmt(fhp));
 
dprintk(KERN_WARNING "nfsd: fh_lock(%s)\n");
dprintk(KERN_WARNING "nfsd: fh_lock(%s)\n", SVCFH_fmt(fhp));


I get the following output/warnings:

[fsirl@entropy:~/bugs]$ ~/obj/gccm/gcc/stage1/xgcc -B ~/obj/gccm/gcc/stage1/ 
-W -Wall -E kernel-cpp-warning.c
# 1 "kernel-cpp-warning.c"
# 9 "kernel-cpp-warning.c"
kernel-cpp-warning.c:9:1: warning: pasting "(" and ""nfsd: fh_lock(%s)\n"" 
does not give a valid preprocessing token
do { if (rpc_debug & 0x0020) printk("nfsd: fh_lock(%s)\n" ); } while(0);
kernel-cpp-warning.c:10:1: warning: pasting "(" and ""nfsd: fh_lock(%s)\n"" 
does not give a valid preprocessing token
do { if (rpc_debug & 0x0020) printk("nfsd: fh_lock(%s)\n", SVCFH_fmt(fhp) ); 
} while(0);
 
kernel-cpp-warning.c:12:1: warning: pasting "(" and "KERN_WARNING" does not 
give a valid preprocessing token
do { if (rpc_debug & 0x0020) printk(KERN_WARNING "nfsd: fh_lock(%s)\n" ); } 
while(0);
kernel-cpp-warning.c:13:1: warning: pasting "(" and "KERN_WARNING" does not 
give a valid preprocessing token
do { if (rpc_debug & 0x0020) printk(KERN_WARNING "nfsd: fh_lock(%s)\n", 
SVCFH_fmt(fhp) ); } while(0);

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

Franz.


More information about the Gcc-bugs mailing list