diff options
author | Leonid Bloch <leonid@daynix.com> | 2015-10-29 11:48:37 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-02-15 20:02:09 +0100 |
commit | 409db6eb7199af7a2f09f746bd1b793e9daefe5f (patch) | |
tree | 5b0a9510036e1cad139724c9ed88fcad0605bc72 /scripts | |
parent | 80b5d6bfc1280fa06e2514a414690c0e5b4b514b (diff) | |
download | qemu-409db6eb7199af7a2f09f746bd1b793e9daefe5f.zip qemu-409db6eb7199af7a2f09f746bd1b793e9daefe5f.tar.gz qemu-409db6eb7199af7a2f09f746bd1b793e9daefe5f.tar.bz2 |
checkpatch: Eliminate false positive in case of comma-space-square bracket
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>
Message-Id: <1446112118-12376-2-git-send-email-leonid@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/checkpatch.pl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 257126f..e71c3d1 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); } } |