Skip to content

Commit

Permalink
checkpatch: handle casts better fixing false categorisation of : as b…
Browse files Browse the repository at this point in the history
…inary

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>
  • Loading branch information
Andy Whitcroft authored and Linus Torvalds committed Oct 26, 2010
1 parent fb2d2c1 commit 9446ef5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 9446ef5

Please sign in to comment.