Commit 6b4c5beb authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Linus Torvalds

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: default avatarAndy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 658716d1
...@@ -1459,10 +1459,13 @@ sub process { ...@@ -1459,10 +1459,13 @@ sub process {
} }
# check for spaces at the beginning of a line. # check for spaces at the beginning of a line.
if ($rawline =~ /^\+ / && $rawline !~ /\+ +\*/) { # Exceptions:
# 1) within comments
# 2) indented preprocessor commands
# 3) hanging labels
if ($rawline =~ /^\+ / && $line !~ /\+ *(?:$;|#|$Ident:)/) {
my $herevet = "$here\n" . cat_vet($rawline) . "\n"; my $herevet = "$here\n" . cat_vet($rawline) . "\n";
WARN("please, no space for starting a line, \ WARN("please, no spaces at the start of a line\n" . $herevet);
excluding comments\n" . $herevet);
} }
# check we are in a valid C source file if not then ignore this hunk # check we are in a valid C source file if not then ignore this hunk
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment