mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dwaipayan Ray <dwaipayanray1@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com
Subject: Re: [PATCH] checkpatch: fix unescaped left braces
Date: Tue, 05 Jan 2021 02:01:09 -0800	[thread overview]
Message-ID: <cf102ac77eb1f9e6424f30aef835f6c61dd03407.camel@perches.com> (raw)
In-Reply-To: <20210105093507.29297-1-dwaipayanray1@gmail.com>

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...


  reply	other threads:[~2021-01-05 10:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  9:35 Dwaipayan Ray
2021-01-05 10:01 ` Joe Perches [this message]
2021-01-05 10:08   ` Dwaipayan Ray
2021-01-05 10:35   ` David Laight
2021-01-05 10:49     ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf102ac77eb1f9e6424f30aef835f6c61dd03407.camel@perches.com \
    --to=joe@perches.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®