From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754248AbcG2W2u (ORCPT ); Fri, 29 Jul 2016 18:28:50 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:34772 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754201AbcG2W2i (ORCPT ); Fri, 29 Jul 2016 18:28:38 -0400 From: Allen Hubbe To: linux-kernel@vger.kernel.org Cc: Joe Perches , Andy Whitcroft , Andrew Morton , Allen Hubbe Subject: [PATCH] checkpatch: fix perl warning about unescaped brace Date: Fri, 29 Jul 2016 18:27:32 -0400 Message-Id: X-Mailer: git-send-email 2.9.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Perl warns: Unescaped left brace in regex is deprecated, passed through in regex This is explained under "Quantifiers" in perl doc: http://perldoc.perl.org/perlre.html#Quantifiers (If a curly bracket occurs in a context other than one of the quantifiers listed above, where it does not form part of a backslashed sequence like \x{...} , it is treated as a regular character. However, a deprecation warning is raised for these occurrences, and in Perl v5.26, literal uses of a curly bracket will be required to be escaped, say by preceding them with a backslash ("\{" ) or enclosing them within square brackets ("[{]" ). This change will allow for future syntax extensions (like making the lower bound of a quantifier optional), and better error checking of quantifiers.) Signed-off-by: Allen Hubbe --- scripts/checkpatch.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b0659f1e9b09..7d40f4c8666a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3520,7 +3520,7 @@ sub process { # function brace can't be on same line, except for #defines of do while, # or if closed on same line if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and - !($line=~/\#\s*define.*do\s{/) and !($line=~/}/)) { + !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) { if (ERROR("OPEN_BRACE", "open brace '{' following function declarations go on the next line\n" . $herecurr) && $fix) { @@ -4032,12 +4032,12 @@ sub process { ## } #need space before brace following if, while, etc - if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || - $line =~ /do{/) { + if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) || + $line =~ /do\{/) { if (ERROR("SPACING", "space required before the open brace '{'\n" . $herecurr) && $fix) { - $fixed[$fixlinenr] =~ s/^(\+.*(?:do|\))){/$1 {/; + $fixed[$fixlinenr] =~ s/^(\+.*(?:do|\)))\{/$1 {/; } } @@ -4480,7 +4480,7 @@ sub process { $dstat !~ /^for\s*$Constant$/ && # for (...) $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() $dstat !~ /^do\s*{/ && # do {... - $dstat !~ /^\({/ && # ({... + $dstat !~ /^\(\{/ && # ({... $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/) { $ctx =~ s/\n*$//; -- 2.9.1