提交 ced69090 编写于 作者: R Randy Dunlap 提交者: Linus Torvalds

kernel-doc: handle varargs cleanly

The method for listing varargs in kernel-doc notation is:
 * @...: these arguments are printed by the @fmt argument

but scripts/kernel-doc is confused:  it always lists varargs as:
	...	variable arguments
and ignores the @...: line's description, but then prints that
line after the list of function parameters as though it's
not part of the function parameters.

This patch makes kernel-doc print the supplied @...  description if it is
present; otherwise a boilerplate "variable arguments" is printed.
Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 6ff2d39b
...@@ -378,6 +378,10 @@ sub dump_section { ...@@ -378,6 +378,10 @@ sub dump_section {
# print STDERR "parameter def '$1' = '$contents'\n"; # print STDERR "parameter def '$1' = '$contents'\n";
$name = $1; $name = $1;
$parameterdescs{$name} = $contents; $parameterdescs{$name} = $contents;
} elsif ($name eq "@\.\.\.") {
# print STDERR "parameter def '...' = '$contents'\n";
$name = "...";
$parameterdescs{$name} = $contents;
} else { } else {
# print STDERR "other section '$name' = '$contents'\n"; # print STDERR "other section '$name' = '$contents'\n";
if (defined($sections{$name}) && ($sections{$name} ne "")) { if (defined($sections{$name}) && ($sections{$name} ne "")) {
...@@ -1588,12 +1592,12 @@ sub push_parameter($$$) { ...@@ -1588,12 +1592,12 @@ sub push_parameter($$$) {
if ($type eq "" && $param =~ /\.\.\.$/) if ($type eq "" && $param =~ /\.\.\.$/)
{ {
$type=""; if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") {
$parameterdescs{$param} = "variable arguments"; $parameterdescs{$param} = "variable arguments";
}
} }
elsif ($type eq "" && ($param eq "" or $param eq "void")) elsif ($type eq "" && ($param eq "" or $param eq "void"))
{ {
$type="";
$param="void"; $param="void";
$parameterdescs{void} = "no arguments"; $parameterdescs{void} = "no arguments";
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册