Re: [PATCH] kernel-doc: add support for handling global variables
From: Mauro Carvalho Chehab
Date: Tue Sep 09 2025 - 19:09:07 EST
Em Tue, 9 Sep 2025 14:06:43 -0700
Randy Dunlap <rdunlap@xxxxxxxxxxxxx> escreveu:
> On 9/9/25 12:58 PM, Mauro Carvalho Chehab wrote:
> > Em Tue, 9 Sep 2025 00:27:20 -0700
> > Randy Dunlap <rdunlap@xxxxxxxxxxxxx> escreveu:
> >> +.. kernel-doc:: init/kdoc-globals-test.c
> >> + :identifiers:
> >>
> >> The html output says
> >> "Kernel Globals"
> >> but nothing else.
> >
> > I usually don't add :identifiers: on kernel-doc entries. If you use
> > identifiers, you need to explicitly tell what symbols you want.
>
> Well, it worked/works without using having any identifiers listed, and
> the docs in Documentation/doc-guide/kernel-doc.rst says that they are
> optional:
>
> identifiers: *[ function/type ...]*
> Include documentation for each *function* and *type* in *source*.
> If no *function* is specified, the documentation for all functions
> and types in the *source* will be included.
> *type* can be a struct, union, enum, or typedef identifier.
Hmm.. looking the entire logic:
elif 'identifiers' in self.options:
identifiers = self.options.get('identifiers').split()
if identifiers:
for i in identifiers:
i = i.rstrip("\\").strip()
if not i:
continue
cmd += ['-function', i]
self.msg_args["symbol"].append(i)
else:
cmd += ['-no-doc-sections']
self.msg_args["no_doc_sections"] = True
I suspect that an empty identifier could be raising an exception.
The right logic should be, instead:
- elif 'identifiers' in self.options:
- identifiers = self.options.get('identifiers').split()
- if identifiers:
- for i in identifiers:
+ elif 'identifiers' in self.options:
+ identifiers = self.options.get('identifiers')
+ if identifiers:
+ for i in identifiers.split():
(tests needed)
Thanks,
Mauro