aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2009-01-06 17:41:19 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:15 -0500
commit8e761b04a34288a3b0b29c0f49cdf157d7db8863 (patch)
tree70aa571d291926c33327acffa4923d0124cd9b12 /scripts
parent5fe3af119bed58d240e2097fe76f322ab51902d7 (diff)
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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c79abb41793d..9883de38b446 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -844,11 +844,11 @@ sub annotate_values {
844 $type = 'V'; 844 $type = 'V';
845 $av_pending = 'V'; 845 $av_pending = 'V';
846 846
847 } elsif ($cur =~ /^($Ident\s*):/) { 847 } elsif ($cur =~ /^($Ident\s*):(?:\s*\d+\s*(,|=|;))?/) {
848 if ($type eq 'E') { 848 if (defined $2 && $type eq 'C' || $type eq 'T') {
849 $av_pend_colon = 'L';
850 } elsif ($type eq 'T') {
851 $av_pend_colon = 'B'; 849 $av_pend_colon = 'B';
850 } elsif ($type eq 'E') {
851 $av_pend_colon = 'L';
852 } 852 }
853 print "IDENT_COLON($1,$type>$av_pend_colon)\n" if ($dbg_values > 1); 853 print "IDENT_COLON($1,$type>$av_pend_colon)\n" if ($dbg_values > 1);
854 $type = 'V'; 854 $type = 'V';
@@ -866,6 +866,10 @@ sub annotate_values {
866 $type = 'E'; 866 $type = 'E';
867 $av_pend_colon = 'O'; 867 $av_pend_colon = 'O';
868 868
869 } elsif ($cur =~/^(,)/) {
870 print "COMMA($1)\n" if ($dbg_values > 1);
871 $type = 'C';
872
869 } elsif ($cur =~ /^(\?)/o) { 873 } elsif ($cur =~ /^(\?)/o) {
870 print "QUESTION($1)\n" if ($dbg_values > 1); 874 print "QUESTION($1)\n" if ($dbg_values > 1);
871 $type = 'N'; 875 $type = 'N';
@@ -881,7 +885,7 @@ sub annotate_values {
881 } 885 }
882 $av_pend_colon = 'O'; 886 $av_pend_colon = 'O';
883 887
884 } elsif ($cur =~ /^(;|\[)/o) { 888 } elsif ($cur =~ /^(\[)/o) {
885 print "CLOSE($1)\n" if ($dbg_values > 1); 889 print "CLOSE($1)\n" if ($dbg_values > 1);
886 $type = 'N'; 890 $type = 'N';
887 891