Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: kdoc: Expand 'at_least' when creating parameter list

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/ kernel-doc 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])

Acked-by: Jonathan Corbet <corbet@lwn.net>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20260418192138.15556-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+5
+5
tools/lib/python/kdoc/kdoc_parser.py
··· 571 571 # Ignore argument attributes 572 572 arg = KernRe(r'\sPOS0?\s').sub(' ', arg) 573 573 574 + # Replace '[at_least ' with '[static '. This allows sphinx to parse 575 + # array parameter declarations like 'char A[at_least 4]', where 576 + # 'at_least' is #defined to 'static' by the kernel headers. 577 + arg = arg.replace('[at_least ', '[static ') 578 + 574 579 # Strip leading/trailing spaces 575 580 arg = arg.strip() 576 581 arg = KernRe(r'\s+').sub(' ', arg, count=1)