mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 05/16] checkpatch: handle casts better fixing false categorisation of : as binary
Date: Wed, 18 Aug 2010 16:46:38 +0100	[thread overview]
Message-ID: <1282146409-30544-6-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1282146409-30544-1-git-send-email-apw@canonical.com>

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>
---
 scripts/checkpatch.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

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';
-- 
1.7.0.4


  parent reply	other threads:[~2010-08-18 15:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18 15:46 [PATCH 00/16] update checkpatch to v0.31 Andy Whitcroft
2010-08-18 15:46 ` [PATCH 01/16] checkpatch: fix regressions in "fix handling of leading spaces" Andy Whitcroft
2010-08-18 15:46 ` [PATCH 02/16] checkpatch: types may sit on a line on their own Andy Whitcroft
2010-08-18 15:46 ` [PATCH 03/16] checkpatch: suggest cleanpatch and cleanfile when appropriate Andy Whitcroft
2010-08-18 15:46 ` [PATCH 04/16] checkpatch: ensure we do not collapse bracketed sections into constants Andy Whitcroft
2010-08-18 15:46 ` Andy Whitcroft [this message]
2010-08-18 15:46 ` [PATCH 06/16] checkpatch: returning errno typically should be negative Andy Whitcroft
2010-08-18 15:46 ` [PATCH 07/16] checkpatch: add check for space after struct, union, and enum Andy Whitcroft
2010-08-18 15:46 ` [PATCH 08/16] checkpatch: simplify and consolidate "missing space after" checks Andy Whitcroft
2010-08-18 15:46 ` [PATCH 09/16] checkpatch: ensure kconfig help checks only apply when we are adding help Andy Whitcroft
2010-08-18 15:46 ` [PATCH 10/16] checkpatch: check for incorrect permissions Andy Whitcroft
2010-08-18 15:46 ` [PATCH 11/16] checkpatch: Add additional attribute #defines Andy Whitcroft
2010-08-18 15:46 ` [PATCH 12/16] checkpatch: update copyright dates Andy Whitcroft
2010-08-18 15:46 ` [PATCH 13/16] checkpatch: clean up structure definition macro handline Andy Whitcroft
2010-08-18 15:46 ` [PATCH 14/16] checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similar Andy Whitcroft
2010-08-18 15:46 ` [PATCH 15/16] checkpatch: statement/block context analyser should look at sanitised lines Andy Whitcroft
2010-08-18 15:46 ` [PATCH 16/16] checkpatch: version 0.31 Andy Whitcroft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282146409-30544-6-git-send-email-apw@canonical.com \
    --to=apw@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®