Skip to contentSkip to conversation

docs: kdoc: Make body_with_blank_line parsing more flexible

PATCH New Jonathan Corbet 1 participant 1 message Jun 10, 2025 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: kdoc: Make body_with_blank_line parsing more flexible

The regex in the BODY_WITH_BLANK_LINE case was looking for lines starting with " * ", where exactly one space was allowed before the following text. There are many kerneldoc comments where the authors have put multiple spaces instead, leading to mis-formatting of the documentation. Specifically, in this case, the description portion is associated with the last of the parameters.

Allow multiple spaces in this context.

See, for example, synchronize_hardirq() and how its documentation is formatted before and after the change.

---
Unlike my other kernel-doc changes, this one does result in changed output, but the result is clearly (IMO) more correct.

 scripts/lib/kdoc/kdoc_parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/kdoc/kdoc_parser.py +1 -1
index 9a1ce6ed8605..294f5d032b3d 100644
@@ -1301,7 +1301,7 @@ class KernelDoc:
         """
 
         if self.state == state.BODY_WITH_BLANK_LINE:
-            r = KernRe(r"\s*\*\s?\S")
+            r = KernRe(r"\s*\*\s*\S")
             if r.match(line):
                 self.dump_section()
                 self.entry.section = SECTION_DEFAULT
Signature · 1 line
2.49.0