kernel-doc -Werror regression
Mauro, Jon -
It seems to me with the kernel-doc conversion from perl to python we've lost a huge amount of -Werror handling. AFAICS none of the warnings from kdoc_parser.py using emit_msg() lead to a non-zero exit status from kernel-doc.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel
Hi Jani,
Em Fri, 09 Jan 2026 13:07:02 +0200
Jani Nikula <[email protected]> escreveu:
Quoted 6 lines
Mauro, Jon -
It seems to me with the kernel-doc conversion from perl to python we've lost a huge amount of -Werror handling. AFAICS none of the warnings from
kdoc_parser.pyusingemit_msg()lead to a non-zero exit status from kernel-doc.
The culprit was not the conversion, but this change:
469c1c9eb6c9 ("kernel-doc: Issue warnings that were silently discarded")
which effectively broke most of -W<foo> command line arguments.
I mentioned it back then:
https://lore.kernel.org/linux-doc/3fnulqi7hfplggfqevab525clikq7fnsnt72lauddzy32sepyq@maux2bgqa3np/
-
After the conversion, the errors detected during the parsing phase were moved to be displayed/handled at the output phase. There, when an error occurs, self.errors is incremented at:
tools/lib/python/kdoc/kdoc_files.py
Then, at kernel-doc.py, we have:
error_count = kfiles.errors
if not error_count:
sys.exit(0)
if args.werror:
print("%s warnings as errors" % error_count) # pylint: disable=C0209
sys.exit(error_count)
Patch 469c1c9eb6c9 broke it, among other things, as it now emits errors at parsing time, breaking the logic that inhibits errors with -W<foo>, and breaking -Werror as well, as the error is not counted anymore.
That's said, there is another issue there as well, which I hadn't time yet to fix: we can't do sys.exit(error_count), as the return code is an 8-bit value.
I'll work on a patch series to address such issues along the week.
Thanks,
Mauro