From: Andy Whitcroft Date: Tue, 26 Oct 2010 21:23:13 +0000 (-0700) Subject: checkpatch: handle casts better fixing false categorisation of : as binary X-Git-Tag: v3.0~3010^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9446ef569c288e683225fec8337a0b2b81e75cc5;p=platform%2Fkernel%2Flinux-amlogic.git 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 Signed-off-by: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 8d010ac..3cec299 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';