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

Message ID 20231226065219.319-1-rdunlap@infradead.org
State New
Headers
Series kernel-doc: handle a void function without producing a warning |

Commit Message

Randy Dunlap Dec. 26, 2023, 6:52 a.m. UTC
  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
---
 scripts/kernel-doc |    1 +
 1 file changed, 1 insertion(+)
  

Comments

Jonathan Corbet Jan. 3, 2024, 9:13 p.m. UTC | #1
Randy Dunlap <rdunlap@infradead.org> writes:

> 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
> ---
>  scripts/kernel-doc |    1 +
>  1 file changed, 1 insertion(+)
>
> diff -- a/scripts/kernel-doc b/scripts/kernel-doc
> --- 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;

Applied, thanks.

jon
  

Patch

diff -- a/scripts/kernel-doc b/scripts/kernel-doc
--- 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;