Commit a2750645 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Linus Torvalds

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: default avatarAndy Whitcroft <apw@canonical.com>
Tested-by: default avatarDhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c91192d6
...@@ -411,13 +411,15 @@ sub ctx_statement_block { ...@@ -411,13 +411,15 @@ sub ctx_statement_block {
my $type = ''; my $type = '';
my $level = 0; my $level = 0;
my @stack = ([$type, $level]); my @stack = ();
my $p; my $p;
my $c; my $c;
my $len = 0; my $len = 0;
my $remainder; my $remainder;
while (1) { while (1) {
@stack = (['', 0]) if ($#stack == -1);
#warn "CSB: blk<$blk> remain<$remain>\n"; #warn "CSB: blk<$blk> remain<$remain>\n";
# If we are about to drop off the end, pull in more # If we are about to drop off the end, pull in more
# context. # context.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment