History

checkpatch: warn only on "space before semicolon" at end of line

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.

Joe Perches committed 12 years ago

Commit d2e248e1 parent 8c5fcd21 file · +1 −1Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+1−1
@@ -3121,7 +3121,7 @@ sub process { · 3120 unmodified lines
3121 }3121 }
3122 3122
3123# check for whitespace before a non-naked semicolon3123# check for whitespace before a non-naked semicolon
3124 if ($line =~ /^\+.*\S\s+;/) {3124 if ($line =~ /^\+.*\S\s+;\s*$/) {
3125 if (WARN("SPACING",3125 if (WARN("SPACING",
3126 "space prohibited before semicolon\n" . $herecurr) &&3126 "space prohibited before semicolon\n" . $herecurr) &&
3127 $fix) {3127 $fix) {