From: Akira Yokosawa <akiyks@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-kernel@vger.kernel.org,
Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
linux-doc@vger.kernel.org
Subject: Re: [PATCH 13/13] docs: kdoc: a few more dump_typedef() tweaks
Date: Wed, 10 Sep 2025 19:10:09 +0900 [thread overview]
Message-ID: <8ff91be7-7cb7-492b-b1be-2d03516c8386@gmail.com> (raw)
In-Reply-To: <20250909204349.123680-14-corbet@lwn.net>
Hi Jon,
A quick report on minor regression. Please see below.
On Tue, 9 Sep 2025 14:43:49 -0600, Jonathan Corbet wrote:
> Merge "typedef" into the typedef_type pattern rather than repeating it
> later, and add some comments.
I'm seeing new warnings after applying 13/13:
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno ./include/media/demux.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno ./include/media/v4l2-ioctl.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno ./include/media/v4l2-ctrls.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno ./include/media/v4l2-dv-timings.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno ./include/media/videobuf2-core.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno ./include/linux/hte.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno ./include/linux/xarray.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno -function gen_pool_add ./include/linux/genalloc.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno -function gen_pool_alloc ./include/linux/genalloc.h' processing failed with: NameError("name '_type' is not defined")
WARNING: kernel-doc './scripts/kernel-doc.py -rst -enable-lineno -function vdso_sgx_enter_enclave_t ./arch/x86/include/uapi/asm/sgx.h' processing failed with: NameError("name '_type' is not defined")
Thanks,
Akira
>
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
> ---
> scripts/lib/kdoc/kdoc_parser.py | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index ad9df0536bbf..8215948dd548 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -1026,13 +1026,15 @@ class KernelDoc:
> """
> Stores a typedef inside self.entries array.
> """
> -
> - typedef_type = r'((?:\s+[\w*]+\b){0,7}\s+(?:\w+\b|\*+))\s*'
> + #
> + # We start by looking for function typedefs.
> + #
> + typedef_type = r'typedef((?:\s+[\w*]+\b){0,7}\s+(?:\w+\b|\*+))\s*'
> typedef_ident = r'\*?\s*(\w\S+)\s*'
> typedef_args = r'\s*\((.*)\);'
>
> - typedef1 = KernRe(r'typedef' + typedef_type + r'\(' + typedef_ident + r'\)' + typedef_args)
> - typedef2 = KernRe(r'typedef' + typedef_type + typedef_ident + typedef_args)
> + typedef1 = KernRe(typedef_type + r'\(' + typedef_ident + r'\)' + typedef_args)
> + typedef2 = KernRe(typedef_type + typedef_ident + typedef_args)
>
> # Parse function typedef prototypes
> for r in [typedef1, typedef2]:
> @@ -1048,16 +1050,16 @@ class KernelDoc:
> f"expecting prototype for typedef {self.entry.identifier}. Prototype was for typedef {declaration_name} instead\n")
> return
>
> - decl_type = 'function'
> - self.create_parameter_list(ln, decl_type, args, ',', declaration_name)
> + self.create_parameter_list(ln, 'function',_type, args, ',', declaration_name)
>
> - self.output_declaration(decl_type, declaration_name,
> + self.output_declaration('function', declaration_name,
> typedef=True,
> functiontype=return_type,
> purpose=self.entry.declaration_purpose)
> return
> -
> - # Parse simple typedefs
> + #
> + # Not a function, try to parse a simple typedef.
> + #
> r = KernRe(r'typedef.*\s+(\w+)\s*;')
> if r.match(proto):
> declaration_name = r.group(1)
next prev parent reply other threads:[~2025-09-10 10:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 20:43 [PATCH 00/13] docs: kdoc: improvements to dump_function() and thereabouts Jonathan Corbet
2025-09-09 20:43 ` [PATCH 01/13] docs: kdoc: trim __cacheline_group_* with the other annotations Jonathan Corbet
2025-09-09 20:43 ` [PATCH 02/13] docs: kdoc: tighten up the push_parameter() no-type case Jonathan Corbet
2025-09-09 20:43 ` [PATCH 03/13] docs: kdoc: remove a single-use variable Jonathan Corbet
2025-09-09 20:43 ` [PATCH 04/13] docs: kdoc: move the function transform patterns out of dump_function() Jonathan Corbet
2025-09-09 20:43 ` [PATCH 05/13] doc: kdoc: unify transform handling Jonathan Corbet
2025-09-09 20:43 ` [PATCH 06/13] docs: kdoc: remove a couple of spurious regex characters Jonathan Corbet
2025-09-09 20:43 ` [PATCH 07/13] docs: kdoc: remove a useless empty capture group Jonathan Corbet
2025-09-09 20:43 ` [PATCH 08/13] docs: kdoc: Simplify the dump_function() prototype regexes Jonathan Corbet
2025-09-09 20:43 ` [PATCH 09/13] docs: kdoc: consolidate some of the macro-processing logic Jonathan Corbet
2025-09-09 20:43 ` [PATCH 10/13] docs: kdoc: final dump_function() cleanups Jonathan Corbet
2025-09-09 20:43 ` [PATCH 11/13] docs: kdoc: remove some dead code in dump_typedef() Jonathan Corbet
2025-09-09 20:43 ` [PATCH 12/13] docs: kdoc: remove redundant comment stripping " Jonathan Corbet
2025-09-09 20:43 ` [PATCH 13/13] docs: kdoc: a few more dump_typedef() tweaks Jonathan Corbet
2025-09-10 10:10 ` Akira Yokosawa [this message]
2025-09-10 13:46 ` Jonathan Corbet
2025-09-10 23:27 ` Akira Yokosawa
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=8ff91be7-7cb7-492b-b1be-2d03516c8386@gmail.com \
--to=akiyks@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@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