lkml.org 
[lkml]   [2021]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] checkpatch: fix unescaped left braces
From
Date
On Tue, 2021-01-05 at 15:05 +0530, Dwaipayan Ray wrote:
> Perl 5.22 onwards require that "A literal "{" should now be
> escaped in a pattern".

Not quite correct.

> checkpatch contains several literal "{". Fix such instances
> by preceding them with a backslash.

Not all literal left braces need to be escaped.
https://www.perlmonks.org/?node_id=1191981

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -2036,7 +2036,7 @@ sub annotate_values {
>   print "ASSIGN($1)\n" if ($dbg_values > 1);
>   $type = 'N';
>  
>
> - } elsif ($cur =~/^(;|{|})/) {
> + } elsif ($cur =~ /^(;|\{|\})/) {

Like this one. And why escape the right brace too?

>   print "END($1)\n" if ($dbg_values > 1);
>   $type = 'E';
>   $av_pend_colon = 'O';
> @@ -3913,7 +3913,7 @@ sub process {
>   # it there is no point in retrying a statement scan
>   # until we hit end of it.
>   my $frag = $stat; $frag =~ s/;+\s*$//;
> - if ($frag !~ /(?:{|;)/) {
> + if ($frag !~ /(?:\{|;)/) {

And here.

etc...

\
 
 \ /
  Last update: 2021-01-05 11:03    [W:2.641 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site