From: Leonid Bloch <leonid@daynix.com>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>
Subject: [Qemu-devel] [PATCH 1/2] checkpatch: Eliminate false positive in case of comma-space-square bracket
Date: Thu, 29 Oct 2015 11:48:37 +0200 [thread overview]
Message-ID: <1446112118-12376-2-git-send-email-leonid@daynix.com> (raw)
In-Reply-To: <1446112118-12376-1-git-send-email-leonid@daynix.com>
Previously, an error was printed in cases such as:
{ [1] = 5, [2] = 6 }
The space passed OK after a curly brace, but not after a comma.
Now, a space before a square bracket is allowed, if a comma comes before
it.
Signed-off-by: Leonid Bloch <leonid@daynix.com>
---
scripts/checkpatch.pl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b0f6e11..455d94b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1715,11 +1715,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 comma -- [1] = 5, [2] = 6
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);
}
}
--
2.4.3
next prev parent reply other threads:[~2015-10-29 9:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 9:48 [Qemu-devel] [PATCH 0/2] checkpatch: Fixing two cases of false positives in checkpatch.pl Leonid Bloch
2015-10-29 9:48 ` Leonid Bloch [this message]
2015-10-29 9:48 ` [Qemu-devel] [PATCH 2/2] checkpatch: Eliminate false positive in case of space before square bracket in a definition Leonid Bloch
2015-10-29 16:13 ` Eric Blake
2015-10-29 16:59 ` Leonid Bloch
2015-11-10 9:48 ` [Qemu-devel] [PATCH 0/2] checkpatch: Fixing two cases of false positives in checkpatch.pl Leonid Bloch
2015-11-24 14:43 ` Leonid Bloch
2015-12-20 9:31 ` Leonid Bloch
2016-01-05 12:02 ` Leonid Bloch
2016-01-11 12:12 ` Markus Armbruster
2016-01-31 14:13 ` Leonid Bloch
2016-02-11 9:43 ` Leonid Bloch
2016-02-11 9:47 ` Paolo Bonzini
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=1446112118-12376-2-git-send-email-leonid@daynix.com \
--to=leonid@daynix.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).