Commit 9446ef56 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Linus Torvalds
Browse files

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: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarAndy Whitcroft <apw@canonical.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fb2d2c1b
...@@ -845,6 +845,11 @@ sub annotate_values { ...@@ -845,6 +845,11 @@ sub annotate_values {
$av_preprocessor = 0; $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*$)/) { } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) {
print "DECLARE($1)\n" if ($dbg_values > 1); print "DECLARE($1)\n" if ($dbg_values > 1);
$type = 'T'; $type = 'T';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment