From: Florian Mickler Date: Thu, 13 Jan 2011 00:59:58 +0000 (-0800) Subject: checkpatch.pl: fix CAST detection X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=c023e4734c3e8801e0ecb5e81b831d42a374d861;p=openwrt%2Fstaging%2Fblogic.git checkpatch.pl: fix CAST detection We should only claim that something is a cast if we did not encouter a token before, that did set av_pending. This fixes the operator * in the line below to be detected as binary (vs unary). kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL); Reported-by: Audun Hoem Signed-off-by: Florian Mickler Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 36d6851f97d0..ddd27d8e6312 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -859,7 +859,7 @@ sub annotate_values { $av_preprocessor = 0; } - } elsif ($cur =~ /^(\(\s*$Type\s*)\)/) { + } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') { print "CAST($1)\n" if ($dbg_values > 1); push(@av_paren_type, $type); $type = 'C';