From: Andy Whitcroft <apw@canonical.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 3/6] checkpatch: allow parentheses on return handle array values
Date: Mon, 12 Jan 2009 12:45:01 +0000 [thread overview]
Message-ID: <1231764304-1491-4-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1231764304-1491-1-git-send-email-apw@canonical.com>
When we allow return to have surrounding parentheses when containing
comparison operators we are not correctly handling the case where
the values contain array sufffixes. Squash them.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
scripts/checkpatch.pl | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1d7924a..696196e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2016,7 +2016,11 @@ sub process {
# Flatten any parentheses
$value =~ s/\)\(/\) \(/g;
- while ($value !~ /(?:$Ident|-?$Constant)\s*$Compare\s*(?:$Ident|-?$Constant)/ && $value =~ s/\([^\(\)]*\)/1/) {
+ while ($value =~ s/\[[^\{\}]*\]/1/ ||
+ $value !~ /(?:$Ident|-?$Constant)\s*
+ $Compare\s*
+ (?:$Ident|-?$Constant)/x &&
+ $value =~ s/\([^\(\)]*\)/1/) {
}
if ($value =~ /^(?:$Ident|-?$Constant)$/) {
--
1.6.0.4.911.gc990
next prev parent reply other threads:[~2009-01-12 12:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 12:44 [PATCH 0/6] update checkpatch to version 0.27 Andy Whitcroft
2009-01-12 12:44 ` [PATCH 1/6] checkpatch: handle missing #if open in context Andy Whitcroft
2009-01-12 12:45 ` [PATCH 2/6] checkpatch: type/cast spacing should not check prefix spacing Andy Whitcroft
2009-01-12 12:45 ` Andy Whitcroft [this message]
2009-01-12 12:45 ` [PATCH 4/6] checkpatch: if should not continue a preceeding brace Andy Whitcroft
2009-01-12 12:45 ` [PATCH 5/6] checkpatch: struct seq_operations should normally be const Andy Whitcroft
2009-01-12 12:45 ` [PATCH 6/6] checkpatch: version: 0.27 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=1231764304-1491-4-git-send-email-apw@canonical.com \
--to=apw@canonical.com \
--cc=akpm@osdl.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;
as well as URLs for NNTP newsgroup(s).