linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] kernel-doc: Issue warnings that were silently discarded
@ 2025-11-04 21:55 Andy Shevchenko
  2025-11-04 23:14 ` kernel test robot
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Andy Shevchenko @ 2025-11-04 21:55 UTC (permalink / raw)
  To: Jonathan Corbet, Mauro Carvalho Chehab, linux-doc, linux-kernel
  Cc: Andy Shevchenko

When kernel-doc parses the sections for the documentation some errors
may occur. In many cases the warning is simply stored to the current
"entry" object. However, in the most of such cases this object gets
discarded and there is no way for the output engine to even know about
that. To avoid that, check if the "entry" is going to be discarded and
if there warnings have been collected, issue them to the current logger
as is and then flush the "entry". This fixes the problem that original
Perl implementation doesn't have.

As of Linux kernel v6.18-rc4 the reproducer can be:

$ scripts/kernel-doc -v -none -Wall include/linux/util_macros.h
...
Info: include/linux/util_macros.h:138 Scanning doc for function to_user_ptr
...

while with the proposed change applied it gives one more line:

$ scripts/kernel-doc -v -none -Wall include/linux/util_macros.h
...
Info: include/linux/util_macros.h:138 Scanning doc for function to_user_ptr
Warning: include/linux/util_macros.h:144 expecting prototype for to_user_ptr(). Prototype was for u64_to_user_ptr() instead
...

And with the original Perl script:

$ scripts/kernel-doc.pl -v -none -Wall include/linux/util_macros.h
...
include/linux/util_macros.h:139: info: Scanning doc for function to_user_ptr
include/linux/util_macros.h:149: warning: expecting prototype for to_user_ptr(). Prototype was for u64_to_user_ptr() instead
...

Fixes: 9cbc2d3b137b ("scripts/kernel-doc.py: postpone warnings to the output plugin")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 scripts/lib/kdoc/kdoc_parser.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
index ee1a4ea6e725..f7dbb0868367 100644
--- a/scripts/lib/kdoc/kdoc_parser.py
+++ b/scripts/lib/kdoc/kdoc_parser.py
@@ -451,6 +451,13 @@ class KernelDoc:
         variables used by the state machine.
         """
 
+        #
+        # Flush the warnings out before we proceed further
+        #
+        if self.entry and self.entry not in self.entries:
+            for log_msg in self.entry.warnings:
+                self.config.log.warning(log_msg)
+
         self.entry = KernelEntry(self.config, self.fname, ln)
 
         # State flags
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-11-09 20:34 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-04 21:55 [PATCH v1 1/1] kernel-doc: Issue warnings that were silently discarded Andy Shevchenko
2025-11-04 23:14 ` kernel test robot
2025-11-05  5:26   ` Andy Shevchenko
2025-11-04 23:14 ` kernel test robot
2025-11-05  5:27   ` Andy Shevchenko
2025-11-05  7:48     ` Philip Li
2025-11-05 10:02       ` Andy Shevchenko
2025-11-05 12:02         ` Philip Li
2025-11-04 23:18 ` Randy Dunlap
2025-11-05  6:38   ` Andy Shevchenko
2025-11-05 18:12 ` Jonathan Corbet
2025-11-05 18:51   ` Andy Shevchenko
2025-11-09  0:03   ` Randy Dunlap
2025-11-09 15:54     ` Andy Shevchenko
2025-11-09 20:34       ` Randy Dunlap
2025-11-05 21:19 ` Mauro Carvalho Chehab
2025-11-06  0:48   ` Randy Dunlap
2025-11-06  7:31   ` Andy Shevchenko
2025-11-06  7:42     ` Andy Shevchenko
2025-11-06 13:12     ` Mauro Carvalho Chehab
     [not found] ` <202511060602.1xDZ7cIT-lkp@intel.com>
2025-11-06  7:23   ` [BUILD REGRESSION] LAST PATCH: " Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).