From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Mahad Ibrahim <mahad.ibrahim.dev@gmail.com>
Cc: corbet@lwn.net, skhan@linuxfoundation.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] docs: fix Sphinx C parser crash on __cond_acquires macro
Date: Tue, 17 Mar 2026 16:43:25 +0100 [thread overview]
Message-ID: <20260317164250.6afae483@localhost> (raw)
In-Reply-To: <20260317151156.1106-1-mahad.ibrahim.dev@gmail.com>
On Tue, 17 Mar 2026 11:11:56 -0400
Mahad Ibrahim <mahad.ibrahim.dev@gmail.com> wrote:
> When building the kernel-docs, the Sphinx C parser threw two errors:
>
> 1. /home/code/linux/Documentation/core-api/kref:328:
> ./include/linux/kref.h:72: WARNING: Invalid C declaration: Expected
> end of definition. [error at 96]
> int kref_put_mutex (
> struct kref *kref,
> void (*release) (struct kref *kref),
> struct mutex *mutex)
> __cond_acquires(true# mutex)
>
> 2. /home/code/linux/Documentation/core-api/kref:328:
> ./include/linux/kref.h:94: WARNING: Invalid C declaration: Expected
> end of definition. [error at 92]
> int kref_put_lock (
> struct kref *kref,
> void (*release)(struct kref *kref),
> spinlock_t *lock)
> __cond_acquires(true# lock)
>
> The root cause of these errors is due to the parser's inability to
> understand sparse __cond_acquires() parameterized macro attached to the
> function. The parser expects a ';' or a '{' to verify a valid function
> signature ending.
> As of Sphinx 3.0, the parser is equipped to handle such cases via the
> c_paren_attributes list however that functionality was not adopted.
>
> Out of all sparse/compiler-based context analysis parameterized macros
> inside the kernel, only __cond_acquires appears in the context of a
> kernel-docs comment and function, which is why it is the only macro that
> threw an error.
>
> This bug may be attributed to the kernel's recent shift from sparse to
> compiler-based context analysis, increased strictness of Sphinx C
> parser, or some other change which transcended domains.
>
> Add c_paren_attributes to enable Sphinx parser to handle parameterized
> function macros like __cond_acquires.
Sorry but this patch is going at the wrong direction, as this is
a kernel-doc issue. There are already a patch series under review
meant to handle this one, together with other related issues.
--
Thanks,
Mauro
prev parent reply other threads:[~2026-03-17 15:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 15:11 [PATCH] docs: fix Sphinx C parser crash on __cond_acquires macro Mahad Ibrahim
2026-03-17 15:43 ` Mauro Carvalho Chehab [this message]
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=20260317164250.6afae483@localhost \
--to=mchehab+huawei@kernel.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mahad.ibrahim.dev@gmail.com \
--cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.