Commit 6b4c5bebcebb0a48d29947e9aa749650751a7696

Authored by Andy Whitcroft
Committed by Linus Torvalds
1 parent 658716d19f

checkpatch: fix regressions in "fix handling of leading spaces"

The patch "checkpatch: fix handling of leading spaces" added checks for
leading spaces on lines, but this introduces regressions.  Firstly it does
not correctly detect when we are in a comment.  Secondly it does not allow
for preprocessor command spacing.  Finally it does not allow for label
indentation which is required to be less than one tab.  Fix these up:

Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff

scripts/checkpatch.pl
... ... @@ -1459,10 +1459,13 @@
1459 1459 }
1460 1460  
1461 1461 # check for spaces at the beginning of a line.
1462   - if ($rawline =~ /^\+ / && $rawline !~ /\+ +\*/) {
  1462 +# Exceptions:
  1463 +# 1) within comments
  1464 +# 2) indented preprocessor commands
  1465 +# 3) hanging labels
  1466 + if ($rawline =~ /^\+ / && $line !~ /\+ *(?:$;|#|$Ident:)/) {
1463 1467 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
1464   - WARN("please, no space for starting a line, \
1465   - excluding comments\n" . $herevet);
  1468 + WARN("please, no spaces at the start of a line\n" . $herevet);
1466 1469 }
1467 1470  
1468 1471 # check we are in a valid C source file if not then ignore this hunk