Skip to content

Commit 6fa6b5c

Browse files
author
Eric Biggers
committed
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 <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Acked-by: Randy Dunlap <[email protected]> Tested-by: Randy Dunlap <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 8c2f128 commit 6fa6b5c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tools/lib/python/kdoc/kdoc_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,11 @@ def create_parameter_list(self, ln, decl_type, args,
571571
# Ignore argument attributes
572572
arg = KernRe(r'\sPOS0?\s').sub(' ', arg)
573573

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+
574579
# Strip leading/trailing spaces
575580
arg = arg.strip()
576581
arg = KernRe(r'\s+').sub(' ', arg, count=1)

0 commit comments

Comments
 (0)