mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
checkpatch: detect multiple bitfield declarations
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 <apw@shadowen.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
5fe3af119b
commit
8e761b04a3
1 changed files with 9 additions and 5 deletions
|
@ -844,11 +844,11 @@ sub annotate_values {
|
||||||
$type = 'V';
|
$type = 'V';
|
||||||
$av_pending = 'V';
|
$av_pending = 'V';
|
||||||
|
|
||||||
} elsif ($cur =~ /^($Ident\s*):/) {
|
} elsif ($cur =~ /^($Ident\s*):(?:\s*\d+\s*(,|=|;))?/) {
|
||||||
if ($type eq 'E') {
|
if (defined $2 && $type eq 'C' || $type eq 'T') {
|
||||||
$av_pend_colon = 'L';
|
|
||||||
} elsif ($type eq 'T') {
|
|
||||||
$av_pend_colon = 'B';
|
$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);
|
print "IDENT_COLON($1,$type>$av_pend_colon)\n" if ($dbg_values > 1);
|
||||||
$type = 'V';
|
$type = 'V';
|
||||||
|
@ -866,6 +866,10 @@ sub annotate_values {
|
||||||
$type = 'E';
|
$type = 'E';
|
||||||
$av_pend_colon = 'O';
|
$av_pend_colon = 'O';
|
||||||
|
|
||||||
|
} elsif ($cur =~/^(,)/) {
|
||||||
|
print "COMMA($1)\n" if ($dbg_values > 1);
|
||||||
|
$type = 'C';
|
||||||
|
|
||||||
} elsif ($cur =~ /^(\?)/o) {
|
} elsif ($cur =~ /^(\?)/o) {
|
||||||
print "QUESTION($1)\n" if ($dbg_values > 1);
|
print "QUESTION($1)\n" if ($dbg_values > 1);
|
||||||
$type = 'N';
|
$type = 'N';
|
||||||
|
@ -881,7 +885,7 @@ sub annotate_values {
|
||||||
}
|
}
|
||||||
$av_pend_colon = 'O';
|
$av_pend_colon = 'O';
|
||||||
|
|
||||||
} elsif ($cur =~ /^(;|\[)/o) {
|
} elsif ($cur =~ /^(\[)/o) {
|
||||||
print "CLOSE($1)\n" if ($dbg_values > 1);
|
print "CLOSE($1)\n" if ($dbg_values > 1);
|
||||||
$type = 'N';
|
$type = 'N';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue