Re: [PATCH 1/2] kernel-doc: don't let V=1 change outcome

From: Johannes Berg
Date: Mon Jun 05 2023 - 04:19:09 EST


On Mon, 2023-06-05 at 09:36 +0900, Masahiro Yamada wrote:

> > +if (defined($ENV{'KDOC_WRETURN'})) {
> > + $Wreturn = "$ENV{'KDOC_WRETURN'}";
> > +}
> > +
> > +if (defined($ENV{'KDOC_WSHORT_DESC'})) {
> > + $Wshort_desc = "$ENV{'KDOC_WSHORT_DESC'}";
> > +}
> > +
> > +if (defined($ENV{'KDOC_WCONTENTS_BEFORE_SECTION'})) {
> > + $Wcontents_before_sections = "$ENV{'KDOC_WCONTENTS_BEFORE_SECTION'}";
> > +}
> > +
> > +if (defined($ENV{'KDOC_WALL'})) {
> > + $Wreturn = "$ENV{'KDOC_WALL'}";
> > + $Wshort_desc = "$ENV{'KDOC_WALL'}";
> > + $Wcontents_before_sections = "$ENV{'KDOC_WALL'}";
> > +}
>
>
>
> Adding an environment variable to each of them is tedious.

Agree. And adding one for -Wall is especially tedious because you have
to spell out the list of affected warnings in two places :)

> If you enable -Wall via the command line option,
> these lines are unneeded?
>
> For example,
>
> ifneq ($(KBUILD_EXTRA_WARN),)
> cmd_checkdoc = $(srctree)/scripts/kernel-doc -none \
> $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) $<
> endif
>

Yes, that should be possible.

I feel like maybe we should still have individual settings for the three
different classes, because you might want to have -Wshort-desc without
the extra -Wcontents-before-sections (which I thought about removing
entirely, kernel-doc seems to parse just fine that way, what's the point
of it?)

But we could even move the env var handling _completely_ to the Makefile
if you don't mind, and then we don't have to have two places in the
script that need to be aligned all the time.

johannes