[PATCH 2/3] checkpatch: fix left brace warning

Alexander Aring alex.aring at gmail.com
Mon Oct 26 11:10:28 PDT 2015


Running checkpatch with perl version 5.22 occur the following warnings:

Unescaped left brace in regex is deprecated, ... checkpatch.pl line 2017.
Unescaped left brace in regex is deprecated, ... checkpatch.pl line 2267.
Unescaped left brace in regex is deprecated, ... checkpatch.pl line 2268.
...
lot of weird things
...
)\(.*\).*\s{ <-- HERE / at ./scripts/checkpatch.pl line 2016.

This patch fix these warning, an similar commit was done in linux kernel
commit: 4e5d56bdf892e18832a6540b63ebf709966bce2a ("checkpatch: fix left
brace warning").

Signed-off-by: Alexander Aring <alex.aring at gmail.com>
---
 scripts/checkpatch.pl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 8d96434..f3fd339 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2013,8 +2013,8 @@ 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=~/}/)) {
+		if (($line=~/$Type\s*$Ident\(.*\).*\s\{/) and
+		    !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
 			ERROR("open brace '{' following function declarations go on the next line\n" . $herecurr);
 		}
 
@@ -2264,8 +2264,8 @@ sub process {
 ## 		}
 
 #need space before brace following if, while, etc
-		if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
-		    $line =~ /do{/) {
+		if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+		    $line =~ /do\{/) {
 			ERROR("space required before the open brace '{'\n" . $herecurr);
 		}
 
-- 
2.6.1




More information about the barebox mailing list