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.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -3121,7 +3121,7 @@ sub process { · 3120 unmodified lines | ||
| 3121 | 3121 | } |
| 3122 | 3122 | |
| 3123 | 3123 | # check for whitespace before a non-naked semicolon |
| 3124 | − if ($line =~ /^\+.*\S\s+;/) { | |
| 3124 | + if ($line =~ /^\+.*\S\s+;\s*$/) { | |
| 3125 | 3125 | if (WARN("SPACING", |
| 3126 | 3126 | "space prohibited before semicolon\n" . $herecurr) && |
| 3127 | 3127 | $fix) { |