Skip to contentSkip to conversation

checkpatch: fix left brace warning

PATCH In review Geyslan G. Bem 1 participant 2 messages Dec 30, 2015 – Jan 26, 2016 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: fix left brace warning

This patch escapes a regex that uses left brace.

Using checkpatch.pl with Perl 5.22.0 generates the warning: "Unescaped left brace in regex is deprecated, passed through in regex;"

Comment from regcomp.c in Perl source: "Currently we don't warn when the lbrace is at the start of a construct. This catches it in the middle of a literal string, or when it's the first thing after something like "\b"."

This works as a complement to 4e5d56bd.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index d4960f7..3e11a30 100755
@@ -4108,7 +4108,7 @@ sub process {
 ## 		}
 
 #need space before brace following if, while, etc
-		if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+		if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
 		    $line =~ /do\{/) {
 			if (ERROR("SPACING",
 				  "space required before the open brace '{'\n" . $herecurr) &&
Signature · 1 line
2.6.4
#1 lore raw

Hello,

2015-12-30 12:49 GMT-03:00 Geyslan G. Bem <[email protected]>:

Quoted 32 lines

This patch escapes a regex that uses left brace.

Using checkpatch.pl with Perl 5.22.0 generates the warning: "Unescaped left brace in regex is deprecated, passed through in regex;"

Comment from regcomp.c in Perl source: "Currently we don't warn when the lbrace is at the start of a construct. This catches it in the middle of a literal string, or when it's the first thing after something like "\b"."

This works as a complement to 4e5d56bd.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -2
index d4960f7..3e11a30 100755
@@ -4108,7 +4108,7 @@ sub process {
 ##             }
 
 #need space before brace following if, while, etc
-               if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+               if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
                    $line =~ /do\{/) {
                        if (ERROR("SPACING",
                                  "space required before the open brace '{'\n" . $herecurr) &&
--
Quoted 2 lines

2.6.4

This was acked?

Signature · 4 lines
Regards,

Geyslan G. Bem
hackingbits.com