mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Joe Perches <joe@perches.com>,
	Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org, Paul Mackerras <paulus@samba.org>,
	linux-kernel@vger.kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [PATCH 0/9] powerpc: delete duplicated words
Date: Sun, 26 Jul 2020 12:08:08 -0700	[thread overview]
Message-ID: <4e505c35-8428-89bb-7f9b-bc819382c3cd@infradead.org> (raw)
In-Reply-To: <add7c13b1ca24c8cb6f243b99d61c19287020efd.camel@perches.com>

[-- Attachment #1: Type: text/plain, Size: 1543 bytes --]

On 7/26/20 10:49 AM, Joe Perches wrote:
> On Sun, 2020-07-26 at 10:23 -0700, Randy Dunlap wrote:
>> On 7/26/20 7:29 AM, Christophe Leroy wrote:
>>> Randy Dunlap <rdunlap@infradead.org> a écrit :
>>>
>>>> Drop duplicated words in arch/powerpc/ header files.
>>>
>>> How did you detect them ? Do you have some script for tgat, or you just read all comments ?
>>
>> Yes, it's a script that finds lots of false positives, so I have to check
>> each and every one of them for validity.
> 
> And it's a lot of work too. (thanks Randy)
> 
> It could be something like:
> 
> $ grep-2.5.4 -nrP --include=*.[ch] '\b([A-Z]?[a-z]{2,}\b)[ \t]*(?:\n[ \t]*\*[ \t]*|)\1\b' * | \
>   grep -vP '\b(?:struct|enum|union)\s+([A-Z]?[a-z]{2,})\s+\*?\s*\1\b' | \
>   grep -vP '\blong\s+long\b' | \
>   grep -vP '\b([A-Z]?[a-z]{2,})(?:\t+| {2,})\1\b'

Hi Joe,

(what is grep-2.5.4 ?)

It looks like you tried a few iterations of this -- since it drops things
like "long long".  There are lots of data types that are repeated & valid.
And many struct names, like "struct kref kref", "struct completion completion",
and "struct mutex mutex".  I handle (ignore) those manually, although that
could be added to the Perl script.

v0.1 of this script also found lots of repeated numbers and strings of
special characters (ASCII art etc.), so now it ignores duplicated numbers
or special characters -- since it is really looking for duplicate words.

Anyway, I might as well attach it. It's no big deal.
And if someone else wants to tackle using it, go for it.

-- 
~Randy


[-- Attachment #2: find_dup_words.pl --]
[-- Type: application/x-perl, Size: 2958 bytes --]

  reply	other threads:[~2020-07-26 19:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26  0:38 Randy Dunlap
2020-07-26  0:38 ` [PATCH 1/9] powerpc: book3s: mmu-hash.h: delete duplicated word Randy Dunlap
2020-07-26  0:38 ` [PATCH 2/9] powerpc: book3s: radix-4k.h: " Randy Dunlap
2020-07-26  0:38 ` [PATCH 3/9] powerpc: cputime.h: " Randy Dunlap
2020-07-26  0:38 ` [PATCH 4/9] powerpc: epapr_hcalls.h: delete duplicated words Randy Dunlap
2020-07-26  0:38 ` [PATCH 5/9] powerpc: hw_breakpoint.h: delete duplicated word Randy Dunlap
2020-07-26  0:38 ` [PATCH 6/9] powerpc: ppc_asm.h: " Randy Dunlap
2020-07-26  0:38 ` [PATCH 7/9] powerpc: reg.h: " Randy Dunlap
2020-07-26  0:38 ` [PATCH 8/9] powerpc: smu.h: " Randy Dunlap
2020-07-26  0:38 ` [PATCH 9/9] powerpc: powernv: pci.h: " Randy Dunlap
2020-07-26 14:29 ` [PATCH 0/9] powerpc: delete duplicated words Christophe Leroy
2020-07-26 17:23   ` Randy Dunlap
2020-07-26 17:49     ` Joe Perches
2020-07-26 19:08       ` Randy Dunlap [this message]
2020-07-26 20:48         ` Joe Perches
2020-07-27  6:51         ` Joe Perches
2020-07-27  7:33           ` [PATCH] checkpatch: Add test for repeated words Joe Perches
2020-07-28  0:03             ` Randy Dunlap
2020-07-28  1:25               ` Joe Perches
2020-07-26 23:55     ` [PATCH 0/9] powerpc: delete duplicated words Michael Ellerman
2020-07-27  7:26 ` Michael Ellerman

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=4e505c35-8428-89bb-7f9b-bc819382c3cd@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /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®