There are a few namespace clashes by using c:macro everywhere: basically, when using it, we can't have something like: .. c:struct:: pwm_capture .. c:macro:: pwm_capture So, we need to use, instead: .. c:function:: int pwm_capture (struct pwm_device * pwm, struct pwm_capture * result, unsigned long timeout) for the function declaration. The kernel-doc change was proposed by Jakob Lykke Andersen here: https://github.com/jakobandersen/linux_docs/commit/6fd2076ec001cca7466857493cd678df4dfe4a65 Although I did a different implementation.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -917,6 +917,7 @@ sub output_function_rst(%) { · 916 unmodified lines | |||
| 917 | my ($parameter, $section); | 917 | my ($parameter, $section); |
| 918 | my $oldprefix = $lineprefix; | 918 | my $oldprefix = $lineprefix; |
| 919 | my $start = ""; | 919 | my $start = ""; |
| 920 | my $is_macro = 0; | ||
| 920 | 921 | ||
| 921 | if ($sphinx_major < 3) { | 922 | if ($sphinx_major < 3) { |
| 922 | if ($args{'typedef'}) { | 923 | if ($args{'typedef'}) { |
| @@ -926,11 +927,17 @@ sub output_function_rst(%) { · 3 unmodified lines | |||
| 926 | $lineprefix = ""; | 927 | $lineprefix = ""; |
| 927 | output_highlight_rst($args{'purpose'}); | 928 | output_highlight_rst($args{'purpose'}); |
| 928 | $start = "\n\n**Syntax**\n\n ``"; | 929 | $start = "\n\n**Syntax**\n\n ``"; |
| 930 | $is_macro = 1; | ||
| 929 | } else { | 931 | } else { |
| 930 | print ".. c:function:: "; | 932 | print ".. c:function:: "; |
| 931 | } | 933 | } |
| 932 | } else { | 934 | } else { |
| 933 | print ".. c:macro:: ". $args{'function'} . "\n\n"; | 935 | if ($args{'typedef'} || $args{'functiontype'} eq "") { |
| 936 | $is_macro = 1; | ||
| 937 | print ".. c:macro:: ". $args{'function'} . "\n\n"; | ||
| 938 | } else { | ||
| 939 | print ".. c:function:: "; | ||
| 940 | } | ||
| 934 | 941 | ||
| 935 | if ($args{'typedef'}) { | 942 | if ($args{'typedef'}) { |
| 936 | print_lineno($declaration_start_line); | 943 | print_lineno($declaration_start_line); |
| @@ -939,7 +946,7 @@ sub output_function_rst(%) { · 2 unmodified lines | |||
| 939 | output_highlight_rst($args{'purpose'}); | 946 | output_highlight_rst($args{'purpose'}); |
| 940 | $start = "\n\n**Syntax**\n\n ``"; | 947 | $start = "\n\n**Syntax**\n\n ``"; |
| 941 | } else { | 948 | } else { |
| 942 | print "``"; | 949 | print "``" if ($is_macro); |
| 943 | } | 950 | } |
| 944 | } | 951 | } |
| 945 | if ($args{'functiontype'} ne "") { | 952 | if ($args{'functiontype'} ne "") { |
| @@ -964,14 +971,12 @@ sub output_function_rst(%) { · 18 unmodified lines | |||
| 964 | print $type; | 971 | print $type; |
| 965 | } | 972 | } |
| 966 | } | 973 | } |
| 967 | if ($args{'typedef'}) { | 974 | if ($is_macro) { |
| 968 | print ");``\n\n"; | 975 | print ")``\n\n"; |
| 969 | } else { | 976 | } else { |
| 970 | if ($sphinx_major < 3) { | 977 | print ")\n\n"; |
| 971 | print ")\n\n"; | 978 | } |
| 972 | } else { | 979 | if (!$args{'typedef'}) { |
| 973 | print ")``\n"; | ||
| 974 | } | ||
| 975 | print_lineno($declaration_start_line); | 980 | print_lineno($declaration_start_line); |
| 976 | $lineprefix = " "; | 981 | $lineprefix = " "; |
| 977 | output_highlight_rst($args{'purpose'}); | 982 | output_highlight_rst($args{'purpose'}); |