Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Trond Myklebust
On Wed, 2008-02-20 at 09:23 -0800, Joe Perches wrote: > On Wed, 2008-02-20 at 12:02 -0500, Trond Myklebust wrote: > > > #ifdef DEBUG > > > #define some_print_wrapper(fmt, arg...) \ > > > do { if (0) printk(KERN_DEBUG fmt, ##arg); } while (0) > > > #else > > > #define some_print_wrapper(fmt

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Joe Perches
On Wed, 2008-02-20 at 12:02 -0500, Trond Myklebust wrote: > > #ifdef DEBUG > > #define some_print_wrapper(fmt, arg...) \ > > do { if (0) printk(KERN_DEBUG fmt, ##arg); } while (0) > > #else > > #define some_print_wrapper(fmt, arg...) \ > > printk(KERN_DEBUG fmt, ##arg) > > #endif > Have

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Trond Myklebust
On Wed, 2008-02-20 at 08:36 -0800, Joe Perches wrote: > On Wed, 2008-02-20 at 16:35 +0100, Patrick McHardy wrote: > > Alternatively change the dprintk macro to behave similar like > > pr_debug() and mark things like svc_print_addr() __pure, which > > has the advantage that is still performs format

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Trond Myklebust
On Wed, 2008-02-20 at 19:27 +0300, Pavel Emelyanov wrote: > Patrick McHardy wrote: > > Joe Perches wrote: > >> On Wed, 2008-02-20 at 07:29 -0800, Joe Perches wrote: > >> > >>> fs/nfsd/nfsproc.c: char buf[RPC_MAX_ADDRBUFLEN]; > >>> Perhaps there should be a DECLARE_RPC_BUF(buf) macr

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Joe Perches
On Wed, 2008-02-20 at 16:35 +0100, Patrick McHardy wrote: > Alternatively change the dprintk macro to behave similar like > pr_debug() and mark things like svc_print_addr() __pure, which > has the advantage that is still performs format checking even > if debugging is disabled. I think it's better

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Pavel Emelyanov
Patrick McHardy wrote: > Joe Perches wrote: >> On Wed, 2008-02-20 at 07:29 -0800, Joe Perches wrote: >> >>> fs/nfsd/nfsproc.c: char buf[RPC_MAX_ADDRBUFLEN]; >>> Perhaps there should be a DECLARE_RPC_BUF(buf) macro? >>> #define DECLARE_RPC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unus

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Joe Perches
> Sigh... Why is that better than a strait declaration with attribute? If at some point there's a gcc'ism to remove a maybe_unused variable from the stack declaration, you only have change the macro. cheers, Joe -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Pavel Emelyanov
Joe Perches wrote: > On Wed, 2008-02-20 at 17:02 +0300, Pavel Emelyanov wrote: >> There are tree places, which declare the char buf[...] on the stack >> to push it later into dprintk(). Since the dprintk sometimes (if the >> CONFIG_SYSCTL=n) becomes an empty do { } while (0) stub, these buffers >>

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Patrick McHardy
Joe Perches wrote: On Wed, 2008-02-20 at 07:29 -0800, Joe Perches wrote: fs/nfsd/nfsproc.c: char buf[RPC_MAX_ADDRBUFLEN]; Perhaps there should be a DECLARE_RPC_BUF(buf) macro? #define DECLARE_RPC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused Make that: #define DECLARE_RP

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Joe Perches
On Wed, 2008-02-20 at 07:29 -0800, Joe Perches wrote: > fs/nfsd/nfsproc.c: char buf[RPC_MAX_ADDRBUFLEN]; > Perhaps there should be a DECLARE_RPC_BUF(buf) macro? > #define DECLARE_RPC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused Make that: #define DECLARE_RPC_BUF(var) char var[RPC_M

Re: [PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Joe Perches
On Wed, 2008-02-20 at 17:02 +0300, Pavel Emelyanov wrote: > There are tree places, which declare the char buf[...] on the stack > to push it later into dprintk(). Since the dprintk sometimes (if the > CONFIG_SYSCTL=n) becomes an empty do { } while (0) stub, these buffers > cause gcc to produce app

[PATCH] SUNRPC: Mark buffer used for debug printks with __maybe_unused

2008-02-20 Thread Pavel Emelyanov
There are tree places, which declare the char buf[...] on the stack to push it later into dprintk(). Since the dprintk sometimes (if the CONFIG_SYSCTL=n) becomes an empty do { } while (0) stub, these buffers cause gcc to produce appropriate warnings. Mark them as __maybe_unused. Signed-off-by: P