[v1,01/14] scripts/kernel-doc: strip QEMU_ from function definitions

Message ID 20210320133706.21475-2-alex.bennee@linaro.org
State Superseded
Headers show
Series
  • fixes for rc1 (kernel-doc, semihosting, testing)
Related show

Commit Message

Alex Bennée March 20, 2021, 1:36 p.m.
Some packaged versions of Sphinx (fedora33/alpine so far) have issues
with the annotated C code that kernel-doc spits out. Without knowing
about things like QEMU_PLUGIN_EXPORT it chokes trying to understand
the code. Evidently this is a problem for the kernel as well as the
long stream of regex substitutions we add to in this patch can attest.

Fortunately we have a fairly common format for all our compiler
shenanigans as applied to functions so lets just filter them all out.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 scripts/kernel-doc | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.20.1

Comments

Richard Henderson March 20, 2021, 4:04 p.m. | #1
On 3/20/21 7:36 AM, Alex Bennée wrote:
> Some packaged versions of Sphinx (fedora33/alpine so far) have issues

> with the annotated C code that kernel-doc spits out. Without knowing

> about things like QEMU_PLUGIN_EXPORT it chokes trying to understand

> the code. Evidently this is a problem for the kernel as well as the

> long stream of regex substitutions we add to in this patch can attest.

> 

> Fortunately we have a fairly common format for all our compiler

> shenanigans as applied to functions so lets just filter them all out.

> 

> Signed-off-by: Alex Bennée<alex.bennee@linaro.org>

> ---


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

Patch

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 4b19851b2d..240923d509 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1745,6 +1745,9 @@  sub dump_function($$) {
             )+
           \)\)\s+//x;
 
+    # Strip QEMU specific compiler annotations
+    $prototype =~ s/QEMU_[A-Z_]+ +//;
+
     # Yes, this truly is vile.  We are looking for:
     # 1. Return type (may be nothing if we're looking at a macro)
     # 2. Function name