mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: avoid false positive closing brace with initializers
@ 2017-10-24 18:55 Carlo Marcelo Arenas Belón
  0 siblings, 0 replies; only message in thread
From: Carlo Marcelo Arenas Belón @ 2017-10-24 18:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: apw, joe, Carlo Marcelo Arenas Belón

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

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

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
v2: simplified regex as suggested by Joe Perches
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8b80bac055e4..9cfbdd8554fc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4423,12 +4423,12 @@ 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) {
 				$fixed[$fixlinenr] =~
-				    s/}((?!(?:,|;|\)))\S)/} $1/;
+				    s/}((?![,;})])\S)/} $1/;
 			}
 		}
 
-- 
2.14.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-10-24 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-24 18:55 [PATCH v2] checkpatch: avoid false positive closing brace with initializers Carlo Marcelo Arenas Belón

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®