aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc19
1 files changed, 16 insertions, 3 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 99fe4b7fb2f1..00e21297aefe 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -253,6 +253,7 @@ my $lineprefix="";
253# 3 - scanning prototype. 253# 3 - scanning prototype.
254# 4 - documentation block 254# 4 - documentation block
255my $state; 255my $state;
256my $in_doc_sect;
256 257
257#declaration types: can be 258#declaration types: can be
258# 'function', 'struct', 'union', 'enum', 'typedef' 259# 'function', 'struct', 'union', 'enum', 'typedef'
@@ -1064,7 +1065,7 @@ sub output_struct_man(%) {
1064 } 1065 }
1065 print "};\n.br\n"; 1066 print "};\n.br\n";
1066 1067
1067 print ".SH Arguments\n"; 1068 print ".SH Members\n";
1068 foreach $parameter (@{$args{'parameterlist'}}) { 1069 foreach $parameter (@{$args{'parameterlist'}}) {
1069 ($parameter =~ /^#/) && next; 1070 ($parameter =~ /^#/) && next;
1070 1071
@@ -1673,6 +1674,9 @@ sub process_state3_type($$) {
1673# replace <, >, and & 1674# replace <, >, and &
1674sub xml_escape($) { 1675sub xml_escape($) {
1675 my $text = shift; 1676 my $text = shift;
1677 if (($output_mode eq "text") || ($output_mode eq "man")) {
1678 return $text;
1679 }
1676 $text =~ s/\&/\\\\\\amp;/g; 1680 $text =~ s/\&/\\\\\\amp;/g;
1677 $text =~ s/\</\\\\\\lt;/g; 1681 $text =~ s/\</\\\\\\lt;/g;
1678 $text =~ s/\>/\\\\\\gt;/g; 1682 $text =~ s/\>/\\\\\\gt;/g;
@@ -1706,6 +1710,7 @@ sub process_file($) {
1706 if ($state == 0) { 1710 if ($state == 0) {
1707 if (/$doc_start/o) { 1711 if (/$doc_start/o) {
1708 $state = 1; # next line is always the function name 1712 $state = 1; # next line is always the function name
1713 $in_doc_sect = 0;
1709 } 1714 }
1710 } elsif ($state == 1) { # this line is the function name (always) 1715 } elsif ($state == 1) { # this line is the function name (always)
1711 if (/$doc_block/o) { 1716 if (/$doc_block/o) {
@@ -1756,12 +1761,20 @@ sub process_file($) {
1756 $newcontents = $2; 1761 $newcontents = $2;
1757 1762
1758 if ($contents ne "") { 1763 if ($contents ne "") {
1764 if (!$in_doc_sect && $verbose) {
1765 print STDERR "Warning(${file}:$.): contents before sections\n";
1766 ++$warnings;
1767 }
1759 dump_section($section, xml_escape($contents)); 1768 dump_section($section, xml_escape($contents));
1760 $section = $section_default; 1769 $section = $section_default;
1761 } 1770 }
1762 1771
1772 $in_doc_sect = 1;
1763 $contents = $newcontents; 1773 $contents = $newcontents;
1764 if ($contents ne "") { 1774 if ($contents ne "") {
1775 if (substr($contents, 0, 1) eq " ") {
1776 $contents = substr($contents, 1);
1777 }
1765 $contents .= "\n"; 1778 $contents .= "\n";
1766 } 1779 }
1767 $section = $newsection; 1780 $section = $newsection;
@@ -1776,7 +1789,7 @@ sub process_file($) {
1776 $prototype = ""; 1789 $prototype = "";
1777 $state = 3; 1790 $state = 3;
1778 $brcount = 0; 1791 $brcount = 0;
1779# print STDERR "end of doc comment, looking for prototype\n"; 1792# print STDERR "end of doc comment, looking for prototype\n";
1780 } elsif (/$doc_content/) { 1793 } elsif (/$doc_content/) {
1781 # miguel-style comment kludge, look for blank lines after 1794 # miguel-style comment kludge, look for blank lines after
1782 # @parameter line to signify start of description 1795 # @parameter line to signify start of description
@@ -1793,7 +1806,7 @@ sub process_file($) {
1793 print STDERR "Warning(${file}:$.): bad line: $_"; 1806 print STDERR "Warning(${file}:$.): bad line: $_";
1794 ++$warnings; 1807 ++$warnings;
1795 } 1808 }
1796 } elsif ($state == 3) { # scanning for function { (end of prototype) 1809 } elsif ($state == 3) { # scanning for function '{' (end of prototype)
1797 if ($decl_type eq 'function') { 1810 if ($decl_type eq 'function') {
1798 process_state3_function($_, $file); 1811 process_state3_function($_, $file);
1799 } else { 1812 } else {