From 2a7b334310660c834d28d5b02b60c5660eddbe1d Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Wed, 23 Jul 2008 21:29:01 -0700 Subject: [PATCH] --- yaml --- r: 105387 b: refs/heads/master c: 548596d523d83dff5a670beb84be0daf4c3bcd16 h: refs/heads/master i: 105385: 232de502f3f805198b2505a66fbc7eb6a0c6d78b 105383: eda13a71b06a94287ad59101180bff8e81c15d26 v: v3 --- [refs] | 2 +- trunk/scripts/checkpatch.pl | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 011ed5ca279a..eca37a55e59b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a3bb97a7aba36055d476896ed6393ab35a119d5b +refs/heads/master: 548596d523d83dff5a670beb84be0daf4c3bcd16 diff --git a/trunk/scripts/checkpatch.pl b/trunk/scripts/checkpatch.pl index add86862325b..89177c349f93 100755 --- a/trunk/scripts/checkpatch.pl +++ b/trunk/scripts/checkpatch.pl @@ -1249,17 +1249,22 @@ sub process { my $pre_ctx = "$1$2"; my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0); - my $ctx_ln = $linenr + $#ctx + 1; my $ctx_cnt = $realcnt - $#ctx - 1; my $ctx = join("\n", @ctx); - ##warn "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n"; + my $ctx_ln = $linenr; + my $ctx_skip = $realcnt; - # Skip over any removed lines in the context following statement. - while (defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^-/) { + while ($ctx_skip > $ctx_cnt || ($ctx_skip == $ctx_cnt && + defined $lines[$ctx_ln - 1] && + $lines[$ctx_ln - 1] =~ /^-/)) { + ##print "SKIP<$ctx_skip> CNT<$ctx_cnt>\n"; + $ctx_skip-- if (!defined $lines[$ctx_ln - 1] || $lines[$ctx_ln - 1] !~ /^-/); $ctx_ln++; } - ##warn "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n"; + + ##print "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n"; + ##print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n"; if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln -1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) { ERROR("that open brace { should be on the previous line\n" .