docs: kdoc: don't reinvent string.strip()
authorJonathan Corbet <corbet@lwn.net>
Thu, 3 Jul 2025 18:43:57 +0000 (12:43 -0600)
committerJonathan Corbet <corbet@lwn.net>
Tue, 8 Jul 2025 14:06:25 +0000 (08:06 -0600)
commite7e540363cc52207c5245ad934180db1a1f96522
tree9e4e7f719afa475020ab0553af391cc7e86513f7
parent38d573a624a54ccde1384ead8af0780fe4005c2b
docs: kdoc: don't reinvent string.strip()

process_proto_type() and process_proto_function() reinventing the strip()
string method with a whole series of separate regexes; take all that out
and just use strip().

The previous implementation also (in process_proto_type()) removed C++
comments *after* the above dance, leaving trailing whitespace in that case;
now we do the stripping afterward.  This results in exactly one output
change: the removal of a spurious space in the definition of
BACKLIGHT_POWER_REDUCED - see
https://docs.kernel.org/gpu/backlight.html#c.backlight_properties.

I note that we are putting semicolons after #define lines that really
shouldn't be there - a task for another day.

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tested-by: Akira Yokosawa <akiyks@gmail.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20250703184403.274408-2-corbet@lwn.net
scripts/lib/kdoc/kdoc_parser.py