From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Akira Yokosawa <akiyks@gmail.com>
Subject: Re: [PATCH v2 5/7] docs: kdoc: tighten up the array-of-pointers case
Date: Fri, 15 Aug 2025 07:22:18 +0200 [thread overview]
Message-ID: <20250815072218.297083c7@foz.lan> (raw)
In-Reply-To: <20250814154035.328769-6-corbet@lwn.net>
Em Thu, 14 Aug 2025 09:40:33 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:
> Simplify one gnarly regex and remove another altogether; add a comment
> describing what is going on. There will be no #-substituted commas in this
> case, so don't bother trying to put them back.
>
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
LGTM.
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> ---
> scripts/lib/kdoc/kdoc_parser.py | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index 29881757bf1c..7f4d95dd47d4 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -527,23 +527,21 @@ class KernelDoc:
> dtype = KernRe(r'([^\(]+\(\*?)\s*' + re.escape(param)).sub(r'\1', arg)
> self.push_parameter(ln, decl_type, param, dtype,
> arg, declaration_name)
> -
> + #
> + # The array-of-pointers case. Dig the parameter name out from the middle
> + # of the declaration.
> + #
> elif KernRe(r'\(.+\)\s*\[').search(arg):
> - # Array-of-pointers
> -
> - arg = arg.replace('#', ',')
> - r = KernRe(r'[^\(]+\(\s*\*\s*([\w\[\].]*?)\s*(\s*\[\s*[\w]+\s*\]\s*)*\)')
> + r = KernRe(r'[^\(]+\(\s*\*\s*' # Up to "(" and maybe "*"
> + r'([\w.]*?)' # The actual pointer name
> + r'\s*(\[\s*\w+\s*\]\s*)*\)') # The [array portion]
> if r.match(arg):
> param = r.group(1)
> else:
> self.emit_msg(ln, f"Invalid param: {arg}")
> param = arg
> -
> - dtype = KernRe(r'([^\(]+\(\*?)\s*' + re.escape(param)).sub(r'\1', arg)
> -
> - self.push_parameter(ln, decl_type, param, dtype,
> - arg, declaration_name)
> -
> + dtype = arg.replace(param, '')
> + self.push_parameter(ln, decl_type, param, dtype, arg, declaration_name)
> elif arg:
> #
> # Clean up extraneous spaces and split the string at commas; the first
Thanks,
Mauro
next prev parent reply other threads:[~2025-08-15 5:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 15:40 [PATCH v2 0/7] Jonathan Corbet
2025-08-14 15:40 ` [PATCH v2 1/7] docs: kdoc: remove dead code Jonathan Corbet
2025-08-14 15:40 ` [PATCH v2 2/7] docs: kdoc: tidy up space removal in create_parameter_list() Jonathan Corbet
2025-08-14 15:40 ` [PATCH v2 3/7] docs: kdoc: clean up the create_parameter_list() "first arg" logic Jonathan Corbet
2025-08-14 15:40 ` [PATCH v2 4/7] docs: kdoc: add a couple more comments in create_parameter_list() Jonathan Corbet
2025-08-14 15:40 ` [PATCH v2 5/7] docs: kdoc: tighten up the array-of-pointers case Jonathan Corbet
2025-08-15 5:22 ` Mauro Carvalho Chehab [this message]
2025-08-14 15:40 ` [PATCH v2 6/7] docs: kdoc: tighten up the pointer-to-function case Jonathan Corbet
2025-08-14 15:40 ` [PATCH v2 7/7] docs: kdoc: remove redundant comment stripping Jonathan Corbet
2025-08-15 5:24 ` [PATCH v2 0/7] Mauro Carvalho Chehab
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=20250815072218.297083c7@foz.lan \
--to=mchehab+huawei@kernel.org \
--cc=akiyks@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--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
all inboxes | Powered by JetHome®