Skip to content

Commit

Permalink
checkpatch: detect multiple bitfield declarations
Browse files Browse the repository at this point in the history
Detect the colons (:) which make up secondary bitfield declarations and
apply binary colon checks.  For example the following is common idiom:

	int foo:1,
	    bar:1;

Signed-off-by: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
awhitcroft authored and torvalds committed Jan 6, 2009
1 parent 5fe3af1 commit 8e761b0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -844,11 +844,11 @@ sub annotate_values {
$type = 'V';
$av_pending = 'V';

} elsif ($cur =~ /^($Ident\s*):/) {
if ($type eq 'E') {
$av_pend_colon = 'L';
} elsif ($type eq 'T') {
} elsif ($cur =~ /^($Ident\s*):(?:\s*\d+\s*(,|=|;))?/) {
if (defined $2 && $type eq 'C' || $type eq 'T') {
$av_pend_colon = 'B';
} elsif ($type eq 'E') {
$av_pend_colon = 'L';
}
print "IDENT_COLON($1,$type>$av_pend_colon)\n" if ($dbg_values > 1);
$type = 'V';
Expand All @@ -866,6 +866,10 @@ sub annotate_values {
$type = 'E';
$av_pend_colon = 'O';

} elsif ($cur =~/^(,)/) {
print "COMMA($1)\n" if ($dbg_values > 1);
$type = 'C';

} elsif ($cur =~ /^(\?)/o) {
print "QUESTION($1)\n" if ($dbg_values > 1);
$type = 'N';
Expand All @@ -881,7 +885,7 @@ sub annotate_values {
}
$av_pend_colon = 'O';

} elsif ($cur =~ /^(;|\[)/o) {
} elsif ($cur =~ /^(\[)/o) {
print "CLOSE($1)\n" if ($dbg_values > 1);
$type = 'N';

Expand Down

0 comments on commit 8e761b0

Please sign in to comment.