lkml.org 
[lkml]   [2012]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] checkpatch: Add control statement test to SINGLE_STATEMENT_DO_WHILE_MACRO
Date
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


\
 
 \ /
  Last update: 2012-08-02 19:41    [W:0.055 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site