Skip to content

Commit

Permalink
[PATCH] kernel-doc: allow unnamed structs/unions
Browse files Browse the repository at this point in the history
Make kernel-doc support unnamed (anonymous) structs and unions.  There is
one (union) in include/linux/skbuff.h (inside struct sk_buff) that is
currently generating a kernel-doc warning, so this fixes that warning.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Randy Dunlap authored and Linus Torvalds committed Dec 22, 2006
1 parent 01b2d93 commit 134fe01
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/kernel-doc
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,7 @@ sub push_parameter($$$) {
my $param = shift;
my $type = shift;
my $file = shift;
my $anon = 0;

my $param_name = $param;
$param_name =~ s/\[.*//;
Expand All @@ -1484,9 +1485,20 @@ sub push_parameter($$$) {
$param="void";
$parameterdescs{void} = "no arguments";
}
elsif ($type eq "" && ($param eq "struct" or $param eq "union"))
# handle unnamed (anonymous) union or struct:
{
$type = $param;
$param = "{unnamed_" . $param. "}";
$parameterdescs{$param} = "anonymous\n";
$anon = 1;
}

# warn if parameter has no description
# (but ignore ones starting with # as these are no parameters
# but inline preprocessor statements
# (but ignore ones starting with # as these are not parameters
# but inline preprocessor statements);
# also ignore unnamed structs/unions;
if (!$anon) {
if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) {

$parameterdescs{$param_name} = $undescribed;
Expand All @@ -1500,6 +1512,7 @@ sub push_parameter($$$) {
" No description found for parameter '$param'\n";
++$warnings;
}
}

push @parameterlist, $param;
$parametertypes{$param} = $type;
Expand Down

0 comments on commit 134fe01

Please sign in to comment.