lkml.org 
[lkml]   [2009]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/7] checkpatch: possible types -- prevent illegal modifiers being added
    Date
    Prevent known non types being detected as modifiers.  Ensure we do not
    look at any type which starts with a keyword.

    Signed-off-by: Andy Whitcroft <apw@canonical.com>
    ---
    scripts/checkpatch.pl | 20 ++++++++++++--------
    1 files changed, 12 insertions(+), 8 deletions(-)

    diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
    index 87bbb8b..b43e309 100755
    --- a/scripts/checkpatch.pl
    +++ b/scripts/checkpatch.pl
    @@ -997,23 +997,25 @@ sub annotate_values {

    sub possible {
    my ($possible, $line) = @_;
    -
    - print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
    - if ($possible !~ /(?:
    + my $notPermitted = qr{(?:
    ^(?:
    $Modifier|
    $Storage|
    $Type|
    - DEFINE_\S+|
    + DEFINE_\S+
    + )$|
    + ^(?:
    goto|
    return|
    case|
    else|
    asm|__asm__|
    do
    - )$|
    + )(?:\s|$)|
    ^(?:typedef|struct|enum)\b
    - )/x) {
    + )}x;
    + warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
    + if ($possible !~ $notPermitted) {
    # Check for modifiers.
    $possible =~ s/\s*$Storage\s*//g;
    $possible =~ s/\s*$Sparse\s*//g;
    @@ -1022,8 +1024,10 @@ sub possible {
    } elsif ($possible =~ /\s/) {
    $possible =~ s/\s*$Type\s*//g;
    for my $modifier (split(' ', $possible)) {
    - warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
    - push(@modifierList, $modifier);
    + if ($modifier !~ $notPermitted) {
    + warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
    + push(@modifierList, $modifier);
    + }
    }

    } else {
    --
    1.6.3.3


    \
     
     \ /
      Last update: 2009-10-16 20:43    [W:3.251 / U:0.184 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site