lkml.org 
[lkml]   [2008]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 23/23] checkpatch: possible modifiers -- handle multiple modifiers and trailing
Date
Add support for multiple modifiers such as:

int __one __two foo;

Also handle trailing known modifiers when defecting modifiers:

int __one foo __read_mostly;

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
scripts/checkpatch.pl | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c20916..8a3b0fd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -859,8 +859,10 @@ sub possible {

} elsif ($possible =~ /\s/) {
$possible =~ s/\s*$Type\s*//g;
- warn "MODIFIER: $possible ($line)\n" if ($dbg_possible);
- push(@modifierList, $possible);
+ for my $modifier (split(' ', $possible)) {
+ warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
+ push(@modifierList, $modifier);
+ }

} else {
warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible);
@@ -1186,7 +1188,7 @@ sub process {
} elsif ($s =~ /^.\s*$Ident\s*\(/s) {

# declarations always start with types
- } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))\s*(?:;|=|,|\()/s) {
+ } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) {
my $type = $1;
$type =~ s/\s+/ /g;
possible($type, "A:" . $s);
--
1.5.6.rc0.140.ga9675


\
 
 \ /
  Last update: 2008-06-12 14:13    [W:0.358 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site