Skip to content

Commit

Permalink
checkpatch: suspect indent handle macro continuation
Browse files Browse the repository at this point in the history
When ignoring a macro in the middle of a conditional, we need to ignore
the macro start and any continuation lines.

Signed-off-by: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
awhitcroft authored and torvalds committed Oct 16, 2008
1 parent bb44ad3 commit 740504c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@ sub process {
}

my $cond_ptr = -1;
$continuation = 0;
while ($cond_ptr != $cond_lines) {
$cond_ptr = $cond_lines;

Expand All @@ -1478,9 +1479,11 @@ sub process {
# 1) blank lines, they should be at 0,
# 2) preprocessor lines, and
# 3) labels.
if ($s =~ /^\s*?\n/ ||
if ($continuation ||
$s =~ /^\s*?\n/ ||
$s =~ /^\s*#\s*?/ ||
$s =~ /^\s*$Ident\s*:/) {
$continuation = ($s =~ /^.*?\\\n/) ? 1 : 0;
$s =~ s/^.*?\n//;
$cond_lines++;
}
Expand Down

0 comments on commit 740504c

Please sign in to comment.