scripts: kernel-doc: try to use c:function if possible
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:
6fd2076ec0
Although I did a different implementation.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
5ef09c96d4
commit
6e9e415854
|
@ -917,6 +917,7 @@ sub output_function_rst(%) {
|
||||||
my ($parameter, $section);
|
my ($parameter, $section);
|
||||||
my $oldprefix = $lineprefix;
|
my $oldprefix = $lineprefix;
|
||||||
my $start = "";
|
my $start = "";
|
||||||
|
my $is_macro = 0;
|
||||||
|
|
||||||
if ($sphinx_major < 3) {
|
if ($sphinx_major < 3) {
|
||||||
if ($args{'typedef'}) {
|
if ($args{'typedef'}) {
|
||||||
|
@ -926,11 +927,17 @@ sub output_function_rst(%) {
|
||||||
$lineprefix = "";
|
$lineprefix = "";
|
||||||
output_highlight_rst($args{'purpose'});
|
output_highlight_rst($args{'purpose'});
|
||||||
$start = "\n\n**Syntax**\n\n ``";
|
$start = "\n\n**Syntax**\n\n ``";
|
||||||
|
$is_macro = 1;
|
||||||
} else {
|
} else {
|
||||||
print ".. c:function:: ";
|
print ".. c:function:: ";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print ".. c:macro:: ". $args{'function'} . "\n\n";
|
if ($args{'typedef'} || $args{'functiontype'} eq "") {
|
||||||
|
$is_macro = 1;
|
||||||
|
print ".. c:macro:: ". $args{'function'} . "\n\n";
|
||||||
|
} else {
|
||||||
|
print ".. c:function:: ";
|
||||||
|
}
|
||||||
|
|
||||||
if ($args{'typedef'}) {
|
if ($args{'typedef'}) {
|
||||||
print_lineno($declaration_start_line);
|
print_lineno($declaration_start_line);
|
||||||
|
@ -939,7 +946,7 @@ sub output_function_rst(%) {
|
||||||
output_highlight_rst($args{'purpose'});
|
output_highlight_rst($args{'purpose'});
|
||||||
$start = "\n\n**Syntax**\n\n ``";
|
$start = "\n\n**Syntax**\n\n ``";
|
||||||
} else {
|
} else {
|
||||||
print "``";
|
print "``" if ($is_macro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($args{'functiontype'} ne "") {
|
if ($args{'functiontype'} ne "") {
|
||||||
|
@ -964,14 +971,12 @@ sub output_function_rst(%) {
|
||||||
print $type;
|
print $type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($args{'typedef'}) {
|
if ($is_macro) {
|
||||||
print ");``\n\n";
|
print ")``\n\n";
|
||||||
} else {
|
} else {
|
||||||
if ($sphinx_major < 3) {
|
print ")\n\n";
|
||||||
print ")\n\n";
|
}
|
||||||
} else {
|
if (!$args{'typedef'}) {
|
||||||
print ")``\n";
|
|
||||||
}
|
|
||||||
print_lineno($declaration_start_line);
|
print_lineno($declaration_start_line);
|
||||||
$lineprefix = " ";
|
$lineprefix = " ";
|
||||||
output_highlight_rst($args{'purpose'});
|
output_highlight_rst($args{'purpose'});
|
||||||
|
|
Loading…
Reference in New Issue