From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTs1P-0006cA-3i for qemu-devel@nongnu.org; Fri, 25 Nov 2011 04:24:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTs1N-0000Sj-NI for qemu-devel@nongnu.org; Fri, 25 Nov 2011 04:24:39 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:63512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTs1N-0000Sc-Ip for qemu-devel@nongnu.org; Fri, 25 Nov 2011 04:24:37 -0500 Received: by iakk32 with SMTP id k32so4823702iak.4 for ; Fri, 25 Nov 2011 01:24:37 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 25 Nov 2011 10:24:16 +0100 Message-Id: <1322213056-16612-1-git-send-email-pbonzini@redhat.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH 1.0] checkpatch.pl: fix CAST detection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , peter.chubb@nicta.com.au From: Florian Mickler 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: Peter Chubb Signed-off-by: Florian Mickler (cherry-picked from Linux kernel commit c023e4734c3e8801e0ecb5e81b831d42a374d861) Signed-off-by: Paolo Bonzini Cc: Blue Swirl --- scripts/checkpatch.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 36d6851..ddd27d8 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'; -- 1.7.7.1