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 <lynxis@fe80.eu>
Reviewed-on: https://review.coreboot.org/14310
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Alexander Couzens 2016-04-11 00:52:01 +02:00 committed by Martin Roth
parent f790672f2d
commit ebef00faf6
1 changed files with 5 additions and 5 deletions

View File

@ -3258,7 +3258,7 @@ sub process {
# function brace can't be on same line, except for #defines of do while, # function brace can't be on same line, except for #defines of do while,
# or if closed on same line # or if closed on same line
if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and 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", if (ERROR("OPEN_BRACE",
"open brace '{' following function declarations go on the next line\n" . $herecurr) && "open brace '{' following function declarations go on the next line\n" . $herecurr) &&
$fix) { $fix) {
@ -3747,8 +3747,8 @@ sub process {
## } ## }
#need space before brace following if, while, etc #need space before brace following if, while, etc
if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) || if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
$line =~ /do{/) { $line =~ /do\{/) {
if (ERROR("SPACING", if (ERROR("SPACING",
"space required before the open brace '{'\n" . $herecurr) && "space required before the open brace '{'\n" . $herecurr) &&
$fix) { $fix) {
@ -4190,8 +4190,8 @@ sub process {
$dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...)
$dstat !~ /^for\s*$Constant$/ && # for (...) $dstat !~ /^for\s*$Constant$/ && # for (...)
$dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
$dstat !~ /^do\s*{/ && # do {... $dstat !~ /^do\s*\{/ && # do {...
$dstat !~ /^\({/ && # ({... $dstat !~ /^\(\{/ && # ({...
$ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/) $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
{ {
$ctx =~ s/\n*$//; $ctx =~ s/\n*$//;