[PATCH 0/2] docs: kdoc: print each warning once, and only for selected symbols
From: Prateekshit Jaiswal via B4 Relay
Date: Sat Nov 14 2026 - 01:14:35 EST
kernel-doc currently prints every documented symbol's warnings twice.
With -function or -export it also warns about symbols that were not
asked for. Both come from the parser flushing warnings of entries it
mistakenly treats as discarded; patch 2 stops that.
Doing only that would uncover an older bug: the output step never
prints warnings for symbols selected with -function or -export.
Patch 1 restores those first, so nothing is lost at any point in the
series.
Testing:
- tools/unittests/run.py passes after each patch. Without patch 1,
the new OutputFilterWarnings tests for selected and exported symbols
fail; without patch 2, test_stored_entry fails.
- Warnings printed for intel_dkl_phy.c, before and after the series:
-Wall: 2 and 1; -function intel_dkl_phy_read: 1 and 1;
-function intel_dkl_phy_write: 1 and 0;
-nosymbol intel_dkl_phy_read: 1 and 0.
- kernel-doc -none -Wall over the 10320 .c and .h files with kernel-doc
comments: 87900 and 49625 output lines, with the same 48026 distinct
lines.
- The two "Excess struct member" warnings for page_pool_params, which
Documentation/networking/page_pool.rst pulls in with :identifiers:,
are still printed, once each.
Notes:
- The new tests patch config.warning directly. MockKdocConfig.warning()
is never called, because KdocConfig.__init__() sets self.warning as
an instance attribute that shadows it, so the MockLogging handler
does not see config.warning() messages. I can send a separate fix for
that.
- Plain --yaml output never printed warnings itself, so with patch 2
it no longer shows the warnings of stored entries. With -rst or -man
they are still printed, once, by the embedded output formats.
---
Prateekshit Jaiswal (2):
docs: kdoc: emit warnings for symbols selected with -function/-export
docs: kdoc: don't print warnings of stored entries twice
tools/lib/python/kdoc/kdoc_output.py | 1 +
tools/lib/python/kdoc/kdoc_parser.py | 4 +-
tools/unittests/test_kdoc_parser.py | 126 +++++++++++++++++++++++++++++++++++
3 files changed, 130 insertions(+), 1 deletion(-)
---
base-commit: 2138148bf44fd84d3e0a863f0e8cb3627cdcc606
change-id: 20261114-kdoc-dup-warnings-785f4a72b806
Best regards,
--
Prateekshit Jaiswal <prateekshitjaiswal73@xxxxxxxxx>