[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140910084306.GV6600@mwanda>
Date: Wed, 10 Sep 2014 11:43:06 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Joe Perches <joe@...ches.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
devel@...verdev.osuosl.org,
"Dilger, Andreas" <andreas.dilger@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Peng Tao <bergwolf@...il.com>, kernel-janitors@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Drokin, Oleg" <oleg.drokin@...el.com>,
Julia Lawall <Julia.Lawall@...6.fr>,
Andy Whitcroft <apw@...onical.com>
Subject: Re: [PATCH] checkpatch: Warn on macros with flow control statements
On Tue, Sep 09, 2014 at 01:38:13PM -0700, Joe Perches wrote:
> Macros with flow control statements (goto and return) are
> not very nice to read as any flow movement is unexpected.
>
> Try to highlight them and emit a warning on their definition.
>
> Avoid warning on macros that use argument concatenation as
> those macros commonly create another function where the
> concatenation is used in the function name definition like:
> #define FOO_FUNC(name, rtn_type) \
> rtn_type func##name(arg1, ...) \
> { \
> rtn_type rtn; \
> [code...] \
> return rtn; \
> }
>
It adds 382 new warnings.
The '##' trick doesn't remove all then macros which create functions.
I can't think of a better way to do that though.
We will eventually get rid of almost all the warnings in staging. The
one that makes sense to keep is:
drivers/staging/lustre/lnet/selftest/selftest.h:559
#define STATE2STR(x) case x: return #x
My guess is that other maintainers won't be as excited to change these...
Some of the macros have "RETURN", "RET" or "EXIT" in the name so the
return is not really hidden.
I'll attach the list of warning locations.
regards,
dan carpenter
View attachment "err-list" of type "text/plain" (13090 bytes)
Powered by blists - more mailing lists