Commit b6c3f456 authored by Jani Nikula's avatar Jani Nikula

kernel-doc: add names for output selection

Make the output selection a bit more readable by adding constants for
the various types of output selection. While at it, actually call the
variable for choosing what to output $output_selection.

No functional changes.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 48af606a
......@@ -312,7 +312,15 @@ my $no_doc_sections = 0;
my @highlights = @highlights_man;
my $blankline = $blankline_man;
my $modulename = "Kernel API";
my $function_only = 0;
use constant {
OUTPUT_ALL => 0, # output all symbols and doc sections
OUTPUT_INCLUDE => 1, # output only specified symbols
OUTPUT_EXCLUDE => 2, # output everything except specified symbols
OUTPUT_EXPORTED => 3, # output exported symbols
OUTPUT_INTERNAL => 4, # output non-exported symbols
};
my $output_selection = OUTPUT_ALL;
my $show_not_found = 0;
my @build_time;
......@@ -449,18 +457,18 @@ while ($ARGV[0] =~ m/^-(.*)/) {
} elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
$modulename = shift @ARGV;
} elsif ($cmd eq "-function") { # to only output specific functions
$function_only = 1;
$output_selection = OUTPUT_INCLUDE;
$function = shift @ARGV;
$function_table{$function} = 1;
} elsif ($cmd eq "-nofunction") { # to only output specific functions
$function_only = 2;
} elsif ($cmd eq "-nofunction") { # output all except specific functions
$output_selection = OUTPUT_EXCLUDE;
$function = shift @ARGV;
$function_table{$function} = 1;
} elsif ($cmd eq "-export") { # only exported symbols
$function_only = 3;
$output_selection = OUTPUT_EXPORTED;
%function_table = ()
} elsif ($cmd eq "-internal") { # only non-exported symbols
$function_only = 4;
$output_selection = OUTPUT_INTERNAL;
%function_table = ()
} elsif ($cmd eq "-v") {
$verbose = 1;
......@@ -530,15 +538,17 @@ sub dump_doc_section {
return;
}
if (($function_only == 0) ||
( $function_only == 1 && defined($function_table{$name})) ||
( $function_only == 2 && !defined($function_table{$name})))
if (($output_selection == OUTPUT_ALL) ||
($output_selection == OUTPUT_INCLUDE &&
defined($function_table{$name})) ||
($output_selection == OUTPUT_EXCLUDE &&
!defined($function_table{$name})))
{
dump_section($file, $name, $contents);
output_blockhead({'sectionlist' => \@sectionlist,
'sections' => \%sections,
'module' => $modulename,
'content-only' => ($function_only != 0), });
'content-only' => ($output_selection != OUTPUT_ALL), });
}
}
......@@ -1988,10 +1998,12 @@ sub output_declaration {
my $name = shift;
my $functype = shift;
my $func = "output_${functype}_$output_mode";
if (($function_only==0) ||
( ($function_only == 1 || $function_only == 3) &&
if (($output_selection == OUTPUT_ALL) ||
(($output_selection == OUTPUT_INCLUDE ||
$output_selection == OUTPUT_EXPORTED) &&
defined($function_table{$name})) ||
( ($function_only == 2 || $function_only == 4) &&
(($output_selection == OUTPUT_EXCLUDE ||
$output_selection == OUTPUT_INTERNAL) &&
!($functype eq "function" && defined($function_table{$name}))))
{
&$func(@_);
......@@ -2696,7 +2708,8 @@ sub process_file($) {
}
# two passes for -export and -internal
if ($function_only == 3 || $function_only == 4) {
if ($output_selection == OUTPUT_EXPORTED ||
$output_selection == OUTPUT_INTERNAL) {
while (<IN>) {
if (/$export_symbol/o) {
$function_table{$2} = 1;
......@@ -2929,7 +2942,7 @@ sub process_file($) {
}
if ($initial_section_counter == $section_counter) {
print STDERR "${file}:1: warning: no structured comments found\n";
if (($function_only == 1) && ($show_not_found == 1)) {
if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) {
print STDERR " Was looking for '$_'.\n" for keys %function_table;
}
if ($output_mode eq "xml") {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment