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

[PATCH] kernel-doc: fix some odd spacing issues

- in man and text mode output, if the function return type is empty (like it
is for macros), don't print the return type and a following space; this
fixes an output malalignment;

- in the function short description, strip leading, trailing, and multiple
embedded spaces (to one space); this makes function name/description output
spacing consistent;

- fix a comment typo;

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Randy Dunlap and committed by
Linus Torvalds
a21217da 6e8c8188

+20 -4
+20 -4
scripts/kernel-doc
··· 365 365 # parameterlist => @list of parameters 366 366 # parameterdescs => %parameter descriptions 367 367 # sectionlist => @list of sections 368 - # sections => %descriont descriptions 368 + # sections => %section descriptions 369 369 # 370 370 371 371 sub output_highlight { ··· 953 953 print $args{'function'}." \\- ".$args{'purpose'}."\n"; 954 954 955 955 print ".SH SYNOPSIS\n"; 956 - print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n"; 956 + if ($args{'functiontype'} ne "") { 957 + print ".B \"".$args{'functiontype'}."\" ".$args{'function'}."\n"; 958 + } else { 959 + print ".B \"".$args{'function'}."\n"; 960 + } 957 961 $count = 0; 958 962 my $parenth = "("; 959 963 my $post = ","; ··· 1122 1118 sub output_function_text(%) { 1123 1119 my %args = %{$_[0]}; 1124 1120 my ($parameter, $section); 1121 + my $start; 1125 1122 1126 1123 print "Name:\n\n"; 1127 1124 print $args{'function'}." - ".$args{'purpose'}."\n"; 1128 1125 1129 1126 print "\nSynopsis:\n\n"; 1130 - my $start=$args{'functiontype'}." ".$args{'function'}." ("; 1127 + if ($args{'functiontype'} ne "") { 1128 + $start = $args{'functiontype'}." ".$args{'function'}." ("; 1129 + } else { 1130 + $start = $args{'function'}." ("; 1131 + } 1131 1132 print $start; 1133 + 1132 1134 my $count = 0; 1133 1135 foreach my $parameter (@{$args{'parameterlist'}}) { 1134 1136 $type = $args{'parametertypes'}{$parameter}; ··· 1720 1710 my $file; 1721 1711 my $identifier; 1722 1712 my $func; 1713 + my $descr; 1723 1714 my $initial_section_counter = $section_counter; 1724 1715 1725 1716 if (defined($ENV{'SRCTREE'})) { ··· 1764 1753 1765 1754 $state = 2; 1766 1755 if (/-(.*)/) { 1767 - $declaration_purpose = xml_escape($1); 1756 + # strip leading/trailing/multiple spaces #RDD:T: 1757 + $descr= $1; 1758 + $descr =~ s/^\s*//; 1759 + $descr =~ s/\s*$//; 1760 + $descr =~ s/\s+/ /; 1761 + $declaration_purpose = xml_escape($descr); 1768 1762 } else { 1769 1763 $declaration_purpose = ""; 1770 1764 }