From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Jonathan Corbet <corbet@lwn.net>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>
Subject: [PATCH v3 06/30] docs: kdoc_parser: use NestedMatch to handle __attribute__ on functions
Date: Thu, 29 Jan 2026 09:07:57 +0100 [thread overview]
Message-ID: <aeffb85481cd2ee13d68377d4bed03cff1e7b378.1769673038.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1769673038.git.mchehab+huawei@kernel.org>
Some annotations macros may have nested parenthesis, causing normal
regex parsing to fail. The __attribute__ regex is currently very
complex to try to avoid that, but it doesn't catch all cases.
Ensure that the parenthesis will be properly handled by using
the NestedMatch() logic.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
---
tools/lib/python/kdoc/kdoc_parser.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/kdoc_parser.py
index ae5b2ef80f75..64165d8df84e 100644
--- a/tools/lib/python/kdoc/kdoc_parser.py
+++ b/tools/lib/python/kdoc/kdoc_parser.py
@@ -165,6 +165,7 @@ struct_nested_prefixes = [
# the start delimiter.
#
function_nested_prefixes = [
+ (re.compile(r"__attribute__\s*\("), ""),
]
#
@@ -195,7 +196,6 @@ function_xforms = [
(KernRe(r"__diagnose_as\s*\(\s*\S+\s*(?:,\s*\d+\s*)*\) +"), ""),
(KernRe(r"DECL_BUCKET_PARAMS\s*\(\s*(\S+)\s*,\s*(\S+)\s*\)"), r"\1, \2"),
(KernRe(r"__attribute_const__ +"), ""),
- (KernRe(r"__attribute__\s*\(\((?:[\w\s]+(?:\([^)]*\))?\s*,?)+\)\)\s+"), ""),
]
#
--
2.52.0
next prev parent reply other threads:[~2026-01-29 8:08 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 8:07 [PATCH v3 00/30] kernel-doc: make it parse new functions and structs Mauro Carvalho Chehab
2026-01-29 8:07 ` [PATCH v3 01/30] docs: kdoc_re: add support for groups() Mauro Carvalho Chehab
2026-01-29 8:07 ` [PATCH v3 02/30] docs: kdoc_re: don't go past the end of a line Mauro Carvalho Chehab
2026-01-29 8:07 ` [PATCH v3 03/30] docs: kdoc_parser: move var transformers to the beginning Mauro Carvalho Chehab
2026-01-29 10:26 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:07 ` [PATCH v3 04/30] docs: kdoc_parser: don't mangle with function defines Mauro Carvalho Chehab
2026-01-29 10:26 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:07 ` [PATCH v3 05/30] docs: kdoc_parser: add functions support for NestedMatch Mauro Carvalho Chehab
2026-01-29 10:27 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:07 ` Mauro Carvalho Chehab [this message]
2026-01-29 10:27 ` [Intel-wired-lan] [PATCH v3 06/30] docs: kdoc_parser: use NestedMatch to handle __attribute__ on functions Loktionov, Aleksandr
2026-01-29 8:07 ` [PATCH v3 07/30] docs: kdoc_parser: fix variable regexes to work with size_t Mauro Carvalho Chehab
2026-01-29 10:27 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:07 ` [PATCH v3 08/30] docs: kdoc_parser: fix the default_value logic for variables Mauro Carvalho Chehab
2026-01-29 10:28 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 09/30] docs: kdoc_parser: add some debug for variable parsing Mauro Carvalho Chehab
2026-01-29 10:28 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 10/30] docs: kdoc_parser: don't exclude defaults from prototype Mauro Carvalho Chehab
2026-01-29 10:25 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 10:29 ` Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 11/30] docs: kdoc_parser: fix parser to support multi-word types Mauro Carvalho Chehab
2026-01-29 10:29 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 12/30] docs: kdoc_parser: ignore context analysis and lock attributes Mauro Carvalho Chehab
2026-01-29 10:30 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 13/30] docs: kdoc_parser: add support for LIST_HEAD Mauro Carvalho Chehab
2026-01-29 10:30 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 14/30] kdoc_parser: handle struct member macro VIRTIO_DECLARE_FEATURES(name) Mauro Carvalho Chehab
2026-01-29 8:08 ` [PATCH v3 15/30] docs: kdoc_re: properly handle strings and escape chars on it Mauro Carvalho Chehab
2026-01-29 10:31 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 16/30] docs: kdoc_re: better show KernRe() at documentation Mauro Carvalho Chehab
2026-01-29 10:31 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 17/30] docs: kdoc_re: don't recompile NextMatch regex every time Mauro Carvalho Chehab
2026-01-29 10:31 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 18/30] docs: kdoc_re: Change NestedMath args replacement to \0 Mauro Carvalho Chehab
2026-01-29 10:32 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 19/30] docs: kdoc_re: make NextedMatch use KernRe Mauro Carvalho Chehab
2026-01-29 10:32 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-30 11:11 ` Kwapulinski, Piotr
2026-01-29 8:08 ` [PATCH v3 20/30] docs: kdoc_re: add support on NestedMatch for argument replacement Mauro Carvalho Chehab
2026-01-29 10:33 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 21/30] docs: python: add helpers to run unit tests Mauro Carvalho Chehab
2026-01-29 8:08 ` [PATCH v3 22/30] unittests: add tests for NestedMatch class Mauro Carvalho Chehab
2026-01-29 8:08 ` [PATCH v3 23/30] docs: kdoc_parser: better handle struct_group macros Mauro Carvalho Chehab
2026-01-29 10:33 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 24/30] docs: kdoc_re: fix a parse bug on struct page_pool_params Mauro Carvalho Chehab
2026-01-29 8:08 ` [PATCH v3 25/30] docs: kdoc_re: add a helper class to declare C function matches Mauro Carvalho Chehab
2026-01-29 10:33 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 26/30] docs: kdoc_parser: use the new CFunction class Mauro Carvalho Chehab
2026-01-29 10:34 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 27/30] docs: kdoc_parser: minimize differences with struct_group_tagged Mauro Carvalho Chehab
2026-01-29 10:34 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 28/30] docs: kdoc_parser: move transform lists to a separate file Mauro Carvalho Chehab
2026-01-29 10:34 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 29/30] docs: kdoc_re: don't remove the trailing ";" with NestedMatch Mauro Carvalho Chehab
2026-01-29 10:34 ` [Intel-wired-lan] [PATCH v3 29/30] docs: kdoc_re: don't remove the trailing "; " " Loktionov, Aleksandr
2026-01-29 8:08 ` [PATCH v3 30/30] docs: xforms_lists.py: use CFuntion to handle all function macros 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=aeffb85481cd2ee13d68377d4bed03cff1e7b378.1769673038.git.mchehab+huawei@kernel.org \
--to=mchehab+huawei@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rdunlap@infradead.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®