Re: [PATCH] checkpatch: avoid false positive closing bracket with initializers

From: Joe Perches
Date: Mon Oct 23 2017 - 18:19:00 EST


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/