Skip to contentSkip to conversation

checkpatch: avoid false positive closing bracket with initializers

PATCH Superseded Carlo Marcelo Arenas Belón 2 participants 2 messages Oct 23, 2017 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: avoid false positive closing bracket with initializers

when multiple closing brackets are being used for an universal zero intializer as in (for example):

  struct timespec tv[10] = {{0}};
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 8b80bac055e4..fe271697a2a8 100755
@@ -4423,7 +4423,7 @@ sub process {
 
 # closing brace should have a space following it when it has anything
 # on the line
-		if ($line =~ /}(?!(?:,|;|\)))\S/) {
+		if ($line =~ /}(?!(?:,|;|}|\)))\S/) {
 			if (ERROR("SPACING",
 				  "space required after that close brace '}'\n" . $herecurr) &&
 			    $fix) {
Signature · 1 line
2.14.2
maintainer
#1 lore raw
Quoted 4 lines · Carlo Marcelo Arenas Belón

when multiple closing brackets are being used for an universal zero intializer as in (for example):

  struct timespec tv[10] = {{0}};

No objection.

scripts/checkpatch.pl

Quoted 1 line
scripts/checkpatch.pl +0 -0

[]

scripts/checkpatch.pl sub process { · line 4426

Quoted 6 lines
scripts/checkpatch.pl +1 -1
@@ -4423,7 +4423,7 @@ sub process {
 
 # closing brace should have a space following it when it has anything
 # on the line
-		if ($line =~ /}(?!(?:,|;|\)))\S/) {
+		if ($line =~ /}(?!(?:,|;|}|\)))\S/) {

But perhaps this is easier to understand:

		if ($line =~ /}(?![,;}\)]\S/