aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc44
1 files changed, 37 insertions, 7 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 9d3eafea58f0..bd29a92b4b48 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -58,6 +58,7 @@ Output format selection (mutually exclusive):
58 -man Output troff manual page format. This is the default. 58 -man Output troff manual page format. This is the default.
59 -rst Output reStructuredText format. 59 -rst Output reStructuredText format.
60 -text Output plain text format. 60 -text Output plain text format.
61 -none Do not output documentation, only warnings.
61 62
62Output selection (mutually exclusive): 63Output selection (mutually exclusive):
63 -export Only output documentation for symbols that have been 64 -export Only output documentation for symbols that have been
@@ -532,6 +533,8 @@ while ($ARGV[0] =~ m/^-(.*)/) {
532 $output_mode = "gnome"; 533 $output_mode = "gnome";
533 @highlights = @highlights_gnome; 534 @highlights = @highlights_gnome;
534 $blankline = $blankline_gnome; 535 $blankline = $blankline_gnome;
536 } elsif ($cmd eq "-none") {
537 $output_mode = "none";
535 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 538 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
536 $modulename = shift @ARGV; 539 $modulename = shift @ARGV;
537 } elsif ($cmd eq "-function") { # to only output specific functions 540 } elsif ($cmd eq "-function") { # to only output specific functions
@@ -2117,6 +2120,24 @@ sub output_blockhead_list(%) {
2117 } 2120 }
2118} 2121}
2119 2122
2123
2124## none mode output functions
2125
2126sub output_function_none(%) {
2127}
2128
2129sub output_enum_none(%) {
2130}
2131
2132sub output_typedef_none(%) {
2133}
2134
2135sub output_struct_none(%) {
2136}
2137
2138sub output_blockhead_none(%) {
2139}
2140
2120## 2141##
2121# generic output function for all types (function, struct/union, typedef, enum); 2142# generic output function for all types (function, struct/union, typedef, enum);
2122# calls the generated, variable output_ function name based on 2143# calls the generated, variable output_ function name based on
@@ -2168,7 +2189,7 @@ sub dump_struct($$) {
2168 my $nested; 2189 my $nested;
2169 2190
2170 if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) { 2191 if ($x =~ /(struct|union)\s+(\w+)\s*{(.*)}/) {
2171 #my $decl_type = $1; 2192 my $decl_type = $1;
2172 $declaration_name = $2; 2193 $declaration_name = $2;
2173 my $members = $3; 2194 my $members = $3;
2174 2195
@@ -2182,8 +2203,6 @@ sub dump_struct($$) {
2182 # strip comments: 2203 # strip comments:
2183 $members =~ s/\/\*.*?\*\///gos; 2204 $members =~ s/\/\*.*?\*\///gos;
2184 $nested =~ s/\/\*.*?\*\///gos; 2205 $nested =~ s/\/\*.*?\*\///gos;
2185 # strip kmemcheck_bitfield_{begin,end}.*;
2186 $members =~ s/kmemcheck_bitfield_.*?;//gos;
2187 # strip attributes 2206 # strip attributes
2188 $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i; 2207 $members =~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i;
2189 $members =~ s/__aligned\s*\([^;]*\)//gos; 2208 $members =~ s/__aligned\s*\([^;]*\)//gos;
@@ -2194,7 +2213,7 @@ sub dump_struct($$) {
2194 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos; 2213 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+), ([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
2195 2214
2196 create_parameterlist($members, ';', $file); 2215 create_parameterlist($members, ';', $file);
2197 check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested); 2216 check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_actual, $nested);
2198 2217
2199 output_declaration($declaration_name, 2218 output_declaration($declaration_name,
2200 'struct', 2219 'struct',
@@ -2226,6 +2245,8 @@ sub dump_enum($$) {
2226 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) { 2245 if ($x =~ /enum\s+(\w+)\s*{(.*)}/) {
2227 $declaration_name = $1; 2246 $declaration_name = $1;
2228 my $members = $2; 2247 my $members = $2;
2248 my %_members;
2249
2229 $members =~ s/\s+$//; 2250 $members =~ s/\s+$//;
2230 2251
2231 foreach my $arg (split ',', $members) { 2252 foreach my $arg (split ',', $members) {
@@ -2236,9 +2257,16 @@ sub dump_enum($$) {
2236 print STDERR "${file}:$.: warning: Enum value '$arg' ". 2257 print STDERR "${file}:$.: warning: Enum value '$arg' ".
2237 "not described in enum '$declaration_name'\n"; 2258 "not described in enum '$declaration_name'\n";
2238 } 2259 }
2239 2260 $_members{$arg} = 1;
2240 } 2261 }
2241 2262
2263 while (my ($k, $v) = each %parameterdescs) {
2264 if (!exists($_members{$k})) {
2265 print STDERR "${file}:$.: warning: Excess enum value " .
2266 "'$k' description in '$declaration_name'\n";
2267 }
2268 }
2269
2242 output_declaration($declaration_name, 2270 output_declaration($declaration_name,
2243 'enum', 2271 'enum',
2244 {'enum' => $declaration_name, 2272 {'enum' => $declaration_name,
@@ -2506,7 +2534,7 @@ sub check_sections($$$$$$) {
2506 } else { 2534 } else {
2507 if ($nested !~ m/\Q$sects[$sx]\E/) { 2535 if ($nested !~ m/\Q$sects[$sx]\E/) {
2508 print STDERR "${file}:$.: warning: " . 2536 print STDERR "${file}:$.: warning: " .
2509 "Excess struct/union/enum/typedef member " . 2537 "Excess $decl_type member " .
2510 "'$sects[$sx]' " . 2538 "'$sects[$sx]' " .
2511 "description in '$decl_name'\n"; 2539 "description in '$decl_name'\n";
2512 ++$warnings; 2540 ++$warnings;
@@ -3136,7 +3164,9 @@ sub process_file($) {
3136 } 3164 }
3137 } 3165 }
3138 if ($initial_section_counter == $section_counter) { 3166 if ($initial_section_counter == $section_counter) {
3139 print STDERR "${file}:1: warning: no structured comments found\n"; 3167 if ($output_mode ne "none") {
3168 print STDERR "${file}:1: warning: no structured comments found\n";
3169 }
3140 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) { 3170 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) {
3141 print STDERR " Was looking for '$_'.\n" for keys %function_table; 3171 print STDERR " Was looking for '$_'.\n" for keys %function_table;
3142 } 3172 }