From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751756AbdJXS4A (ORCPT ); Tue, 24 Oct 2017 14:56:00 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:50398 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751407AbdJXSz7 (ORCPT ); Tue, 24 Oct 2017 14:55:59 -0400 X-Google-Smtp-Source: ABhQp+RMrFACsX+AJnfMpOH5d5uvHnp5Jj/RL8O8X9kv+ya+0dATRzkTBpZcZhPRTYK6co8YP2MeDQ== From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= To: linux-kernel@vger.kernel.org Cc: apw@canonical.com, joe@perches.com, =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= Subject: [PATCH v2] checkpatch: avoid false positive closing brace with initializers Date: Tue, 24 Oct 2017 11:55:42 -0700 Message-Id: <20171024185542.71261-1-carenas@gmail.com> X-Mailer: git-send-email 2.14.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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