From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
Jonathan Corbet <corbet@lwn.net>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Aditya Srivastava <yashsri421@gmail.com>
Subject: Re: [RFC v3] scripts: kernel-doc: fix typedef support for struct/union parsing
Date: Sat, 6 Mar 2021 07:25:25 +0100 [thread overview]
Message-ID: <CAKXUXMwD_ZZA7EJaxZBRfMDEvwd4Ghsj2vy9KCfj0R-yx2_K0Q@mail.gmail.com> (raw)
In-Reply-To: <20210306043548.GO2723601@casper.infradead.org>
On Sat, Mar 6, 2021 at 5:35 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Thu, Feb 25, 2021 at 08:20:33PM +0530, Aditya Srivastava wrote:
> > +++ b/scripts/kernel-doc
> > @@ -1201,12 +1201,23 @@ sub dump_union($$) {
> > sub dump_struct($$) {
> > my $x = shift;
> > my $file = shift;
> > + my $decl_type;
> > + my $members;
> > + my $type = qr{struct|union};
> > + # For capturing struct/union definition body, i.e. "{members*}qualifiers*"
> > + my $definition_body = qr{\{(.*)\}(?:\s*(?:__packed|__aligned|____cacheline_aligned_in_smp|____cacheline_aligned|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*};
> > - if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|____cacheline_aligned_in_smp|____cacheline_aligned|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/) {
> > - my $decl_type = $1;
> > + if ($x =~ /($type)\s+(\w+)\s*$definition_body/) {
> > + $decl_type = $1;
> > $declaration_name = $2;
> > - my $members = $3;
> > + $members = $3;
> > + } elsif ($x =~ /typedef\s+($type)\s*$definition_body\s*(\w+)\s*;/) {
> > + $decl_type = $1;
> > + $declaration_name = $3;
> > + $members = $2;
> > + }
>
> In the same spirit as dump_function, would something like this work?
>
I agree. That might be a suitable clean-up to keep the code for
functions and struct/union parsing similar in style/spirit.
Aditya, would you like to create a patch for that?
Lukas
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2021-03-06 6:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-22 16:03 [Linux-kernel-mentees] [RFC] scripts: kernel-doc: fix typedef support for struct parsing Aditya Srivastava
2021-02-22 17:49 ` Lukas Bulwahn
2021-02-22 21:40 ` Jonathan Corbet
2021-02-23 12:25 ` Aditya
2021-02-24 13:30 ` [RFC v2] scripts: kernel-doc: fix typedef support for struct/union parsing Aditya Srivastava
2021-02-25 11:48 ` Lukas Bulwahn
2021-02-25 14:50 ` [RFC v3] " Aditya Srivastava
2021-03-01 21:51 ` Jonathan Corbet
2021-03-06 4:35 ` Matthew Wilcox
2021-03-06 6:25 ` Lukas Bulwahn [this message]
2021-03-06 7:48 ` Aditya
2021-03-06 15:20 ` Matthew Wilcox
2021-03-07 7:36 ` Aditya
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=CAKXUXMwD_ZZA7EJaxZBRfMDEvwd4Ghsj2vy9KCfj0R-yx2_K0Q@mail.gmail.com \
--to=lukas.bulwahn@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@infradead.org \
--cc=yashsri421@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;
as well as URLs for NNTP newsgroup(s).