[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABJPP5D9noCN9nMD5HdHq+uk=ot+Xcvd35CrC1E1GKy+nHAhGw@mail.gmail.com>
Date: Wed, 21 Oct 2020 22:29:35 +0530
From: Dwaipayan Ray <dwaipayanray1@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: Aditya Srivastava <yashsri421@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] checkpatch: fix false positive for REPEATED_WORD warning
On Wed, Oct 21, 2020 at 10:21 PM Joe Perches <joe@...ches.com> wrote:
>
> On Wed, 2020-10-21 at 08:28 -0700, Joe Perches wrote:
> > On Wed, 2020-10-21 at 08:18 -0700, Joe Perches wrote:
> > > I might add that check to the line below where
> > > the repeated words are checked against long
> > []
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > []
> > > @@ -3062,6 +3062,7 @@ sub process {
> > >
> > > next if ($first ne $second);
> > > next if ($first eq 'long');
> > > + next if ($first =~ /^$Hex$/;
> >
> > oops. with a close parenthesis added of course...
>
> That doesn't work as $Hex expects a leading 0x.
>
> But this does...
>
> The negative of this approach is it would also not emit
> a warning on these repeated words: (doesn't seem too bad)
>
> $ grep -P '^[0-9a-f]{2,}$' /usr/share/dict/words
> abed
> accede
> acceded
> ace
> aced
> ad
> add
> added
> baa
> baaed
> babe
> bad
> bade
> be
> bead
> beaded
> bed
> bedded
> bee
> beef
> beefed
> cab
> cabbed
> cad
> cede
> ceded
> dab
> dabbed
> dad
> dead
> deaf
> deb
> decade
> decaf
> deed
> deeded
> deface
> defaced
> ebb
> ebbed
> efface
> effaced
> fa
> facade
> face
> faced
> fad
> fade
> faded
> fed
> fee
> feed
> ---
> scripts/checkpatch.pl | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index fab38b493cef..79d7a4cba19e 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3062,6 +3062,7 @@ sub process {
>
> next if ($first ne $second);
> next if ($first eq 'long');
> + next if ($first =~ /^[0-9a-f]+$/i);
>
> if (WARN("REPEATED_WORD",
> "Possible repeated word: '$first'\n" . $herecurr) &&
>
>
Hi,
Can it be considered that the Hex numbers occur
mostly in pairs or groups of 8, like "FF" or "FFFFFFFF"?
I think it might reduce the negative side further.
Thanks,
Dwaipayan.
Powered by blists - more mailing lists