* [PATCH -next] nfs: fix ISO C90 warning
[not found] <20091215165309.58e98eea.sfr@canb.auug.org.au>
@ 2009-12-16 22:23 ` Randy Dunlap
2009-12-16 22:40 ` Trond Myklebust
0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2009-12-16 22:23 UTC (permalink / raw)
To: Stephen Rothwell, Trond Myklebust; +Cc: linux-next, LKML, linux-nfs
From: Randy Dunlap <randy.dunlap@oracle.com>
Fix gcc ISO C90 warning:
fs/nfs/callback.c:356: warning: ISO C90 forbids mixed declarations and code
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
fs/nfs/callback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-next-20091215.orig/fs/nfs/callback.c
+++ linux-next-20091215/fs/nfs/callback.c
@@ -352,8 +352,8 @@ static int check_gss_callback_principal(
static int nfs_callback_authenticate(struct svc_rqst *rqstp)
{
struct nfs_client *clp;
- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
int ret = SVC_OK;
+ RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
/* Don't talk to strangers */
clp = nfs_find_client(svc_addr(rqstp), 4);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] nfs: fix ISO C90 warning
2009-12-16 22:23 ` [PATCH -next] nfs: fix ISO C90 warning Randy Dunlap
@ 2009-12-16 22:40 ` Trond Myklebust
2009-12-16 22:47 ` Randy Dunlap
0 siblings, 1 reply; 7+ messages in thread
From: Trond Myklebust @ 2009-12-16 22:40 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Stephen Rothwell, linux-next, LKML, linux-nfs
On Wed, 2009-12-16 at 14:23 -0800, Randy Dunlap wrote:
> From: Randy Dunlap <randy.dunlap@oracle.com>
>
> Fix gcc ISO C90 warning:
>
> fs/nfs/callback.c:356: warning: ISO C90 forbids mixed declarations and code
>
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> ---
> fs/nfs/callback.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- linux-next-20091215.orig/fs/nfs/callback.c
> +++ linux-next-20091215/fs/nfs/callback.c
> @@ -352,8 +352,8 @@ static int check_gss_callback_principal(
> static int nfs_callback_authenticate(struct svc_rqst *rqstp)
> {
> struct nfs_client *clp;
> - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
> int ret = SVC_OK;
> + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
>
What version of gcc is giving rise to this warning?
RPC_IFDEBUG is a macro that either evaluates to its argument, or to
nothing, depending on whether or not RPC_DEBUG is defined or not. In
neither case should it evaluate to anything illegal under C90 rules
afaics.
Trond
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] nfs: fix ISO C90 warning
2009-12-16 22:40 ` Trond Myklebust
@ 2009-12-16 22:47 ` Randy Dunlap
2009-12-16 22:58 ` Thomas Gleixner
0 siblings, 1 reply; 7+ messages in thread
From: Randy Dunlap @ 2009-12-16 22:47 UTC (permalink / raw)
To: Trond Myklebust; +Cc: Stephen Rothwell, linux-next, LKML, linux-nfs
On Wed, 16 Dec 2009 17:40:19 -0500 Trond Myklebust wrote:
> On Wed, 2009-12-16 at 14:23 -0800, Randy Dunlap wrote:
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> >
> > Fix gcc ISO C90 warning:
> >
> > fs/nfs/callback.c:356: warning: ISO C90 forbids mixed declarations and code
> >
> > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> > ---
> > fs/nfs/callback.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- linux-next-20091215.orig/fs/nfs/callback.c
> > +++ linux-next-20091215/fs/nfs/callback.c
> > @@ -352,8 +352,8 @@ static int check_gss_callback_principal(
> > static int nfs_callback_authenticate(struct svc_rqst *rqstp)
> > {
> > struct nfs_client *clp;
> > - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
> > int ret = SVC_OK;
> > + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
> >
>
> What version of gcc is giving rise to this warning?
> gcc --version
gcc (GCC) 4.2.1 (SUSE Linux)
> RPC_IFDEBUG is a macro that either evaluates to its argument, or to
> nothing, depending on whether or not RPC_DEBUG is defined or not. In
> neither case should it evaluate to anything illegal under C90 rules
> afaics.
Yep. Odd warning.
---
~Randy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] nfs: fix ISO C90 warning
2009-12-16 22:47 ` Randy Dunlap
@ 2009-12-16 22:58 ` Thomas Gleixner
2009-12-16 23:01 ` Trond Myklebust
0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2009-12-16 22:58 UTC (permalink / raw)
To: Randy Dunlap
Cc: Trond Myklebust, Stephen Rothwell, linux-next, LKML, linux-nfs
On Wed, 16 Dec 2009, Randy Dunlap wrote:
> On Wed, 16 Dec 2009 17:40:19 -0500 Trond Myklebust wrote:
>
> > On Wed, 2009-12-16 at 14:23 -0800, Randy Dunlap wrote:
> > > From: Randy Dunlap <randy.dunlap@oracle.com>
> > >
> > > Fix gcc ISO C90 warning:
> > >
> > > fs/nfs/callback.c:356: warning: ISO C90 forbids mixed declarations and code
> > >
> > > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> > > ---
> > > fs/nfs/callback.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > --- linux-next-20091215.orig/fs/nfs/callback.c
> > > +++ linux-next-20091215/fs/nfs/callback.c
> > > @@ -352,8 +352,8 @@ static int check_gss_callback_principal(
> > > static int nfs_callback_authenticate(struct svc_rqst *rqstp)
> > > {
> > > struct nfs_client *clp;
> > > - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
> > > int ret = SVC_OK;
> > > + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
> > >
> >
> > What version of gcc is giving rise to this warning?
>
> > gcc --version
> gcc (GCC) 4.2.1 (SUSE Linux)
>
> > RPC_IFDEBUG is a macro that either evaluates to its argument, or to
> > nothing, depending on whether or not RPC_DEBUG is defined or not. In
> > neither case should it evaluate to anything illegal under C90 rules
> > afaics.
>
> Yep. Odd warning.
Not really. If the debug macro evaluates to nothing then you have:
struct nfs_client *clp;
;
int ret = SVC_OK;
So you have a stray semicolon, which is interpreted as an empty code
line. That qualifies for the mixed declaration and code case :)
I know it's nitpicking, but ...
Thanks,
tglx
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] nfs: fix ISO C90 warning
2009-12-16 22:58 ` Thomas Gleixner
@ 2009-12-16 23:01 ` Trond Myklebust
2009-12-17 10:00 ` Américo Wang
0 siblings, 1 reply; 7+ messages in thread
From: Trond Myklebust @ 2009-12-16 23:01 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Randy Dunlap, Stephen Rothwell, linux-next, LKML, linux-nfs
On Wed, 2009-12-16 at 23:58 +0100, Thomas Gleixner wrote:
> On Wed, 16 Dec 2009, Randy Dunlap wrote:
> > On Wed, 16 Dec 2009 17:40:19 -0500 Trond Myklebust wrote:
> >
> > > On Wed, 2009-12-16 at 14:23 -0800, Randy Dunlap wrote:
> > > > From: Randy Dunlap <randy.dunlap@oracle.com>
> > > >
> > > > Fix gcc ISO C90 warning:
> > > >
> > > > fs/nfs/callback.c:356: warning: ISO C90 forbids mixed declarations and code
> > > >
> > > > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> > > > ---
> > > > fs/nfs/callback.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > --- linux-next-20091215.orig/fs/nfs/callback.c
> > > > +++ linux-next-20091215/fs/nfs/callback.c
> > > > @@ -352,8 +352,8 @@ static int check_gss_callback_principal(
> > > > static int nfs_callback_authenticate(struct svc_rqst *rqstp)
> > > > {
> > > > struct nfs_client *clp;
> > > > - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
> > > > int ret = SVC_OK;
> > > > + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
> > > >
> > >
> > > What version of gcc is giving rise to this warning?
> >
> > > gcc --version
> > gcc (GCC) 4.2.1 (SUSE Linux)
> >
> > > RPC_IFDEBUG is a macro that either evaluates to its argument, or to
> > > nothing, depending on whether or not RPC_DEBUG is defined or not. In
> > > neither case should it evaluate to anything illegal under C90 rules
> > > afaics.
> >
> > Yep. Odd warning.
>
> Not really. If the debug macro evaluates to nothing then you have:
>
> struct nfs_client *clp;
> ;
> int ret = SVC_OK;
>
> So you have a stray semicolon, which is interpreted as an empty code
> line. That qualifies for the mixed declaration and code case :)
>
> I know it's nitpicking, but ...
Ah... I see what you mean.
So really what we should do is just move that semicolon inside the
macro. That would change the !RPC_DEBUG case to
struct nfs_client *clp;
int ret = SVC_OK;
which is 100% legal...
Cheers
Trond
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] nfs: fix ISO C90 warning
2009-12-16 23:01 ` Trond Myklebust
@ 2009-12-17 10:00 ` Américo Wang
[not found] ` <2375c9f90912170200m12a5310cg90343c5c1081fbb8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Américo Wang @ 2009-12-17 10:00 UTC (permalink / raw)
To: Trond Myklebust
Cc: Thomas Gleixner, Randy Dunlap, Stephen Rothwell, linux-next, LKML,
linux-nfs
[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]
On Thu, Dec 17, 2009 at 7:01 AM, Trond Myklebust
<trond.myklebust@fys.uio.no> wrote:
> On Wed, 2009-12-16 at 23:58 +0100, Thomas Gleixner wrote:
>> On Wed, 16 Dec 2009, Randy Dunlap wrote:
>> > On Wed, 16 Dec 2009 17:40:19 -0500 Trond Myklebust wrote:
>> >
>> > > On Wed, 2009-12-16 at 14:23 -0800, Randy Dunlap wrote:
>> > > > From: Randy Dunlap <randy.dunlap@oracle.com>
>> > > >
>> > > > Fix gcc ISO C90 warning:
>> > > >
>> > > > fs/nfs/callback.c:356: warning: ISO C90 forbids mixed declarations and code
>> > > >
>> > > > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
>> > > > ---
>> > > > fs/nfs/callback.c | 2 +-
>> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
>> > > >
>> > > > --- linux-next-20091215.orig/fs/nfs/callback.c
>> > > > +++ linux-next-20091215/fs/nfs/callback.c
>> > > > @@ -352,8 +352,8 @@ static int check_gss_callback_principal(
>> > > > static int nfs_callback_authenticate(struct svc_rqst *rqstp)
>> > > > {
>> > > > struct nfs_client *clp;
>> > > > - RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
>> > > > int ret = SVC_OK;
>> > > > + RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
>> > > >
>> > >
>> > > What version of gcc is giving rise to this warning?
>> >
>> > > gcc --version
>> > gcc (GCC) 4.2.1 (SUSE Linux)
>> >
>> > > RPC_IFDEBUG is a macro that either evaluates to its argument, or to
>> > > nothing, depending on whether or not RPC_DEBUG is defined or not. In
>> > > neither case should it evaluate to anything illegal under C90 rules
>> > > afaics.
>> >
>> > Yep. Odd warning.
>>
>> Not really. If the debug macro evaluates to nothing then you have:
>>
>> struct nfs_client *clp;
>> ;
>> int ret = SVC_OK;
>>
>> So you have a stray semicolon, which is interpreted as an empty code
>> line. That qualifies for the mixed declaration and code case :)
>>
>> I know it's nitpicking, but ...
>
> Ah... I see what you mean.
>
> So really what we should do is just move that semicolon inside the
> macro. That would change the !RPC_DEBUG case to
>
> struct nfs_client *clp;
>
> int ret = SVC_OK;
>
> which is 100% legal...
>
Hi,
Check that currently all usages of RPC_DEBUG are the same,
we can replace them all.
What do you think about the attached patch?
Sorry for attaching it, I have a bad mail environment here.
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
[-- Attachment #2: rpc-replace-rpc-ifdebug.diff --]
[-- Type: text/plain, Size: 3004 bytes --]
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index e50cfa3..4fce0f2 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -152,7 +152,7 @@ lockd(void *vrqstp)
*/
while (!kthread_should_stop()) {
long timeout = MAX_SCHEDULE_TIMEOUT;
- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+ RPCBUF_IFDEBUG(buf);
/* update sv_maxconn if it has changed */
rqstp->rq_server->sv_maxconn = nlm_max_connections;
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 73ab220..e05b6fc 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -352,7 +352,7 @@ static int check_gss_callback_principal(struct nfs_client *clp,
static int nfs_callback_authenticate(struct svc_rqst *rqstp)
{
struct nfs_client *clp;
- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+ RPCBUF_IFDEBUG(buf);
int ret = SVC_OK;
/* Don't talk to strangers */
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 1c12177..7a84433 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -90,7 +90,7 @@ static __be32 nfsd_setuser_and_check_port(struct svc_rqst *rqstp,
/* Check if the request originated from a secure port. */
if (!rqstp->rq_secure && (flags & NFSEXP_INSECURE_PORT)) {
- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+ RPCBUF_IFDEBUG(buf);
dprintk(KERN_WARNING
"nfsd: request from insecure port %s!\n",
svc_print_addr(rqstp, buf, sizeof(buf)));
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index c2786f2..13185bb 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -52,11 +52,11 @@ extern unsigned int nlm_debug;
#ifdef RPC_DEBUG
# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
# define dfprintk(fac, args...) do { ifdebug(fac) printk(args); } while(0)
-# define RPC_IFDEBUG(x) x
+# define RPCBUF_IFDEBUG(x) char x[RPC_MAX_ADDRBUFLEN]
#else
# define ifdebug(fac) if (0)
# define dfprintk(fac, args...) do ; while (0)
-# define RPC_IFDEBUG(x)
+# define RPCBUF_IFDEBUG(x) char x[0]
#endif
/*
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 870929e..425c4c1 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -228,7 +228,7 @@ static int svc_sendto(struct svc_rqst *rqstp, struct xdr_buf *xdr)
int len = 0;
unsigned long tailoff;
unsigned long headoff;
- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+ RPCBUF_IFDEBUG(buf);
if (rqstp->rq_prot == IPPROTO_UDP) {
struct msghdr msg = {
@@ -808,7 +808,7 @@ static struct svc_xprt *svc_tcp_accept(struct svc_xprt *xprt)
struct socket *newsock;
struct svc_sock *newsvsk;
int err, slen;
- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+ RPCBUF_IFDEBUG(buf);
dprintk("svc: tcp_accept %p sock %p\n", svsk, sock);
if (!sock)
@@ -1410,7 +1410,7 @@ static struct svc_xprt *svc_create_socket(struct svc_serv *serv,
int newlen;
int family;
int val;
- RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
+ RPCBUF_IFDEBUG(buf);
dprintk("svc: svc_create_socket(%s, %d, %s)\n",
serv->sv_program->pg_name, protocol,
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH -next] nfs: fix ISO C90 warning
[not found] ` <2375c9f90912170200m12a5310cg90343c5c1081fbb8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-12-17 21:58 ` Trond Myklebust
0 siblings, 0 replies; 7+ messages in thread
From: Trond Myklebust @ 2009-12-17 21:58 UTC (permalink / raw)
To: Américo Wang
Cc: Thomas Gleixner, Randy Dunlap, Stephen Rothwell, linux-next, LKML,
linux-nfs
On Thu, 2009-12-17 at 18:00 +0800, Am=C3=A9rico Wang wrote:=20
> Hi,
> Check that currently all usages of RPC_DEBUG are the same,
> we can replace them all.
>=20
> What do you think about the attached patch?
>=20
> Sorry for attaching it, I have a bad mail environment here.
>=20
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Doesn't that approach instead lead to a lot of 'unreferenced variable'
warnings in the '#undef RPC_DEBUG' case?
Cheers
Trond
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-12-17 21:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20091215165309.58e98eea.sfr@canb.auug.org.au>
2009-12-16 22:23 ` [PATCH -next] nfs: fix ISO C90 warning Randy Dunlap
2009-12-16 22:40 ` Trond Myklebust
2009-12-16 22:47 ` Randy Dunlap
2009-12-16 22:58 ` Thomas Gleixner
2009-12-16 23:01 ` Trond Myklebust
2009-12-17 10:00 ` Américo Wang
[not found] ` <2375c9f90912170200m12a5310cg90343c5c1081fbb8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-17 21:58 ` Trond Myklebust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).