Re: [PATCH] kernel-doc: add support for handling global variables
From: Mauro Carvalho Chehab
Date: Sun Nov 16 2025 - 05:29:22 EST
Em Fri, 14 Nov 2025 16:50:57 -0800
Randy Dunlap <rdunlap@xxxxxxxxxxxxx> escreveu:
> The v2 patch certainly is better with the new regexes to ignore.
> I have a few minor changes that I would like to add (in a trivial patch below).
See my comments below.
> And there are still a few cases that are not handled correctly.
> (see my kdoc-globals-test.patch from 9/9/2025)
Where is it?
> Also, changing to "var" instead of "global" is good IMO.
I'll send a v3 with the rename in a few.
> ---
> scripts/lib/kdoc/kdoc_output.py | 2 +-
> scripts/lib/kdoc/kdoc_parser.py | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> --- linux-next-20251114.orig/scripts/lib/kdoc/kdoc_output.py
> +++ linux-next-20251114/scripts/lib/kdoc/kdoc_output.py
> @@ -808,7 +808,7 @@ class ManFormat(OutputFormat):
> self.data += f"{prototype} \\- {args['purpose']}\n"
>
> self.data += ".SH SYNOPSIS\n"
> - self.data += f"enum {name}" + " {\n"
> + self.data += f"{prototype}" + ";\n"
This one should probably be a separate patch from you after the
patch, as it is related to enum, and not var tag.
>
> if args.other_stuff["default_val"]:
> self.data += f'.SH "Initialization"' + "\n"
> --- linux-next-20251114.orig/scripts/lib/kdoc/kdoc_parser.py
> +++ linux-next-20251114/scripts/lib/kdoc/kdoc_parser.py
> @@ -939,6 +939,7 @@ class KernelDoc:
> (KernRe(r"(?://.*)$"), ""),
> (KernRe(r"(?:/\*.*\*/)"), ""),
> (KernRe(r";$"), ""),
> + (KernRe(r"=.*"), ""),
Makes sense. I'll add it to the v3.
My suggestion is that, once I sent v3, you pick it at the beginning
on your series and then add your changes on separate patches
after that, including the one using "{prototype}" for enum.
Thanks,
Mauro