]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
checkpatch: warn only on "space before semicolon" at end of line
authorJoe Perches <joe@perches.com>
Wed, 15 Jan 2014 05:55:33 +0000 (16:55 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 15 Jan 2014 05:55:33 +0000 (16:55 +1100)
The "space before a non-naked semicolon" test has unwanted output when
used in "for ( ;; )" loops.

Make the test work only on end-of-line statement
termination semicolons.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/checkpatch.pl

index ec69c49b7e54648a7e5867662f7e79e40c3f4ca5..e5a6a5246fb7f0f859740d90c8694087200d4aae 100755 (executable)
@@ -3118,7 +3118,7 @@ sub process {
                }
 
 # check for whitespace before a non-naked semicolon
-               if ($line =~ /^\+.*\S\s+;/) {
+               if ($line =~ /^\+.*\S\s+;\s*$/) {
                        if (WARN("SPACING",
                                 "space prohibited before semicolon\n" . $herecurr) &&
                            $fix) {