aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/checkpatch.pl25
1 files changed, 15 insertions, 10 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3ae79ab2cab..6ddae89c3cfa 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1434,7 +1434,7 @@ sub process {
1434 if ($s =~ s/^\s*\\//) { 1434 if ($s =~ s/^\s*\\//) {
1435 $continuation = 1; 1435 $continuation = 1;
1436 } 1436 }
1437 if ($s =~ s/^\s*\n//) { 1437 if ($s =~ s/^\s*?\n//) {
1438 $check = 1; 1438 $check = 1;
1439 $cond_lines++; 1439 $cond_lines++;
1440 } 1440 }
@@ -1446,15 +1446,20 @@ sub process {
1446 $check = 0; 1446 $check = 0;
1447 } 1447 }
1448 1448
1449 # Ignore the current line if its is a preprocessor 1449 my $cond_ptr = -1;
1450 # line. 1450 while ($cond_ptr != $cond_lines) {
1451 if ($s =~ /^\s*#\s*/) { 1451 $cond_ptr = $cond_lines;
1452 $check = 0;
1453 }
1454 1452
1455 # Ignore the current line if it is label. 1453 # Ignore:
1456 if ($s =~ /^\s*$Ident\s*:/) { 1454 # 1) blank lines, they should be at 0,
1457 $check = 0; 1455 # 2) preprocessor lines, and
1456 # 3) labels.
1457 if ($s =~ /^\s*?\n/ ||
1458 $s =~ /^\s*#\s*?/ ||
1459 $s =~ /^\s*$Ident\s*:/) {
1460 $s =~ s/^.*?\n//;
1461 $cond_lines++;
1462 }
1458 } 1463 }
1459 1464
1460 my (undef, $sindent) = line_stats("+" . $s); 1465 my (undef, $sindent) = line_stats("+" . $s);
@@ -1470,7 +1475,7 @@ sub process {
1470 $stat_real = "[...]\n$stat_real"; 1475 $stat_real = "[...]\n$stat_real";
1471 } 1476 }
1472 1477
1473 ##print "line<$line> prevline<$prevline> indent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_lines> stat_real<$stat_real> stat<$stat>\n"; 1478 #print "line<$line> prevline<$prevline> indent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_lines> stat_real<$stat_real> stat<$stat>\n";
1474 1479
1475 if ($check && (($sindent % 8) != 0 || 1480 if ($check && (($sindent % 8) != 0 ||
1476 ($sindent <= $indent && $s ne ''))) { 1481 ($sindent <= $indent && $s ne ''))) {