Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753224AbdLROmd (ORCPT ); Mon, 18 Dec 2017 09:42:33 -0500 Received: from kadath.azazel.net ([81.187.231.250]:55844 "EHLO kadath.azazel.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752609AbdLROma (ORCPT ); Mon, 18 Dec 2017 09:42:30 -0500 X-Greylist: delayed 1482 seconds by postgrey-1.27 at vger.kernel.org; Mon, 18 Dec 2017 09:42:30 EST From: Jeremy Sowden To: linux-kernel@vger.kernel.org, joe@perches.com, apw@canonical.com Cc: Jeremy Sowden Subject: [PATCH] checkpatch: fix for stripping brackets from macros. Date: Mon, 18 Dec 2017 14:17:16 +0000 Message-Id: <20171218141716.26227-1-jeremy@azazel.net> X-Mailer: git-send-email 2.15.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1002 Lines: 31 When checking macros, checkpatch.pl strips parentheses, square brackets and braces. However, the search-and-replace expression was not correct, and instead of replacing the brackets and their contents with just the contents, it was replacing them with literal 1's. Signed-off-by: Jeremy Sowden --- scripts/checkpatch.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 168687ae24fa..3b67646df845 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4874,9 +4874,9 @@ sub process { $dstat =~ s/\s*$//s; # Flatten any parentheses and braces - while ($dstat =~ s/\([^\(\)]*\)/1/ || - $dstat =~ s/\{[^\{\}]*\}/1/ || - $dstat =~ s/.\[[^\[\]]*\]/1/) + while ($dstat =~ s/\(([^\(\)]*)\)/$1/ || + $dstat =~ s/\{([^\{\}]*)\}/$1/ || + $dstat =~ s/.\[([^\[\]]*)\]/$1/) { } base-commit: 53600ecfb6004f355bd3551bee180caf4b42d7a7 -- 2.15.1