Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kernel-doc: handle a void function without producing a warning

Currently a void function can produce a warning:
main.c:469: warning: contents before sections

This one is from arch/x86/kernel/cpu/sgx/main.c (which is not included
in any produced kernel documentation output).

Handle this by setting $in_doc_sect to 1 whenever any recognized
document section name is processed.

Fixes: f624adef3d0b ("kernel-doc: limit the "section header:" detection to a select few")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: linux-doc@vger.kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20231226065219.319-1-rdunlap@infradead.org

authored by

Randy Dunlap and committed by
Jonathan Corbet
afa751e8 75ddc078

+1
+1
scripts/kernel-doc
··· 2121 2121 } 2122 2122 2123 2123 if (/$doc_sect/i) { # case insensitive for supported section names 2124 + $in_doc_sect = 1; 2124 2125 $newsection = $1; 2125 2126 $newcontents = $2; 2126 2127