public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: avoid false positive closing bracket with initializers
@ 2017-10-23 13:06 Carlo Marcelo Arenas Belón
  2017-10-23 22:18 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Carlo Marcelo Arenas Belón @ 2017-10-23 13:06 UTC (permalink / raw)
  To: linux-kernel; +Cc: apw, joe, 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}};

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8b80bac055e4..fe271697a2a8 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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) {
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] checkpatch: avoid false positive closing bracket with initializers
  2017-10-23 13:06 [PATCH] checkpatch: avoid false positive closing bracket with initializers Carlo Marcelo Arenas Belón
@ 2017-10-23 22:18 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2017-10-23 22:18 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belón, linux-kernel; +Cc: apw

On Mon, 2017-10-23 at 06:06 -0700, Carlo Marcelo Arenas Belón wrote:
> when multiple closing brackets are being used for an universal zero
> intializer as in (for example):
> 
>   struct timespec tv[10] = {{0}};

No objection.

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-23 22:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-23 13:06 [PATCH] checkpatch: avoid false positive closing bracket with initializers Carlo Marcelo Arenas Belón
2017-10-23 22:18 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox