[PATCH for-10.2 4/8] scripts/kernel-doc: strip QEMU_ from function definitions

Peter Maydell posted 8 patches 3 months ago
[PATCH for-10.2 4/8] scripts/kernel-doc: strip QEMU_ from function definitions
Posted by Peter Maydell 3 months ago
This commit is the Python version of our older commit
b30df2751e5 ("scripts/kernel-doc: strip QEMU_ from function definitions").

Some versions of Sphinx get confused if function attributes are
left on the C code from kernel-doc; strip out any QEMU_* prefixes
from function prototypes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 scripts/lib/kdoc/kdoc_parser.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
index fe730099eca..32b43562929 100644
--- a/scripts/lib/kdoc/kdoc_parser.py
+++ b/scripts/lib/kdoc/kdoc_parser.py
@@ -907,6 +907,7 @@ def dump_function(self, ln, prototype):
             (r"^__always_inline +", "", 0),
             (r"^noinline +", "", 0),
             (r"^__FORTIFY_INLINE +", "", 0),
+            (r"QEMU_[A-Z_]+ +", "", 0),
             (r"__init +", "", 0),
             (r"__init_or_module +", "", 0),
             (r"__deprecated +", "", 0),
-- 
2.43.0
Re: [PATCH for-10.2 4/8] scripts/kernel-doc: strip QEMU_ from function definitions
Posted by Mauro Carvalho Chehab 3 months ago
Em Thu, 14 Aug 2025 18:13:19 +0100
Peter Maydell <peter.maydell@linaro.org> escreveu:

> This commit is the Python version of our older commit
> b30df2751e5 ("scripts/kernel-doc: strip QEMU_ from function definitions").
> 
> Some versions of Sphinx get confused if function attributes are
> left on the C code from kernel-doc; strip out any QEMU_* prefixes
> from function prototypes.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Yeah, I saw this difference before when I did a quick test meant
to port it to QEMU.

So,
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

> ---
>  scripts/lib/kdoc/kdoc_parser.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index fe730099eca..32b43562929 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -907,6 +907,7 @@ def dump_function(self, ln, prototype):
>              (r"^__always_inline +", "", 0),
>              (r"^noinline +", "", 0),
>              (r"^__FORTIFY_INLINE +", "", 0),
> +            (r"QEMU_[A-Z_]+ +", "", 0),
>              (r"__init +", "", 0),
>              (r"__init_or_module +", "", 0),
>              (r"__deprecated +", "", 0),



Thanks,
Mauro