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; ...@@ -312,7 +312,15 @@ my $no_doc_sections = 0;
my @highlights = @highlights_man; my @highlights = @highlights_man;
my $blankline = $blankline_man; my $blankline = $blankline_man;
my $modulename = "Kernel API"; 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 $show_not_found = 0;
my @build_time; my @build_time;
...@@ -449,18 +457,18 @@ while ($ARGV[0] =~ m/^-(.*)/) { ...@@ -449,18 +457,18 @@ while ($ARGV[0] =~ m/^-(.*)/) {
} elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
$modulename = shift @ARGV; $modulename = shift @ARGV;
} elsif ($cmd eq "-function") { # to only output specific functions } elsif ($cmd eq "-function") { # to only output specific functions
$function_only = 1; $output_selection = OUTPUT_INCLUDE;
$function = shift @ARGV; $function = shift @ARGV;
$function_table{$function} = 1; $function_table{$function} = 1;
} elsif ($cmd eq "-nofunction") { # to only output specific functions } elsif ($cmd eq "-nofunction") { # output all except specific functions
$function_only = 2; $output_selection = OUTPUT_EXCLUDE;
$function = shift @ARGV; $function = shift @ARGV;
$function_table{$function} = 1; $function_table{$function} = 1;
} elsif ($cmd eq "-export") { # only exported symbols } elsif ($cmd eq "-export") { # only exported symbols
$function_only = 3; $output_selection = OUTPUT_EXPORTED;
%function_table = () %function_table = ()
} elsif ($cmd eq "-internal") { # only non-exported symbols } elsif ($cmd eq "-internal") { # only non-exported symbols
$function_only = 4; $output_selection = OUTPUT_INTERNAL;
%function_table = () %function_table = ()
} elsif ($cmd eq "-v") { } elsif ($cmd eq "-v") {
$verbose = 1; $verbose = 1;
...@@ -530,15 +538,17 @@ sub dump_doc_section { ...@@ -530,15 +538,17 @@ sub dump_doc_section {
return; return;
} }
if (($function_only == 0) || if (($output_selection == OUTPUT_ALL) ||
( $function_only == 1 && defined($function_table{$name})) || ($output_selection == OUTPUT_INCLUDE &&
( $function_only == 2 && !defined($function_table{$name}))) defined($function_table{$name})) ||
($output_selection == OUTPUT_EXCLUDE &&
!defined($function_table{$name})))
{ {
dump_section($file, $name, $contents); dump_section($file, $name, $contents);
output_blockhead({'sectionlist' => \@sectionlist, output_blockhead({'sectionlist' => \@sectionlist,
'sections' => \%sections, 'sections' => \%sections,
'module' => $modulename, 'module' => $modulename,
'content-only' => ($function_only != 0), }); 'content-only' => ($output_selection != OUTPUT_ALL), });
} }
} }
...@@ -1988,11 +1998,13 @@ sub output_declaration { ...@@ -1988,11 +1998,13 @@ sub output_declaration {
my $name = shift; my $name = shift;
my $functype = shift; my $functype = shift;
my $func = "output_${functype}_$output_mode"; my $func = "output_${functype}_$output_mode";
if (($function_only==0) || if (($output_selection == OUTPUT_ALL) ||
( ($function_only == 1 || $function_only == 3) && (($output_selection == OUTPUT_INCLUDE ||
defined($function_table{$name})) || $output_selection == OUTPUT_EXPORTED) &&
( ($function_only == 2 || $function_only == 4) && defined($function_table{$name})) ||
!($functype eq "function" && defined($function_table{$name})))) (($output_selection == OUTPUT_EXCLUDE ||
$output_selection == OUTPUT_INTERNAL) &&
!($functype eq "function" && defined($function_table{$name}))))
{ {
&$func(@_); &$func(@_);
$section_counter++; $section_counter++;
...@@ -2696,7 +2708,8 @@ sub process_file($) { ...@@ -2696,7 +2708,8 @@ sub process_file($) {
} }
# two passes for -export and -internal # two passes for -export and -internal
if ($function_only == 3 || $function_only == 4) { if ($output_selection == OUTPUT_EXPORTED ||
$output_selection == OUTPUT_INTERNAL) {
while (<IN>) { while (<IN>) {
if (/$export_symbol/o) { if (/$export_symbol/o) {
$function_table{$2} = 1; $function_table{$2} = 1;
...@@ -2929,7 +2942,7 @@ sub process_file($) { ...@@ -2929,7 +2942,7 @@ sub process_file($) {
} }
if ($initial_section_counter == $section_counter) { if ($initial_section_counter == $section_counter) {
print STDERR "${file}:1: warning: no structured comments found\n"; 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; print STDERR " Was looking for '$_'.\n" for keys %function_table;
} }
if ($output_mode eq "xml") { 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