Re: [PATCH] scripts: kernel-doc: Always increment warnings counter

From: Jonathan Corbet
Date: Thu Jun 09 2022 - 11:48:56 EST


Niklas Söderlund <niklas.soderlund@xxxxxxxxxxxx> writes:

> Some warnings did not increment the warnings counter making the behavior
> of running kernel-doc with -Werror unlogical as some warnings would be
> generated but not treated as errors.
>
> Fix this by always incrementing the warnings counter every time a
> warning related to the input documentation is generated. There is one
> location in get_sphinx_version() where a warning is printed and the
> counter is not touched as it concerns the execution environment of the
> kernel-doc and not the documentation being processed.

So this seems like an improvement, but I have to ask: wouldn't it be far
better to just add a function to emit a warning and use that rather than
all these print/++$warnings pairings? The current way seems repetitive
and error-prone.

I also have to ask...

> Incrementing the counter only have effect when running kernel-doc in
> either verbose mode (-v or environment variable KBUILD_VERBOSE) or when
> treating warnings as errors (-Werror or environment variable
> KDOC_WERROR). In both cases the number of warnings printed is printed to
> stderr and for the later the exit code of kernel-doc is non-zero if
> warnings where encountered.
>
> Simple test case to demo one of the warnings,
>
> $ cat test.c
> /**
> * foo() - Description
> */
> int bar();
>
> # Without this change
> $ ./scripts/kernel-doc -Werror -none test.c
> test.c:4: warning: expecting prototype for foo(). Prototype was for
> bar() instead
>
> # With this change
> $ ./scripts/kernel-doc -Werror -none test.c
> test.c:4: warning: expecting prototype for foo(). Prototype was for
> bar() instead
> 1 warnings as Errors
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@xxxxxxxxxxxx>
> Signed-off-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
> Signed-off-by: Louis Peens <louis.peens@xxxxxxxxxxxx>

What does this signoff chain mean? If it really took three people to
make this patch, then we need Co-developed-by tags to reflect that.

Thanks,

jon