History

scripts/kernel-doc: drop dead code for Wcontents_before_sections

There is a warning about contents before sections, which doesn't work, since in_doc_sect variable is always true at the point it is checked. Drop the dead code.

Mauro Carvalho Chehab committed 1 year ago

Commit 19b100b1 parent b9609ec1 file · +0 −11Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/kernel-doc+0−11
@@ -137,7 +137,6 @@ my $verbose = 0; · 136 unmodified lines
137my $Werror = 0;137my $Werror = 0;
138my $Wreturn = 0;138my $Wreturn = 0;
139my $Wshort_desc = 0;139my $Wshort_desc = 0;
140my $Wcontents_before_sections = 0;
141my $output_mode = "rst";140my $output_mode = "rst";
142my $output_preformatted = 0;141my $output_preformatted = 0;
143my $no_doc_sections = 0;142my $no_doc_sections = 0;
@@ -223,7 +222,6 @@ use constant { · 79 unmodified lines
223 STATE_INLINE => 7, # gathering doc outside main block222 STATE_INLINE => 7, # gathering doc outside main block
224};223};
225my $state;224my $state;
226my $in_doc_sect;
227my $leading_space;225my $leading_space;
228 226
229# Inline documentation state227# Inline documentation state
@@ -332,12 +330,9 @@ while ($ARGV[0] =~ m/^--?(.*)/) { · 102 unmodified lines
332 $Wreturn = 1;330 $Wreturn = 1;
333 } elsif ($cmd eq "Wshort-desc" or $cmd eq "Wshort-description") {331 } elsif ($cmd eq "Wshort-desc" or $cmd eq "Wshort-description") {
334 $Wshort_desc = 1;332 $Wshort_desc = 1;
335 } elsif ($cmd eq "Wcontents-before-sections") {
336 $Wcontents_before_sections = 1;
337 } elsif ($cmd eq "Wall") {333 } elsif ($cmd eq "Wall") {
338 $Wreturn = 1;334 $Wreturn = 1;
339 $Wshort_desc = 1;335 $Wshort_desc = 1;
340 $Wcontents_before_sections = 1;
341 } elsif (($cmd eq "h") || ($cmd eq "help")) {336 } elsif (($cmd eq "h") || ($cmd eq "help")) {
342 pod2usage(-exitval => 0, -verbose => 2);337 pod2usage(-exitval => 0, -verbose => 2);
343 } elsif ($cmd eq 'no-doc-sections') {338 } elsif ($cmd eq 'no-doc-sections') {
@@ -1963,7 +1958,6 @@ sub process_export_file($) { · 1619 unmodified lines
1963sub process_normal() {1958sub process_normal() {
1964 if (/$doc_start/o) {1959 if (/$doc_start/o) {
1965 $state = STATE_NAME; # next line is always the function name1960 $state = STATE_NAME; # next line is always the function name
1966 $in_doc_sect = 0;
1967 $declaration_start_line = $. + 1;1961 $declaration_start_line = $. + 1;
1968 }1962 }
1969}1963}
@@ -2068,7 +2062,6 @@ sub process_body($$) { · 98 unmodified lines
2068 }2062 }
2069 2063
2070 if (/$doc_sect/i) { # case insensitive for supported section names2064 if (/$doc_sect/i) { # case insensitive for supported section names
2071 $in_doc_sect = 1;
2072 $newsection = $1;2065 $newsection = $1;
2073 $newcontents = $2;2066 $newcontents = $2;
2074 2067
@@ -2085,14 +2078,10 @@ sub process_body($$) { · 10 unmodified lines
2085 }2078 }
2086 2079
2087 if (($contents ne "") && ($contents ne "\n")) {2080 if (($contents ne "") && ($contents ne "\n")) {
2088 if (!$in_doc_sect && $Wcontents_before_sections) {
2089 emit_warning("${file}:$.", "contents before sections\n");
2090 }
2091 dump_section($file, $section, $contents);2081 dump_section($file, $section, $contents);
2092 $section = $section_default;2082 $section = $section_default;
2093 }2083 }
2094 2084
2095 $in_doc_sect = 1;
2096 $state = STATE_BODY;2085 $state = STATE_BODY;
2097 $contents = $newcontents;2086 $contents = $newcontents;
2098 $new_start_line = $.;2087 $new_start_line = $.;