Skip to content

Commit

Permalink
checkpatch: possible modifiers -- handle multiple modifiers and trailing
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
awhitcroft authored and torvalds committed Jul 24, 2008
1 parent 0221f55 commit d250658
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d250658

Please sign in to comment.