lkml.org 
[lkml]   [2009]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/6] checkpatch: handle missing #if open in context
    Date
    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


    \
     
     \ /
      Last update: 2009-01-12 13:49    [W:0.023 / U:58.556 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site