From: Andy Whitcroft <apw@canonical.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 1/6] checkpatch: handle missing #if open in context
Date: Mon, 12 Jan 2009 12:44:59 +0000 [thread overview]
Message-ID: <1231764304-1491-2-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1231764304-1491-1-git-send-email-apw@canonical.com>
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@canonical.com>
Tested-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.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
next prev parent reply other threads:[~2009-01-12 12:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 12:44 [PATCH 0/6] update checkpatch to version 0.27 Andy Whitcroft
2009-01-12 12:44 ` Andy Whitcroft [this message]
2009-01-12 12:45 ` [PATCH 2/6] checkpatch: type/cast spacing should not check prefix spacing Andy Whitcroft
2009-01-12 12:45 ` [PATCH 3/6] checkpatch: allow parentheses on return handle array values Andy Whitcroft
2009-01-12 12:45 ` [PATCH 4/6] checkpatch: if should not continue a preceeding brace Andy Whitcroft
2009-01-12 12:45 ` [PATCH 5/6] checkpatch: struct seq_operations should normally be const Andy Whitcroft
2009-01-12 12:45 ` [PATCH 6/6] checkpatch: version: 0.27 Andy Whitcroft
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1231764304-1491-2-git-send-email-apw@canonical.com \
--to=apw@canonical.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®