From: Joe Perches <joe@perches.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
devel@driverdev.osuosl.org, "Dilger,
Andreas" <andreas.dilger@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Peng Tao <bergwolf@gmail.com>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
"Drokin, Oleg" <oleg.drokin@intel.com>,
Andy Whitcroft <apw@canonical.com>
Subject: Re: [PATCH] checkpatch: Warn on macros with flow control statements
Date: Wed, 10 Sep 2014 07:36:40 -0700 [thread overview]
Message-ID: <1410359800.24028.51.camel@joe-AO725> (raw)
In-Reply-To: <alpine.DEB.2.10.1409101604210.4747@hadrien>
On Wed, 2014-09-10 at 16:06 +0200, Julia Lawall wrote:
> On Wed, 10 Sep 2014, Joe Perches wrote:
> > On Wed, 2014-09-10 at 11:43 +0300, Dan Carpenter wrote:
> > > 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.
> >
> > break and continue are also flow control statements
> > but are those are frequently used in macros in
> > complete switch statements so were not added.
>
> Would it be possible to make a warning when there is a break or continue
> but no while/switch/etc.
I suppose the has_flow_statement could be extended.
Maybe something like:
if ($ctx =~ /\b(goto|return|break|continue)\b/ &&
$ctx !~ /\b(switch|if|do|while)\b/) {
has_flow_statement = 1;
}
but checkpatch isn't really capable of doing proper
flow logic analysis.
I'm not sure it's worthwhile.
next prev parent reply other threads:[~2014-09-10 14:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-07 16:18 [PATCH 6/7] staging: lustre: obdclass: expand the GOTO macro + break Julia Lawall
2014-09-09 12:54 ` Dan Carpenter
2014-09-09 13:05 ` Julia Lawall
2014-09-09 13:37 ` Drokin, Oleg
2014-09-09 20:38 ` [PATCH] checkpatch: Warn on macros with flow control statements Joe Perches
2014-09-10 8:43 ` Dan Carpenter
2014-09-10 13:55 ` Joe Perches
2014-09-10 14:06 ` Julia Lawall
2014-09-10 14:36 ` Joe Perches [this message]
2014-09-10 14:52 ` Drokin, Oleg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1410359800.24028.51.camel@joe-AO725 \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=andreas.dilger@intel.com \
--cc=apw@canonical.com \
--cc=bergwolf@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=julia.lawall@lip6.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg.drokin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®