From ebef00faf650c7e72da3fdaa0d3ed1fff2e7dce8 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Mon, 11 Apr 2016 00:52:01 +0200 Subject: [PATCH] lint/checkpatch.pl: escape \{ in perl regex to fix warnings Fix warnings: Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\#\s*define.*do\s{ <-- HERE / at util/lint/checkpatch.pl line 3261. marked by <-- HERE in m/\(.*\){ <-- HERE / at util/lint/checkpatch.pl line 3750. marked by <-- HERE in m/do{ <-- HERE / at util/lint/checkpatch.pl line 3751. marked by <-- HERE in m/^\({ <-- HERE / at util/lint/checkpatch.pl line 4194. Change-Id: If0c1f07a16df9e6cd1c1393a31af8b8ea6a66b01 Signed-off-by: Alexander Couzens Reviewed-on: https://review.coreboot.org/14310 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/lint/checkpatch.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index 894e5d7685..3a4b8be455 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -3258,7 +3258,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) { @@ -3747,8 +3747,8 @@ 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) { @@ -4190,8 +4190,8 @@ sub process { $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) $dstat !~ /^for\s*$Constant$/ && # for (...) $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() - $dstat !~ /^do\s*{/ && # do {... - $dstat !~ /^\({/ && # ({... + $dstat !~ /^do\s*\{/ && # do {... + $dstat !~ /^\(\{/ && # ({... $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/) { $ctx =~ s/\n*$//;