lkml.org 
[lkml]   [2017]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] checkpatch: avoid false positive closing brace with initializers
Date
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
\
 
 \ /
  Last update: 2017-10-24 20:56    [W:0.047 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site