]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
docs/sphinx/kerneldoc.py: Handle new LINENO syntax
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 14 Aug 2025 17:13:16 +0000 (18:13 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Sat, 30 Aug 2025 15:37:23 +0000 (16:37 +0100)
The new upstream kernel-doc that we plan to update to uses a different
syntax for the LINENO directives that the Sphinx extension parses:
instead of
  #define LINENO 86
it has
  .. LINENO 86

Update the kerneldoc.py extension to handle both syntaxes, so
that it will work with both the old and the new kernel-doc.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Message-id: 20250814171324.1614516-2-peter.maydell@linaro.org

docs/sphinx/kerneldoc.py

index 3aa972f2e89c1f59cf03ccc62c6f7a1835b65fc5..30bb3431983874db87ad29a87ba07ed11aed6b39 100644 (file)
@@ -127,7 +127,7 @@ class KernelDocDirective(Directive):
             result = ViewList()
 
             lineoffset = 0;
-            line_regex = re.compile("^#define LINENO ([0-9]+)$")
+            line_regex = re.compile(r"^(?:\.\.|#define) LINENO ([0-9]+)$")
             for line in lines:
                 match = line_regex.search(line)
                 if match: