Skip to contentSkip to conversation

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

PATCH Applied Randy Dunlap 2 participants 2 messages Dec 26, 2023 – Jan 3, 2024 Documentation

lore
Share & tools
lore

Randy Dunlap

author reviewer
#0 lore raw

PATCH 1/1 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")
Cc Jani Nikula <[email protected]>
Cc Jonathan Corbet <[email protected]>
---
 scripts/kernel-doc |    1 +
 1 file changed, 1 insertion(+)
scripts/kernel-doc +1 -0
diff -- a/scripts/kernel-doc b/scripts/kernel-doc
@@ -2126,6 +2126,7 @@ sub process_body($$) {
     }
 
     if (/$doc_sect/i) { # case insensitive for supported section names
+	$in_doc_sect = 1;
 	$newsection = $1;
 	$newcontents = $2;
 
maintainer Applied
#1 lore raw
Quoted 22 lines · Randy Dunlap

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")
Cc Jani Nikula <[email protected]>
Cc Jonathan Corbet <[email protected]>
---
 scripts/kernel-doc |    1 +
 1 file changed, 1 insertion(+)

diff -- a/scripts/kernel-doc b/scripts/kernel-doc

scripts/kernel-doc sub process_body($$) { · line 2130

Quoted 5 lines
scripts/kernel-doc +1 -0
@@ -2126,6 +2126,7 @@ sub process_body($$) {
     }
 
     if (/$doc_sect/i) { # case insensitive for supported section names
+	$in_doc_sect = 1;
 	$newsection = $1;

Applied, thanks.

jon