From: Dave Martin <dave.martin@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: Dave Martin <dave.martin@linaro.org>, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH] checkpatch: Allow space before [ in the case of inline asm constraints
Date: Tue, 16 Nov 2010 12:13:16 +0000 [thread overview]
Message-ID: <1289909596-7317-1-git-send-email-dave.martin@linaro.org> (raw)
This allows the customary syntax for declaring named arguments,
such as:
asm ("mov %[out],%[in]" : [out] "=r" (x) : [in] "r" (y));
Since :[ is comple-error-inducingly invalid syntax in other cases,
this won't create unintentional leniency for normal uses of [
Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
scripts/checkpatch.pl | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3c7fc0..2c2fa51 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1988,11 +1988,13 @@ sub process {
# 1. with a type on the left -- int [] a;
# 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
# 3. inside a curly brace -- = { [0...10] = 5 }
+# 4. after a colon for inline asm -- asm ("..." : [name] "constraint" (arg))
while ($line =~ /(.*?\s)\[/g) {
my ($where, $prefix) = ($-[1], $1);
if ($prefix !~ /$Type\s+$/ &&
($where != 0 || $prefix !~ /^.\s+$/) &&
- $prefix !~ /{\s+$/) {
+ $prefix !~ /{\s+$/ &&
+ $prefix !~ /:\s+$/) {
ERROR("space prohibited before open square bracket '['\n" . $herecurr);
}
}
--
1.7.1
next reply other threads:[~2010-11-16 12:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 12:13 Dave Martin [this message]
2010-11-16 15:00 ` Joe Perches
2010-11-23 14:32 ` 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=1289909596-7317-1-git-send-email-dave.martin@linaro.org \
--to=dave.martin@linaro.org \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.kernel.org \
/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®