History

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:

Andy Whitcroft committed 16 years ago

Commit 6b4c5be1 parent 658716d1 file · +6 −3Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+6−3
@@ -1459,10 +1459,13 @@ sub process { · 1458 unmodified lines
14591459 }
14601460
14611461 # 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:)/) {
14631467 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);
14661469 }
14671470
14681471 # check we are in a valid C source file if not then ignore this hunk

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t