aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2016-05-29 15:19:35 -0400
committerJani Nikula <jani.nikula@intel.com>2016-05-30 06:38:55 -0400
commitb6c3f456cfed53e9f06f431270c9dcd52010785e (patch)
treed0ee0b7c1ebc8ac9c993e31a6994b104345a0c26 /scripts/kernel-doc
parent48af606ad8912f90e1539621a26e86672976d8ae (diff)
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: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc47
1 files changed, 30 insertions, 17 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index cb5fd248ac57..dd08944b0a6f 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -312,7 +312,15 @@ my $no_doc_sections = 0;
312my @highlights = @highlights_man; 312my @highlights = @highlights_man;
313my $blankline = $blankline_man; 313my $blankline = $blankline_man;
314my $modulename = "Kernel API"; 314my $modulename = "Kernel API";
315my $function_only = 0; 315
316use constant {
317 OUTPUT_ALL => 0, # output all symbols and doc sections
318 OUTPUT_INCLUDE => 1, # output only specified symbols
319 OUTPUT_EXCLUDE => 2, # output everything except specified symbols
320 OUTPUT_EXPORTED => 3, # output exported symbols
321 OUTPUT_INTERNAL => 4, # output non-exported symbols
322};
323my $output_selection = OUTPUT_ALL;
316my $show_not_found = 0; 324my $show_not_found = 0;
317 325
318my @build_time; 326my @build_time;
@@ -449,18 +457,18 @@ while ($ARGV[0] =~ m/^-(.*)/) {
449 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document 457 } elsif ($cmd eq "-module") { # not needed for XML, inherits from calling document
450 $modulename = shift @ARGV; 458 $modulename = shift @ARGV;
451 } elsif ($cmd eq "-function") { # to only output specific functions 459 } elsif ($cmd eq "-function") { # to only output specific functions
452 $function_only = 1; 460 $output_selection = OUTPUT_INCLUDE;
453 $function = shift @ARGV; 461 $function = shift @ARGV;
454 $function_table{$function} = 1; 462 $function_table{$function} = 1;
455 } elsif ($cmd eq "-nofunction") { # to only output specific functions 463 } elsif ($cmd eq "-nofunction") { # output all except specific functions
456 $function_only = 2; 464 $output_selection = OUTPUT_EXCLUDE;
457 $function = shift @ARGV; 465 $function = shift @ARGV;
458 $function_table{$function} = 1; 466 $function_table{$function} = 1;
459 } elsif ($cmd eq "-export") { # only exported symbols 467 } elsif ($cmd eq "-export") { # only exported symbols
460 $function_only = 3; 468 $output_selection = OUTPUT_EXPORTED;
461 %function_table = () 469 %function_table = ()
462 } elsif ($cmd eq "-internal") { # only non-exported symbols 470 } elsif ($cmd eq "-internal") { # only non-exported symbols
463 $function_only = 4; 471 $output_selection = OUTPUT_INTERNAL;
464 %function_table = () 472 %function_table = ()
465 } elsif ($cmd eq "-v") { 473 } elsif ($cmd eq "-v") {
466 $verbose = 1; 474 $verbose = 1;
@@ -530,15 +538,17 @@ sub dump_doc_section {
530 return; 538 return;
531 } 539 }
532 540
533 if (($function_only == 0) || 541 if (($output_selection == OUTPUT_ALL) ||
534 ( $function_only == 1 && defined($function_table{$name})) || 542 ($output_selection == OUTPUT_INCLUDE &&
535 ( $function_only == 2 && !defined($function_table{$name}))) 543 defined($function_table{$name})) ||
544 ($output_selection == OUTPUT_EXCLUDE &&
545 !defined($function_table{$name})))
536 { 546 {
537 dump_section($file, $name, $contents); 547 dump_section($file, $name, $contents);
538 output_blockhead({'sectionlist' => \@sectionlist, 548 output_blockhead({'sectionlist' => \@sectionlist,
539 'sections' => \%sections, 549 'sections' => \%sections,
540 'module' => $modulename, 550 'module' => $modulename,
541 'content-only' => ($function_only != 0), }); 551 'content-only' => ($output_selection != OUTPUT_ALL), });
542 } 552 }
543} 553}
544 554
@@ -1988,11 +1998,13 @@ sub output_declaration {
1988 my $name = shift; 1998 my $name = shift;
1989 my $functype = shift; 1999 my $functype = shift;
1990 my $func = "output_${functype}_$output_mode"; 2000 my $func = "output_${functype}_$output_mode";
1991 if (($function_only==0) || 2001 if (($output_selection == OUTPUT_ALL) ||
1992 ( ($function_only == 1 || $function_only == 3) && 2002 (($output_selection == OUTPUT_INCLUDE ||
1993 defined($function_table{$name})) || 2003 $output_selection == OUTPUT_EXPORTED) &&
1994 ( ($function_only == 2 || $function_only == 4) && 2004 defined($function_table{$name})) ||
1995 !($functype eq "function" && defined($function_table{$name})))) 2005 (($output_selection == OUTPUT_EXCLUDE ||
2006 $output_selection == OUTPUT_INTERNAL) &&
2007 !($functype eq "function" && defined($function_table{$name}))))
1996 { 2008 {
1997 &$func(@_); 2009 &$func(@_);
1998 $section_counter++; 2010 $section_counter++;
@@ -2696,7 +2708,8 @@ sub process_file($) {
2696 } 2708 }
2697 2709
2698 # two passes for -export and -internal 2710 # two passes for -export and -internal
2699 if ($function_only == 3 || $function_only == 4) { 2711 if ($output_selection == OUTPUT_EXPORTED ||
2712 $output_selection == OUTPUT_INTERNAL) {
2700 while (<IN>) { 2713 while (<IN>) {
2701 if (/$export_symbol/o) { 2714 if (/$export_symbol/o) {
2702 $function_table{$2} = 1; 2715 $function_table{$2} = 1;
@@ -2929,7 +2942,7 @@ sub process_file($) {
2929 } 2942 }
2930 if ($initial_section_counter == $section_counter) { 2943 if ($initial_section_counter == $section_counter) {
2931 print STDERR "${file}:1: warning: no structured comments found\n"; 2944 print STDERR "${file}:1: warning: no structured comments found\n";
2932 if (($function_only == 1) && ($show_not_found == 1)) { 2945 if (($output_selection == OUTPUT_INCLUDE) && ($show_not_found == 1)) {
2933 print STDERR " Was looking for '$_'.\n" for keys %function_table; 2946 print STDERR " Was looking for '$_'.\n" for keys %function_table;
2934 } 2947 }
2935 if ($output_mode eq "xml") { 2948 if ($output_mode eq "xml") {