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 | 917 | my ($parameter, $section); |
| 918 | 918 | my $oldprefix = $lineprefix; |
| 919 | 919 | my $start = ""; |
| 920 | + my $is_macro = 0; | |
| 920 | 921 | |
| 921 | 922 | if ($sphinx_major < 3) { |
| 922 | 923 | if ($args{'typedef'}) { |
| @@ -926,11 +927,17 @@ sub output_function_rst(%) { · 3 unmodified lines | ||
| 926 | 927 | $lineprefix = ""; |
| 927 | 928 | output_highlight_rst($args{'purpose'}); |
| 928 | 929 | $start = "\n\n**Syntax**\n\n ``"; |
| 930 | + $is_macro = 1; | |
| 929 | 931 | } else { |
| 930 | 932 | print ".. c:function:: "; |
| 931 | 933 | } |
| 932 | 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 | 942 | if ($args{'typedef'}) { |
| 936 | 943 | print_lineno($declaration_start_line); |
| @@ -939,7 +946,7 @@ sub output_function_rst(%) { · 2 unmodified lines | ||
| 939 | 946 | output_highlight_rst($args{'purpose'}); |
| 940 | 947 | $start = "\n\n**Syntax**\n\n ``"; |
| 941 | 948 | } else { |
| 942 | − print "``"; | |
| 949 | + print "``" if ($is_macro); | |
| 943 | 950 | } |
| 944 | 951 | } |
| 945 | 952 | if ($args{'functiontype'} ne "") { |
| @@ -964,14 +971,12 @@ sub output_function_rst(%) { · 18 unmodified lines | ||
| 964 | 971 | print $type; |
| 965 | 972 | } |
| 966 | 973 | } |
| 967 | − if ($args{'typedef'}) { | |
| 968 | − print ");``\n\n"; | |
| 974 | + if ($is_macro) { | |
| 975 | + print ")``\n\n"; | |
| 969 | 976 | } else { |
| 970 | − if ($sphinx_major < 3) { | |
| 971 | − print ")\n\n"; | |
| 972 | − } else { | |
| 973 | − print ")``\n"; | |
| 974 | − } | |
| 977 | + print ")\n\n"; | |
| 978 | + } | |
| 979 | + if (!$args{'typedef'}) { | |
| 975 | 980 | print_lineno($declaration_start_line); |
| 976 | 981 | $lineprefix = " "; |
| 977 | 982 | output_highlight_rst($args{'purpose'}); |