Right now, the build system doesn't use -nofunction, as it is pretty much useless, because it doesn't consider the other output modes (extern, internal), working only with all. Also, it is limited to exclude functions. Re-implement it in order to allow excluding any symbols from the document output, no matter what mode is used. The parameter was also renamed to "-nosymbol", as it express better its meaning.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -66,9 +66,8 @@ Output selection (mutually exclusive): · 65 unmodified lines | ||
| 66 | 66 | -function NAME Only output documentation for the given function(s) |
| 67 | 67 | or DOC: section title(s). All other functions and DOC: |
| 68 | 68 | sections are ignored. May be specified multiple times. |
| 69 | − -nofunction NAME Do NOT output documentation for the given function(s); | |
| 70 | − only output documentation for the other functions and | |
| 71 | − DOC: sections. May be specified multiple times. | |
| 69 | + -nosymbol NAME Exclude the specified symbols from the output | |
| 70 | + documentation. May be specified multiple times. | |
| 72 | 71 | |
| 73 | 72 | Output selection modifiers: |
| 74 | 73 | -no-doc-sections Do not output DOC: sections. |
| @@ -288,9 +287,8 @@ my $modulename = "Kernel API"; · 213 unmodified lines | ||
| 288 | 287 | use constant { |
| 289 | 288 | OUTPUT_ALL => 0, # output all symbols and doc sections |
| 290 | 289 | OUTPUT_INCLUDE => 1, # output only specified symbols |
| 291 | − OUTPUT_EXCLUDE => 2, # output everything except specified symbols | |
| 292 | − OUTPUT_EXPORTED => 3, # output exported symbols | |
| 293 | − OUTPUT_INTERNAL => 4, # output non-exported symbols | |
| 290 | + OUTPUT_EXPORTED => 2, # output exported symbols | |
| 291 | + OUTPUT_INTERNAL => 3, # output non-exported symbols | |
| 294 | 292 | }; |
| 295 | 293 | my $output_selection = OUTPUT_ALL; |
| 296 | 294 | my $show_not_found = 0; # No longer used |
| @@ -315,6 +313,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June', · 18 unmodified lines | ||
| 315 | 313 | # CAVEAT EMPTOR! Some of the others I localised may not want to be, which |
| 316 | 314 | # could cause "use of undefined value" or other bugs. |
| 317 | 315 | my ($function, %function_table, %parametertypes, $declaration_purpose); |
| 316 | +my %nosymbol_table = (); | |
| 318 | 317 | my $declaration_start_line; |
| 319 | 318 | my ($type, $declaration_name, $return_type); |
| 320 | 319 | my ($newsection, $newcontents, $prototype, $brcount, %source_map); |
| @@ -434,10 +433,9 @@ while ($ARGV[0] =~ m/^--?(.*)/) { · 113 unmodified lines | ||
| 434 | 433 | $output_selection = OUTPUT_INCLUDE; |
| 435 | 434 | $function = shift @ARGV; |
| 436 | 435 | $function_table{$function} = 1; |
| 437 | − } elsif ($cmd eq "nofunction") { # output all except specific functions | |
| 438 | − $output_selection = OUTPUT_EXCLUDE; | |
| 439 | − $function = shift @ARGV; | |
| 440 | − $function_table{$function} = 1; | |
| 436 | + } elsif ($cmd eq "nosymbol") { # Exclude specific symbols | |
| 437 | + my $symbol = shift @ARGV; | |
| 438 | + $nosymbol_table{$symbol} = 1; | |
| 441 | 439 | } elsif ($cmd eq "export") { # only exported symbols |
| 442 | 440 | $output_selection = OUTPUT_EXPORTED; |
| 443 | 441 | %function_table = (); |
| @@ -570,11 +568,11 @@ sub dump_doc_section { · 126 unmodified lines | ||
| 570 | 568 | return; |
| 571 | 569 | } |
| 572 | 570 | |
| 571 | + return if (defined($nosymbol_table{$name})); | |
| 572 | + | |
| 573 | 573 | if (($output_selection == OUTPUT_ALL) || |
| 574 | − ($output_selection == OUTPUT_INCLUDE && | |
| 575 | − defined($function_table{$name})) || | |
| 576 | − ($output_selection == OUTPUT_EXCLUDE && | |
| 577 | − !defined($function_table{$name}))) | |
| 574 | + (($output_selection == OUTPUT_INCLUDE) && | |
| 575 | + defined($function_table{$name}))) | |
| 578 | 576 | { |
| 579 | 577 | dump_section($file, $name, $contents); |
| 580 | 578 | output_blockhead({'sectionlist' => \@sectionlist, |
| @@ -800,6 +798,8 @@ sub output_blockhead_rst(%) { · 219 unmodified lines | ||
| 800 | 798 | my ($parameter, $section); |
| 801 | 799 | |
| 802 | 800 | foreach $section (@{$args{'sectionlist'}}) { |
| 801 | + next if (defined($nosymbol_table{$section})); | |
| 802 | + | |
| 803 | 803 | if ($output_selection != OUTPUT_INCLUDE) { |
| 804 | 804 | print "**$section**\n\n"; |
| 805 | 805 | } |
| @@ -1115,12 +1115,14 @@ sub output_declaration { · 309 unmodified lines | ||
| 1115 | 1115 | my $name = shift; |
| 1116 | 1116 | my $functype = shift; |
| 1117 | 1117 | my $func = "output_${functype}_$output_mode"; |
| 1118 | + | |
| 1119 | + return if (defined($nosymbol_table{$name})); | |
| 1120 | + | |
| 1118 | 1121 | if (($output_selection == OUTPUT_ALL) || |
| 1119 | 1122 | (($output_selection == OUTPUT_INCLUDE || |
| 1120 | 1123 | $output_selection == OUTPUT_EXPORTED) && |
| 1121 | 1124 | defined($function_table{$name})) || |
| 1122 | − (($output_selection == OUTPUT_EXCLUDE || | |
| 1123 | − $output_selection == OUTPUT_INTERNAL) && | |
| 1125 | + ($output_selection == OUTPUT_INTERNAL && | |
| 1124 | 1126 | !($functype eq "function" && defined($function_table{$name})))) |
| 1125 | 1127 | { |
| 1126 | 1128 | &$func(@_); |
| @@ -1301,6 +1303,8 @@ sub show_warnings($$) { · 174 unmodified lines | ||
| 1301 | 1303 | my $functype = shift; |
| 1302 | 1304 | my $name = shift; |
| 1303 | 1305 | |
| 1306 | + return 0 if (defined($nosymbol_table{$name})); | |
| 1307 | + | |
| 1304 | 1308 | return 1 if ($output_selection == OUTPUT_ALL); |
| 1305 | 1309 | |
| 1306 | 1310 | if ($output_selection == OUTPUT_EXPORTED) { |
| @@ -1324,13 +1328,6 @@ sub show_warnings($$) { · 17 unmodified lines | ||
| 1324 | 1328 | return 0; |
| 1325 | 1329 | } |
| 1326 | 1330 | } |
| 1327 | − if ($output_selection == OUTPUT_EXCLUDE) { | |
| 1328 | − if (!defined($function_table{$name})) { | |
| 1329 | − return 1; | |
| 1330 | − } else { | |
| 1331 | − return 0; | |
| 1332 | − } | |
| 1333 | − } | |
| 1334 | 1331 | die("Please add the new output type at show_warnings()"); |
| 1335 | 1332 | } |
| 1336 | 1333 | |
| @@ -1952,6 +1949,7 @@ sub process_export_file($) { · 615 unmodified lines | ||
| 1952 | 1949 | |
| 1953 | 1950 | while (<IN>) { |
| 1954 | 1951 | if (/$export_symbol/) { |
| 1952 | + next if (defined($nosymbol_table{$2})); | |
| 1955 | 1953 | $function_table{$2} = 1; |
| 1956 | 1954 | } |
| 1957 | 1955 | } |