History

[PATCH] kernel-doc: allow unnamed structs/unions

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.

Randy Dunlap committed 19 years ago

Commit 134fe011 parent 01b2d931 file · +15 −2Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/kernel-doc+15−2
@@ -1469,6 +1469,7 @@ sub push_parameter($$$) { · 1468 unmodified lines
14691469 my $param = shift;
14701470 my $type = shift;
14711471 my $file = shift;
1472+ my $anon = 0;
14721473
14731474 my $param_name = $param;
14741475 $param_name =~ s/\[.*//;
@@ -1484,9 +1485,20 @@ sub push_parameter($$$) { · 9 unmodified lines
14841485 $param="void";
14851486 $parameterdescs{void} = "no arguments";
14861487 }
1488+ elsif ($type eq "" && ($param eq "struct" or $param eq "union"))
1489+ # handle unnamed (anonymous) union or struct:
1490+ {
1491+ $type = $param;
1492+ $param = "{unnamed_" . $param. "}";
1493+ $parameterdescs{$param} = "anonymous\n";
1494+ $anon = 1;
1495+ }
1496+
14871497 # warn if parameter has no description
1488− # (but ignore ones starting with # as these are no parameters
1489− # but inline preprocessor statements
1498+ # (but ignore ones starting with # as these are not parameters
1499+ # but inline preprocessor statements);
1500+ # also ignore unnamed structs/unions;
1501+ if (!$anon) {
14901502 if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) {
14911503
14921504 $parameterdescs{$param_name} = $undescribed;
@@ -1500,6 +1512,7 @@ sub push_parameter($$$) { · 7 unmodified lines
15001512 " No description found for parameter '$param'\n";
15011513 ++$warnings;
15021514 }
1515+ }
15031516
15041517 push @parameterlist, $param;
15051518 $parametertypes{$param} = $type;