diff options
author | Vegard Nossum <vegard.nossum@oracle.com> | 2024-02-15 14:48:27 +0100 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2024-02-21 13:44:21 -0700 |
commit | 9f6f4c110c95a96942004547c84ab22384d9e723 (patch) | |
tree | 58c30362eb2071db6d9113570e969420c3aa82bb /scripts | |
parent | d3c55a710f95e11e2369a57cb53d4a7f3280aa57 (diff) | |
download | linux-9f6f4c110c95a96942004547c84ab22384d9e723.tar.gz linux-9f6f4c110c95a96942004547c84ab22384d9e723.tar.bz2 linux-9f6f4c110c95a96942004547c84ab22384d9e723.zip |
scripts/kernel-doc: simplify signature printing
Untangle some of the $is_macro logic and the nested conditionals.
This makes it easier to see where and how the signature is actually
printed.
No functional change.
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20240215134828.1277109-5-vegard.nossum@oracle.com
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel-doc | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 1af2c68f6bd8..7acb7554abb9 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -820,7 +820,6 @@ sub output_function_rst(%) { my %args = %{$_[0]}; my ($parameter, $section); my $oldprefix = $lineprefix; - my $is_macro = 0; my $signature = ""; if ($args{'functiontype'} ne "") { @@ -854,37 +853,30 @@ sub output_function_rst(%) { print " **Typedef**: "; $lineprefix = ""; output_highlight_rst($args{'purpose'}); - print "\n\n**Syntax**\n\n ``"; - $is_macro = 1; + print "\n\n**Syntax**\n\n"; + print " ``$signature``\n\n"; } else { - print ".. c:function:: "; + print ".. c:function:: $signature\n\n"; } } else { if ($args{'typedef'} || $args{'functiontype'} eq "") { - $is_macro = 1; print ".. c:macro:: ". $args{'function'} . "\n\n"; - } else { - print ".. c:function:: "; - } - if ($args{'typedef'}) { - print_lineno($declaration_start_line); - print " **Typedef**: "; - $lineprefix = ""; - output_highlight_rst($args{'purpose'}); - print "\n\n**Syntax**\n\n ``"; + if ($args{'typedef'}) { + print_lineno($declaration_start_line); + print " **Typedef**: "; + $lineprefix = ""; + output_highlight_rst($args{'purpose'}); + print "\n\n**Syntax**\n\n"; + print " ``$signature``\n\n"; + } else { + print "``$signature``\n\n"; + } } else { - print "``" if ($is_macro); + print ".. c:function:: $signature\n\n"; } } - print $signature; - - if ($is_macro) { - print "``\n\n"; - } else { - print "\n\n"; - } if (!$args{'typedef'}) { print_lineno($declaration_start_line); $lineprefix = " "; |