[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1231764304-1491-2-git-send-email-apw@canonical.com>
Date: Mon, 12 Jan 2009 12:44:59 +0000
From: Andy Whitcroft <apw@...onical.com>
To: Andrew Morton <akpm@...l.org>
Cc: Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
Andy Whitcroft <apw@...onical.com>
Subject: [PATCH 1/6] checkpatch: handle missing #if open in context
If the #if opening statement is not in the context then the context
stack can be empty. Handle this by ensuring there is always a blank
entry in the stack.
Signed-off-by: Andy Whitcroft <apw@...onical.com>
Tested-by: Dhaval Giani <dhaval@...ux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@...e.hu>
---
scripts/checkpatch.pl | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7bed4ed..eefef65 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -411,13 +411,15 @@ sub ctx_statement_block {
my $type = '';
my $level = 0;
- my @stack = ([$type, $level]);
+ my @stack = ();
my $p;
my $c;
my $len = 0;
my $remainder;
while (1) {
+ @stack = (['', 0]) if ($#stack == -1);
+
#warn "CSB: blk<$blk> remain<$remain>\n";
# If we are about to drop off the end, pull in more
# context.
--
1.6.0.4.911.gc990
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists