From: Jonathan Corbet <corbet@lwn.net>
To: Eric Biggers <ebiggers@kernel.org>, linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
linux-doc@vger.kernel.org,
Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
Randy Dunlap <rdunlap@infradead.org>,
Eric Biggers <ebiggers@kernel.org>
Subject: Re: [PATCH 1/2] docs: kdoc: Expand 'at_least' when creating parameter list
Date: Fri, 17 Apr 2026 01:18:18 -0600 [thread overview]
Message-ID: <878qamys05.fsf@trenco.lwn.net> (raw)
In-Reply-To: <20260417065529.64925-2-ebiggers@kernel.org>
Eric Biggers <ebiggers@kernel.org> writes:
> sphinx doesn't know that the kernel headers do:
>
> #define at_least static
>
> Do this replacement before declarations are passed to it.
>
> This prevents errors like the following from appearing once the
> lib/crypto/ kerneldoc is wired up to the sphinx build:
>
> linux/Documentation/crypto/libcrypto:128: ./include/crypto/sha2.h:773: WARNING: Error in declarator or parameters
> Error in declarator or parameters
> Invalid C declaration: Expected ']' in end of array operator. [error at 59]
> void sha512_final (struct sha512_ctx *ctx, u8 out[at_least SHA512_DIGEST_SIZE])
>
> Signed-off-by: Eric Biggers <ebiggers@kernel.org>
> ---
> tools/lib/python/kdoc/kdoc_parser.py | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/kdoc_parser.py
> index 74af7ae47aa47..f982db7fddac2 100644
> --- a/tools/lib/python/kdoc/kdoc_parser.py
> +++ b/tools/lib/python/kdoc/kdoc_parser.py
> @@ -437,10 +437,15 @@ class KernelDoc:
>
> for arg in args.split(splitter):
> # Ignore argument attributes
> arg = KernRe(r'\sPOS0?\s').sub(' ', arg)
>
> + # Replace '[at_least ' with '[static '. This allows sphinx to parse
> + # array parameter declarations like 'char A[at_least 4]', where
> + # 'at_least' is #defined to 'static' by the kernel headers.
> + arg = KernRe(r'\[at_least ').sub('[static ', arg)
> +
This could be a regular string replacement rather than a regex. Not
something I'm willing to dig in my heels on, though... so if you want to
push this, either way:
Acked-by: Jonathan Corbet <corbet@lwn.net>
Thanks,
jon
next prev parent reply other threads:[~2026-04-17 7:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-17 6:55 [PATCH 0/2] Improve the crypto library documentation Eric Biggers
2026-04-17 6:55 ` [PATCH 1/2] docs: kdoc: Expand 'at_least' when creating parameter list Eric Biggers
2026-04-17 7:18 ` Jonathan Corbet [this message]
2026-04-17 6:55 ` [PATCH 2/2] lib/crypto: docs: Add rst documentation to Documentation/crypto/ Eric Biggers
2026-04-17 7:22 ` [PATCH 0/2] Improve the crypto library documentation Jonathan Corbet
2026-04-17 13:47 ` Ard Biesheuvel
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=878qamys05.fsf@trenco.lwn.net \
--to=corbet@lwn.net \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=ebiggers@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@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