From: Schrober <franzschrober@yahoo.de>
To: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Stephen Rothwell <sfr@canb.auug.org.au>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] checkpatch: Add control statement test to SINGLE_STATEMENT_DO_WHILE_MACRO
Date: Thu, 02 Aug 2012 18:44:57 +0200 [thread overview]
Message-ID: <14936868.DMgLzkV3C3@bentobox> (raw)
In-Reply-To: <20120802162322.GI2501@dm>
On Thursday 02 August 2012 17:23:22 Andy Whitcroft wrote:
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 913d6bd..ca05ba2 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -3016,7 +3016,8 @@ sub process {
> >
> > $herectx .= raw_line($linenr, $n) . "\n";
> >
> > }
> >
> > - if (($stmts =~ tr/;/;/) == 1) {
> > + if (($stmts =~ tr/;/;/) == 1 &&
> > + $stmts !~ /^\s*(if|while|for|switch)\b/) {
> >
> > WARN("SINGLE_STATEMENT_DO_WHILE_MACRO",
> >
> > "Single statement macros should not use a do {} while
(0)
> > loop\n" . "$herectx");>
> > }
>
> Looks reasonable enough.
>
> Acked-by: Andy Whitcroft <apw@canonical.com>
Works well for me, thanks
Just as note: I think this test was accidently added twice. Once in commit
b13edf7ff2dd0fef95e981170fa71fa6b60421b0 and one time in
7d64ef43914a734990e48a80bc60686c8db21946 (just checked linux-next, and Stephen
added it again). Maybe Andrew Morton's tree is out of sync.
--
Franz Schrober
next prev parent reply other threads:[~2012-08-02 16:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 8:00 checkpatch.pl: Wrong check SINGLE_STATEMENT_DO_WHILE_MACRO Schrober
2012-08-02 14:20 ` Andy Whitcroft
2012-08-02 15:26 ` [PATCH] checkpatch: Add control statement test to SINGLE_STATEMENT_DO_WHILE_MACRO Joe Perches
2012-08-02 16:23 ` Andy Whitcroft
2012-08-02 16:44 ` Schrober [this message]
2012-08-02 22:10 ` Stephen Rothwell
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=14936868.DMgLzkV3C3@bentobox \
--to=franzschrober@yahoo.de \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
/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