aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/checkpatch.pl15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index add86862325b..89177c349f93 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1249,17 +1249,22 @@ sub process {
1249 my $pre_ctx = "$1$2"; 1249 my $pre_ctx = "$1$2";
1250 1250
1251 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); 1251 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
1252 my $ctx_ln = $linenr + $#ctx + 1;
1253 my $ctx_cnt = $realcnt - $#ctx - 1; 1252 my $ctx_cnt = $realcnt - $#ctx - 1;
1254 my $ctx = join("\n", @ctx); 1253 my $ctx = join("\n", @ctx);
1255 1254
1256 ##warn "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n"; 1255 my $ctx_ln = $linenr;
1256 my $ctx_skip = $realcnt;
1257 1257
1258 # Skip over any removed lines in the context following statement. 1258 while ($ctx_skip > $ctx_cnt || ($ctx_skip == $ctx_cnt &&
1259 while (defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^-/) { 1259 defined $lines[$ctx_ln - 1] &&
1260 $lines[$ctx_ln - 1] =~ /^-/)) {
1261 ##print "SKIP<$ctx_skip> CNT<$ctx_cnt>\n";
1262 $ctx_skip-- if (!defined $lines[$ctx_ln - 1] || $lines[$ctx_ln - 1] !~ /^-/);
1260 $ctx_ln++; 1263 $ctx_ln++;
1261 } 1264 }
1262 ##warn "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n"; 1265
1266 ##print "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n";
1267 ##print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n";
1263 1268
1264 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) { 1269 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
1265 ERROR("that open brace { should be on the previous line\n" . 1270 ERROR("that open brace { should be on the previous line\n" .