aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-08-30 19:20:58 -0400
committerJonathan Corbet <corbet@lwn.net>2016-09-01 10:10:07 -0400
commit82801d065b4915d030e7f63212d146a75042aa91 (patch)
tree1b518cb58acd5eb1fcd9aad2320394a5725b4522
parentd37c43ce1975c1c3f28064bf3ebd2876e177bad8 (diff)
docs-rst: kernel-doc: fix typedef output in RST format
When using a typedef function like this one: typedef bool v4l2_check_dv_timings_fnc (const struct v4l2_dv_timings * t, void * handle); The Sphinx C domain expects it to create a c:type: reference, as that's the way it creates the type references when parsing a c:function:: declaration. So, a declaration like: .. c:function:: bool v4l2_valid_dv_timings (const struct v4l2_dv_timings * t, const struct v4l2_dv_timings_cap * cap, v4l2_check_dv_timings_fnc fnc, void * fnc_handle) Will create a cross reference for :c:type:`v4l2_check_dv_timings_fnc`. So, when outputting such typedefs in RST format, we need to handle this special case, as otherwise it will produce those warnings: ./include/media/v4l2-dv-timings.h:43: WARNING: c:type reference target not found: v4l2_check_dv_timings_fnc ./include/media/v4l2-dv-timings.h:60: WARNING: c:type reference target not found: v4l2_check_dv_timings_fnc ./include/media/v4l2-dv-timings.h:81: WARNING: c:type reference target not found: v4l2_check_dv_timings_fnc So, change the kernel-doc script to produce a RST output for the above typedef as: .. c:type:: v4l2_check_dv_timings_fnc **Typedef**: timings check callback **Syntax** ``bool v4l2_check_dv_timings_fnc (const struct v4l2_dv_timings * t, void * handle);`` Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rwxr-xr-xscripts/kernel-doc34
1 files changed, 24 insertions, 10 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index ad6d4e495f3f..301bf874cac8 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1831,13 +1831,22 @@ sub output_function_rst(%) {
1831 my %args = %{$_[0]}; 1831 my %args = %{$_[0]};
1832 my ($parameter, $section); 1832 my ($parameter, $section);
1833 my $oldprefix = $lineprefix; 1833 my $oldprefix = $lineprefix;
1834 my $start; 1834 my $start = "";
1835 1835
1836 print ".. c:function:: "; 1836 if ($args{'typedef'}) {
1837 print ".. c:type:: ". $args{'function'} . "\n\n";
1838 print_lineno($declaration_start_line);
1839 print " **Typedef**: ";
1840 $lineprefix = "";
1841 output_highlight_rst($args{'purpose'});
1842 $start = "\n\n**Syntax**\n\n ``";
1843 } else {
1844 print ".. c:function:: ";
1845 }
1837 if ($args{'functiontype'} ne "") { 1846 if ($args{'functiontype'} ne "") {
1838 $start = $args{'functiontype'} . " " . $args{'function'} . " ("; 1847 $start .= $args{'functiontype'} . " " . $args{'function'} . " (";
1839 } else { 1848 } else {
1840 $start = $args{'function'} . " ("; 1849 $start .= $args{'function'} . " (";
1841 } 1850 }
1842 print $start; 1851 print $start;
1843 1852
@@ -1856,11 +1865,15 @@ sub output_function_rst(%) {
1856 print $type . " " . $parameter; 1865 print $type . " " . $parameter;
1857 } 1866 }
1858 } 1867 }
1859 print ")\n\n"; 1868 if ($args{'typedef'}) {
1860 print_lineno($declaration_start_line); 1869 print ");``\n\n";
1861 $lineprefix = " "; 1870 } else {
1862 output_highlight_rst($args{'purpose'}); 1871 print ")\n\n";
1863 print "\n"; 1872 print_lineno($declaration_start_line);
1873 $lineprefix = " ";
1874 output_highlight_rst($args{'purpose'});
1875 print "\n";
1876 }
1864 1877
1865 print "**Parameters**\n\n"; 1878 print "**Parameters**\n\n";
1866 $lineprefix = " "; 1879 $lineprefix = " ";
@@ -2203,6 +2216,7 @@ sub dump_typedef($$) {
2203 output_declaration($declaration_name, 2216 output_declaration($declaration_name,
2204 'function', 2217 'function',
2205 {'function' => $declaration_name, 2218 {'function' => $declaration_name,
2219 'typedef' => 1,
2206 'module' => $modulename, 2220 'module' => $modulename,
2207 'functiontype' => $return_type, 2221 'functiontype' => $return_type,
2208 'parameterlist' => \@parameterlist, 2222 'parameterlist' => \@parameterlist,