1
0
Fork 0

checkpatch: fix left brace warning

using checkpatch with Perl 5.22.0 generates a warning,
this is fixed in linux through commit:

commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
Author: Eddie Kovsky <ewk@edkovsky.org>
Date:   Wed Sep 9 15:37:52 2015 -0700

checkpatch: fix left brace warning

Using checkpatch.pl with Perl 5.22.0 generates the following warning:

Unescaped left brace in regex is deprecated, passed through in regex;

This patch fixes the warnings by escaping occurrences of the left brace
inside the regular expression.

Adapt it for U-Boot.

Signed-off-by: Heiko Schocher <hs@denx.de>
utp
Heiko Schocher 2016-01-04 09:17:19 +01:00 committed by Tom Rini
parent 1aa2d074a7
commit d8a1a304ef
1 changed files with 5 additions and 5 deletions

View File

@ -2825,8 +2825,8 @@ 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=~/}/)) {
ERROR("OPEN_BRACE", 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);
} }
@ -3259,8 +3259,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) {
@ -3633,7 +3633,7 @@ sub process {
$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*$//;