summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2010-10-27 01:23:13 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 03:52:20 +0400
commit9446ef569c288e683225fec8337a0b2b81e75cc5 (patch)
treea46d6265a77f637f882c9136c914483b5d4598d8 /scripts/checkpatch.pl
parentfb2d2c1b5825503d30fb6f2dc328dbe4a47d9794 (diff)
downloadlinux-9446ef569c288e683225fec8337a0b2b81e75cc5.tar.xz
checkpatch: handle casts better fixing false categorisation of : as binary
The following incantation is triggering categorisation of its colon (:) as a binary form, which it is not: return foo ? (s8)bar : baz; Handle casts differently from types in the categoriser, allowing us to better track (s8)bar as a value and not a declaration. Reported-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Andy Whitcroft <apw@canonical.com> 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.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8d010ac0efe1..3cec2990d51e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -845,6 +845,11 @@ sub annotate_values {
$av_preprocessor = 0;
}
+ } elsif ($cur =~ /^(\(\s*$Type\s*)\)/) {
+ print "CAST($1)\n" if ($dbg_values > 1);
+ push(@av_paren_type, $type);
+ $type = 'C';
+
} elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) {
print "DECLARE($1)\n" if ($dbg_values > 1);
$type = 'T';