summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-06-25 23:08:42 +0200
committerAlejandro Colomar <alx@kernel.org>2024-05-04 16:50:27 +0200
commit58a6e8c6a78ebe370405cb1ad5480624c96730d5 (patch)
tree234a7706f80e53919612806d96515d042eda3aa7
parent0eeec24d540c452d41af498bee195086f7546071 (diff)
checkpatch: BRACKET_SPACE: Don't trigger with C2x [[]]contrib
C2x [[]] attributes shouldn't trigger this warning. It's safe to not trigger the warning for double brackets, as they were illegal previous to C2x. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rwxr-xr-xscripts/checkpatch.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 600346d..d532afa 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5020,11 +5020,11 @@ sub process {
}
}
-# check for spacing round square brackets; allowed:
+# check for spacing round single square brackets; allowed:
# 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 }
- while ($line =~ /(.*?\s)\[/g) {
+ while ($line =~ /(.*?\s)\[[^\[]/g) {
my ($where, $prefix) = ($-[1], $1);
if ($prefix !~ /$Type\s+$/ &&
($where != 0 || $prefix !~ /^.\s+$/) &&