diff options
| author | Johannes Weiner <hannes@cmpxchg.org> | 2009-09-17 22:26:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-18 12:48:52 -0400 |
| commit | 6423133bdee0e07d1c2f8411cb3fe676c207ba33 (patch) | |
| tree | b50ee9b09359d9556542b08b5b4b1d63ac47bd53 | |
| parent | 27f5de7963f46388932472b660f2f9a86ab58454 (diff) | |
kernel-doc: allow multi-line declaration purpose descriptions
Allow the short description after symbol name and dash in a kernel-doc
comment to span multiple lines, e.g. like this:
/**
* unmap_mapping_range - unmap the portion of all mmaps in the
* specified address_space corresponding to the specified
* page range in the underlying file.
* @mapping: the address space containing mmaps to be unmapped.
* ...
*/
The short description ends with a parameter description, an empty line
or the end of the comment block.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | Documentation/kernel-doc-nano-HOWTO.txt | 4 | ||||
| -rwxr-xr-x | scripts/kernel-doc | 21 |
2 files changed, 19 insertions, 6 deletions
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt index 4d04572b6549..348b9e5e28fc 100644 --- a/Documentation/kernel-doc-nano-HOWTO.txt +++ b/Documentation/kernel-doc-nano-HOWTO.txt | |||
| @@ -66,7 +66,9 @@ Example kernel-doc function comment: | |||
| 66 | * The longer description can have multiple paragraphs. | 66 | * The longer description can have multiple paragraphs. |
| 67 | */ | 67 | */ |
| 68 | 68 | ||
| 69 | The first line, with the short description, must be on a single line. | 69 | The short description following the subject can span multiple lines |
| 70 | and ends with an @argument description, an empty line or the end of | ||
| 71 | the comment block. | ||
| 70 | 72 | ||
| 71 | The @argument descriptions must begin on the very next line following | 73 | The @argument descriptions must begin on the very next line following |
| 72 | this opening short function description line, with no intervening | 74 | this opening short function description line, with no intervening |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index b52d340d759d..ea9f8a58678f 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -1995,6 +1995,7 @@ sub process_file($) { | |||
| 1995 | my $identifier; | 1995 | my $identifier; |
| 1996 | my $func; | 1996 | my $func; |
| 1997 | my $descr; | 1997 | my $descr; |
| 1998 | my $in_purpose = 0; | ||
| 1998 | my $initial_section_counter = $section_counter; | 1999 | my $initial_section_counter = $section_counter; |
| 1999 | 2000 | ||
| 2000 | if (defined($ENV{'SRCTREE'})) { | 2001 | if (defined($ENV{'SRCTREE'})) { |
| @@ -2044,6 +2045,7 @@ sub process_file($) { | |||
| 2044 | $descr =~ s/\s*$//; | 2045 | $descr =~ s/\s*$//; |
| 2045 | $descr =~ s/\s+/ /; | 2046 | $descr =~ s/\s+/ /; |
| 2046 | $declaration_purpose = xml_escape($descr); | 2047 | $declaration_purpose = xml_escape($descr); |
| 2048 | $in_purpose = 1; | ||
| 2047 | } else { | 2049 | } else { |
| 2048 | $declaration_purpose = ""; | 2050 | $declaration_purpose = ""; |
| 2049 | } | 2051 | } |
| @@ -2090,6 +2092,7 @@ sub process_file($) { | |||
| 2090 | } | 2092 | } |
| 2091 | 2093 | ||
| 2092 | $in_doc_sect = 1; | 2094 | $in_doc_sect = 1; |
| 2095 | $in_purpose = 0; | ||
| 2093 | $contents = $newcontents; | 2096 | $contents = $newcontents; |
| 2094 | if ($contents ne "") { | 2097 | if ($contents ne "") { |
| 2095 | while ((substr($contents, 0, 1) eq " ") || | 2098 | while ((substr($contents, 0, 1) eq " ") || |
| @@ -2119,11 +2122,19 @@ sub process_file($) { | |||
| 2119 | } elsif (/$doc_content/) { | 2122 | } elsif (/$doc_content/) { |
| 2120 | # miguel-style comment kludge, look for blank lines after | 2123 | # miguel-style comment kludge, look for blank lines after |
| 2121 | # @parameter line to signify start of description | 2124 | # @parameter line to signify start of description |
| 2122 | if ($1 eq "" && | 2125 | if ($1 eq "") { |
| 2123 | ($section =~ m/^@/ || $section eq $section_context)) { | 2126 | if ($section =~ m/^@/ || $section eq $section_context) { |
| 2124 | dump_section($file, $section, xml_escape($contents)); | 2127 | dump_section($file, $section, xml_escape($contents)); |
| 2125 | $section = $section_default; | 2128 | $section = $section_default; |
| 2126 | $contents = ""; | 2129 | $contents = ""; |
| 2130 | } else { | ||
| 2131 | $contents .= "\n"; | ||
| 2132 | } | ||
| 2133 | $in_purpose = 0; | ||
| 2134 | } elsif ($in_purpose == 1) { | ||
| 2135 | # Continued declaration purpose | ||
| 2136 | chomp($declaration_purpose); | ||
| 2137 | $declaration_purpose .= " " . xml_escape($1); | ||
| 2127 | } else { | 2138 | } else { |
| 2128 | $contents .= $1 . "\n"; | 2139 | $contents .= $1 . "\n"; |
| 2129 | } | 2140 | } |
