Skip to content

Commit

Permalink
kernel-doc: handle varargs cleanly
Browse files Browse the repository at this point in the history
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: Randy Dunlap <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rddunlap authored and torvalds committed Dec 2, 2008
1 parent 6ff2d39 commit ced6909
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/kernel-doc
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ sub dump_section {
# print STDERR "parameter def '$1' = '$contents'\n";
$name = $1;
$parameterdescs{$name} = $contents;
} elsif ($name eq "@\.\.\.") {
# print STDERR "parameter def '...' = '$contents'\n";
$name = "...";
$parameterdescs{$name} = $contents;
} else {
# print STDERR "other section '$name' = '$contents'\n";
if (defined($sections{$name}) && ($sections{$name} ne "")) {
Expand Down Expand Up @@ -1588,12 +1592,12 @@ sub push_parameter($$$) {

if ($type eq "" && $param =~ /\.\.\.$/)
{
$type="";
$parameterdescs{$param} = "variable arguments";
if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") {
$parameterdescs{$param} = "variable arguments";
}
}
elsif ($type eq "" && ($param eq "" or $param eq "void"))
{
$type="";
$param="void";
$parameterdescs{void} = "no arguments";
}
Expand Down

0 comments on commit ced6909

Please sign in to comment.