diff options
author | Andy Whitcroft <apw@canonical.com> | 2010-10-26 17:23:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 19:52:19 -0400 |
commit | 6b4c5bebcebb0a48d29947e9aa749650751a7696 (patch) | |
tree | 95a5dcebb9046e280ed829391f2d2f8458cd349e /scripts | |
parent | 658716d19f8f155c67d4677ba68034b8e492dfbe (diff) |
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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2039acdf5122..0a87c7417ada 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1459,10 +1459,13 @@ sub process { | |||
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | # check for spaces at the beginning of a line. | 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 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | 1467 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; |
1464 | WARN("please, no space for starting a line, \ | 1468 | WARN("please, no spaces at the start of a line\n" . $herevet); |
1465 | excluding comments\n" . $herevet); | ||
1466 | } | 1469 | } |
1467 | 1470 | ||
1468 | # check we are in a valid C source file if not then ignore this hunk | 1471 | # check we are in a valid C source file if not then ignore this hunk |