History

scripts: kernel-doc: fix typedef identification

Some typedef expressions are output as normal functions. As we need to be clearer about the type with Sphinx 3.x, detect such cases. While here, fix a wrongly-indented block.

Mauro Carvalho Chehab committed 6 years ago

Commit 47bcacf1 parent eab795d1 file · +41 −23Browse files

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

Unified · Split

scripts/kernel-doc+41−23
@@ -1748,30 +1748,48 @@ sub dump_function($$) { · 1747 unmodified lines
17481748 return;
17491749 }
17501750
1751− my $prms = join " ", @parameterlist;
1752− check_sections($file, $declaration_name, "function", $sectcheck, $prms);
1753−
1754− # This check emits a lot of warnings at the moment, because many
1755− # functions don't have a 'Return' doc section. So until the number
1756− # of warnings goes sufficiently down, the check is only performed in
1757− # verbose mode.
1758− # TODO: always perform the check.
1759− if ($verbose && !$noret) {
1760− check_return_section($file, $declaration_name, $return_type);
1761− }
1751+ my $prms = join " ", @parameterlist;
1752+ check_sections($file, $declaration_name, "function", $sectcheck, $prms);
1753+
1754+ # This check emits a lot of warnings at the moment, because many
1755+ # functions don't have a 'Return' doc section. So until the number
1756+ # of warnings goes sufficiently down, the check is only performed in
1757+ # verbose mode.
1758+ # TODO: always perform the check.
1759+ if ($verbose && !$noret) {
1760+ check_return_section($file, $declaration_name, $return_type);
1761+ }
17621762
1763− output_declaration($declaration_name,
1764− 'function',
1765− {'function' => $declaration_name,
1766− 'module' => $modulename,
1767− 'functiontype' => $return_type,
1768− 'parameterlist' => \@parameterlist,
1769− 'parameterdescs' => \%parameterdescs,
1770− 'parametertypes' => \%parametertypes,
1771− 'sectionlist' => \@sectionlist,
1772− 'sections' => \%sections,
1773− 'purpose' => $declaration_purpose
1774− });
1763+ # The function parser can be called with a typedef parameter.
1764+ # Handle it.
1765+ if ($return_type =~ /typedef/) {
1766+ output_declaration($declaration_name,
1767+ 'function',
1768+ {'function' => $declaration_name,
1769+ 'typedef' => 1,
1770+ 'module' => $modulename,
1771+ 'functiontype' => $return_type,
1772+ 'parameterlist' => \@parameterlist,
1773+ 'parameterdescs' => \%parameterdescs,
1774+ 'parametertypes' => \%parametertypes,
1775+ 'sectionlist' => \@sectionlist,
1776+ 'sections' => \%sections,
1777+ 'purpose' => $declaration_purpose
1778+ });
1779+ } else {
1780+ output_declaration($declaration_name,
1781+ 'function',
1782+ {'function' => $declaration_name,
1783+ 'module' => $modulename,
1784+ 'functiontype' => $return_type,
1785+ 'parameterlist' => \@parameterlist,
1786+ 'parameterdescs' => \%parameterdescs,
1787+ 'parametertypes' => \%parametertypes,
1788+ 'sectionlist' => \@sectionlist,
1789+ 'sections' => \%sections,
1790+ 'purpose' => $declaration_purpose
1791+ });
1792+ }
17751793 }
17761794
17771795 sub reset_state {