aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2008-10-16 01:02:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:36 -0400
commit0776e594606e32a045e0a99bb919b2280b945495 (patch)
treeda5cb9f363484fcf343c72b7b48ada5191b97cf0 /scripts/checkpatch.pl
parent5fdd23acf9cd7f658746b119436ed1d787326c46 (diff)
checkpatch: do is not a possible type
A do without braces '{' may trigger a false possible type 'do' and then this may be interpreted as an external definition of foo(): do foo(); while (bar); Add do to the type exclusions. Fix up tests so we can check for them. 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/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl24
1 files changed, 18 insertions, 6 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 118fe1f30e76..6b21188d2cf7 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -913,12 +913,22 @@ sub annotate_values {
913sub possible { 913sub possible {
914 my ($possible, $line) = @_; 914 my ($possible, $line) = @_;
915 915
916 print "CHECK<$possible> ($line)\n" if ($dbg_possible > 1); 916 print "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
917 if ($possible !~ /^(?:$Modifier|$Storage|$Type|DEFINE_\S+)$/ && 917 if ($possible !~ /(?:
918 $possible ne 'goto' && $possible ne 'return' && 918 ^(?:
919 $possible ne 'case' && $possible ne 'else' && 919 $Modifier|
920 $possible ne 'asm' && $possible ne '__asm__' && 920 $Storage|
921 $possible !~ /^(typedef|struct|enum)\b/) { 921 $Type|
922 DEFINE_\S+|
923 goto|
924 return|
925 case|
926 else|
927 asm|__asm__|
928 do
929 )$|
930 ^(?:typedef|struct|enum)\b
931 )/x) {
922 # Check for modifiers. 932 # Check for modifiers.
923 $possible =~ s/\s*$Storage\s*//g; 933 $possible =~ s/\s*$Storage\s*//g;
924 $possible =~ s/\s*$Sparse\s*//g; 934 $possible =~ s/\s*$Sparse\s*//g;
@@ -936,6 +946,8 @@ sub possible {
936 push(@typeList, $possible); 946 push(@typeList, $possible);
937 } 947 }
938 build_types(); 948 build_types();
949 } else {
950 warn "NOTPOSS: $possible ($line)\n" if ($dbg_possible > 1);
939 } 951 }
940} 952}
941 953