* [PATCH] scripts: kernel-doc: fix parsing function-like typedefs (again)
@ 2025-04-07 22:21 Sean Anderson
2025-04-07 22:34 ` Jonathan Corbet
0 siblings, 1 reply; 3+ messages in thread
From: Sean Anderson @ 2025-04-07 22:21 UTC (permalink / raw)
To: Jonathan Corbet, linux-doc
Cc: linux-kernel, Mauro Carvalho Chehab, Sean Anderson
Typedefs like
typedef struct phylink_pcs *(*pcs_xlate_t)(const u64 *args);
have a typedef_type that ends with a * and therefore has no word
boundary. Add an extra clause for the final group of the typedef_type so
we only require a word boundary if we match a word.
Fixes: 7d2c6b1edf79 ("scripts: kernel-doc: fix parsing function-like typedefs")
Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---
scripts/kernel-doc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index af6cf408b96d..5db23cbf4eb2 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1325,7 +1325,7 @@ sub dump_enum($$) {
}
}
-my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x;
+my $typedef_type = qr { ((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s* }x;
my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
my $typedef_args = qr { \s*\((.*)\); }x;
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scripts: kernel-doc: fix parsing function-like typedefs (again)
2025-04-07 22:21 [PATCH] scripts: kernel-doc: fix parsing function-like typedefs (again) Sean Anderson
@ 2025-04-07 22:34 ` Jonathan Corbet
2025-04-08 6:22 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Corbet @ 2025-04-07 22:34 UTC (permalink / raw)
To: Sean Anderson, linux-doc
Cc: linux-kernel, Mauro Carvalho Chehab, Sean Anderson
Sean Anderson <sean.anderson@linux.dev> writes:
> Typedefs like
>
> typedef struct phylink_pcs *(*pcs_xlate_t)(const u64 *args);
>
> have a typedef_type that ends with a * and therefore has no word
> boundary. Add an extra clause for the final group of the typedef_type so
> we only require a word boundary if we match a word.
>
> Fixes: 7d2c6b1edf79 ("scripts: kernel-doc: fix parsing function-like typedefs")
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> ---
>
> scripts/kernel-doc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index af6cf408b96d..5db23cbf4eb2 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -1325,7 +1325,7 @@ sub dump_enum($$) {
> }
> }
>
> -my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x;
> +my $typedef_type = qr { ((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s* }x;
> my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
> my $typedef_args = qr { \s*\((.*)\); }x;
This seems like a worth fix but ... we're kind of hoping to replace that
script entirely in 6.16.
Mauro, do you have a series for me along those lines? It seems like
time to put that in if we're going to do it. Then maybe this fix could
be adapted on top?
Thanks,
jon
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scripts: kernel-doc: fix parsing function-like typedefs (again)
2025-04-07 22:34 ` Jonathan Corbet
@ 2025-04-08 6:22 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2025-04-08 6:22 UTC (permalink / raw)
To: Jonathan Corbet; +Cc: Sean Anderson, linux-doc, linux-kernel
Em Mon, 07 Apr 2025 16:34:24 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:
> Sean Anderson <sean.anderson@linux.dev> writes:
>
> > Typedefs like
> >
> > typedef struct phylink_pcs *(*pcs_xlate_t)(const u64 *args);
> >
> > have a typedef_type that ends with a * and therefore has no word
> > boundary. Add an extra clause for the final group of the typedef_type so
> > we only require a word boundary if we match a word.
> >
> > Fixes: 7d2c6b1edf79 ("scripts: kernel-doc: fix parsing function-like typedefs")
> > Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> > ---
> >
> > scripts/kernel-doc | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> > index af6cf408b96d..5db23cbf4eb2 100755
> > --- a/scripts/kernel-doc
> > +++ b/scripts/kernel-doc
> > @@ -1325,7 +1325,7 @@ sub dump_enum($$) {
> > }
> > }
> >
> > -my $typedef_type = qr { ((?:\s+[\w\*]+\b){1,8})\s* }x;
> > +my $typedef_type = qr { ((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s* }x;
> > my $typedef_ident = qr { \*?\s*(\w\S+)\s* }x;
> > my $typedef_args = qr { \s*\((.*)\); }x;
>
> This seems like a worth fix but ... we're kind of hoping to replace that
> script entirely in 6.16.
Hi Jon,
The same regex was preserved at:
scripts/lib/kdoc/kdoc_parser.py: typedef_type = r'((?:\s+[\w\*]+\b){1,8})\s*'
It sounds to me that all we need to to is to rebase this change from
kernel-doc to kdoc_parser.py.
>
> Mauro, do you have a series for me along those lines? It seems like
> time to put that in if we're going to do it. Then maybe this fix could
> be adapted on top?
I'll rebase my latest series on the top of upstream and send you.
If you prefer, I can rebase this patch on the top of it, preserving
its original authorship and adding something like:
[mchehab: modified to apply on the top of kdoc_parser.py]
and submit altogether.
Another alternative would be for you to merge first my series, and then
Sean would send you a version of it on the top of the new kernel-doc.py.
Regards,
Mauro
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-08 6:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 22:21 [PATCH] scripts: kernel-doc: fix parsing function-like typedefs (again) Sean Anderson
2025-04-07 22:34 ` Jonathan Corbet
2025-04-08 6:22 ` Mauro Carvalho Chehab
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).