From: Joe Perches <joe@perches.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Sedat Dilek <sedat.dilek@gmail.com>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: checkpatch.pl should suggest __section
Date: Mon, 12 Aug 2019 11:27:28 -0700 [thread overview]
Message-ID: <225af64a285ed0760a893e2dae45f1054e2cf82f.camel@perches.com> (raw)
In-Reply-To: <CAKwvOd=293uFBT1hLrC-vE9ekd2YOaTiiXj1HVeGfTjAk1rGvg@mail.gmail.com>
On Mon, 2019-08-12 at 11:20 -0700, Nick Desaulniers wrote:
> On Fri, Aug 9, 2019 at 4:17 PM Joe Perches <joe@perches.com> wrote:
> > On Fri, 2019-08-09 at 16:04 -0700, Nick Desaulniers wrote:
> > > > how about:
> > > > ---
> > > > scripts/checkpatch.pl | 9 +++++++++
> > > > 1 file changed, 9 insertions(+)
> > > >
> > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > > index 1cdacb4fd207..8e6693ca772c 100755
> > > > --- a/scripts/checkpatch.pl
> > > > +++ b/scripts/checkpatch.pl
> > > > @@ -5901,6 +5901,15 @@ sub process {
> > > > "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
> > > > }
> > > >
> > > > +# Check for __attribute__ section, prefer __section (without quotes)
> > > > + if ($realfile !~ m@\binclude/uapi/@ &&
> > > > + $line =~ /\b__attribute__\s*\(\s*\(.*_*section_*\s*\(\s*("[^"]*")/) {
> > > > + my $old = substr($rawline, $-[1], $+[1] - $-[1]);
> > > > + my $new = substr($old, 1, -1);
> > > > + WARN("PREFER_SECTION",
> > > > + "__section($new) is preferred over __attribute__((section($old)))\n" . $herecurr);
> > > > + }
> > > > +
> > >
> > > I can't read Perl, but this looks pretty good.
> > > Acked-by: Nick Desaulniers <ndesaulniers@google.com>
> >
> > I'll add a Suggested-by: for you.
> >
> > But a Tested-by would be more valuable than an Acked-by if you
> > don't actually know how it works.
>
> $ git am joes.patch
> $ echo "int foo __attribute__((section(.hello)));" >> arch/x86/boot/a20.c
Does this compile?
checkpatch is not a compiler.
I think you need
__attribute__((section(".hello")))
> $ git commit arch/x86/boot/a20.c -sm "foo: bar\n baz"
> $ git format-patch HEAD~
> $ ./scripts/checkpatch.pl 0001-foo-bar.patch
> total: 0 errors, 0 warnings, 4 lines checked
>
> 0001-foo-bar.patch has no obvious style problems and is ready for submission.
>
> hmm...
next prev parent reply other threads:[~2019-08-12 18:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-09 22:21 Nick Desaulniers
2019-08-09 22:58 ` Joe Perches
2019-08-09 23:04 ` Nick Desaulniers
2019-08-09 23:17 ` Joe Perches
2019-08-12 18:20 ` Nick Desaulniers
2019-08-12 18:27 ` Joe Perches [this message]
2019-08-12 19:41 ` Nick Desaulniers
2019-08-10 13:37 ` Miguel Ojeda
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=225af64a285ed0760a893e2dae45f1054e2cf82f.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ndesaulniers@google.com \
--cc=sedat.dilek@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®