From: jim.cromie@gmail.com
To: Joe Perches <joe@perches.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] checkpatch: skip spacing tests on linker scripts
Date: Mon, 28 Jun 2021 10:53:35 -0600 [thread overview]
Message-ID: <CAJfuBxxzBevMJYSWq5feO20S4h_T-+EZoifOTYJ1NB4B+J1hqQ@mail.gmail.com> (raw)
In-Reply-To: <075e07c40b99f93123051ef8833612bc88a55120.camel@perches.com>
Yes, I agree.
On Sun, Jun 27, 2021 at 9:17 PM Joe Perches <joe@perches.com> wrote:
>
> On Fri, 2021-06-25 at 21:40 -0600, Jim Cromie wrote:
> > Before issuing a WARNING on spacing, exclude reports on linker
> > scripts, which don't comport to C style rules. skip_on_filename()
> > skips on *.lds.h files, I think covering all cases.
> []
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -2546,6 +2546,11 @@ sub get_raw_comment {
> > return $comment;
> > }
> >
> > +sub skip_on_filename {
> > + my $fname = shift;
> > + return $fname =~ m@\.lds\.h$@;
> > +}
>
> nak. This is poor naming for what is not a generic function.
indeed.
>
> > @@ -5134,7 +5139,8 @@ sub process {
> > }
> > }
> > } elsif ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
> > - if (ERROR("SPACING",
> > + if (!skip_on_filename($realfile) &&
> > + ERROR("SPACING",
> > "need consistent spacing around '$op' $at\n" . $hereptr)) {
> > $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
> > if (defined $fix_elements[$n + 2]) {
>
> This .lds.h test is also used in one other place.
>
> It might be better to avoid all tests in .lds.h files by using a
> "next if" much earlier.
YES. I see the code uses 'next if' syntax. so this would work.
next if ($filename =~ m@\.lds\.h$@)
I will find a good spot for this line.
thanks
Jim
next prev parent reply other threads:[~2021-06-28 16:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-26 3:40 [PATCH 0/3] checkpatch tweaks Jim Cromie
2021-06-26 3:40 ` [PATCH 1/3] checkpatch: skip spacing tests on linker scripts Jim Cromie
2021-06-26 4:15 ` Joe Perches
2021-06-28 16:53 ` jim.cromie [this message]
2021-06-29 16:48 ` jim.cromie
2021-06-29 18:28 ` Joe Perches
2021-06-29 19:50 ` jim.cromie
2021-06-29 20:01 ` Joe Perches
2021-06-30 16:38 ` jim.cromie
2021-06-30 17:12 ` Joe Perches
2021-06-26 3:40 ` [PATCH 2/3] checkpatch: tweak extern in C warning Jim Cromie
2021-06-26 4:31 ` Joe Perches
2021-06-27 3:47 ` jim.cromie
2021-06-30 17:33 ` Joe Perches
2021-06-26 3:40 ` [PATCH 3/3] checkpatch: suppress BUG_ON warn when it is named in commitmsg Jim Cromie
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=CAJfuBxxzBevMJYSWq5feO20S4h_T-+EZoifOTYJ1NB4B+J1hqQ@mail.gmail.com \
--to=jim.cromie@gmail.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).