Skip to content

Commit d2e248e

Browse files
JoePerchestorvalds
authored andcommitted
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. Signed-off-by: Joe Perches <joe@perches.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 8c5fcd2 commit d2e248e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎scripts/checkpatch.pl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3121,7 +3121,7 @@ sub process {
31213121
}
31223122

31233123
# check for whitespace before a non-naked semicolon
3124-
if ($line =~ /^\+.*\S\s+;/) {
3124+
if ($line =~ /^\+.*\S\s+;\s*$/) {
31253125
if (WARN("SPACING",
31263126
"space prohibited before semicolon\n" . $herecurr) &&
31273127
$fix) {

0 commit comments

Comments
 (0)