[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <120df949b3071bdde9c554451130d736eb1fa60c.camel@perches.com>
Date: Tue, 05 Jan 2021 02:49:07 -0800
From: Joe Perches <joe@...ches.com>
To: David Laight <David.Laight@...LAB.COM>,
Dwaipayan Ray <dwaipayanray1@...il.com>
Cc: "linux-kernel-mentees@...ts.linuxfoundation.org"
<linux-kernel-mentees@...ts.linuxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lukas.bulwahn@...il.com" <lukas.bulwahn@...il.com>
Subject: Re: [PATCH] checkpatch: fix unescaped left braces
On Tue, 2021-01-05 at 10:35 +0000, David Laight wrote:
> From: Joe Perches
> > Sent: 05 January 2021 10:01
> >
> > 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".
>
> Sounds like a good reason to never use perl :-)
>
> > 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 =~ /^(;|\{|\})/) {
>
> isn't (;|{|}) much the same as [;{}] ??
Yes, but without the capture, so /^([;{}])/ would be the same.
I presume the | style was used for consistency with other uses
in the same block.
Andy Whitcroft wrote that bit a long time ago.
Powered by blists - more mailing lists