X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fkernel-doc;h=cc63cd01d5ee0c37ad9573c8cf3ffbcbc2abb878;hb=996a07bcb62c5935248e238a1150089f3d99a6fb;hp=df3b272f7ce6b1d47bc2014b9c5f18e9ec763d2b;hpb=ea82c74093f48b28e632d03eeff22faf99727a8c;p=linux-2.6 diff --git a/scripts/kernel-doc b/scripts/kernel-doc index df3b272f7c..cc63cd01d5 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -83,7 +83,7 @@ use strict; # * my_function # **/ # -# If the Description: header tag is ommitted, then there must be a blank line +# If the Description: header tag is omitted, then there must be a blank line # after the last parameter specification. # e.g. # /** @@ -265,7 +265,7 @@ my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start. my $doc_end = '\*/'; my $doc_com = '\s*\*\s*'; my $doc_decl = $doc_com.'(\w+)'; -my $doc_sect = $doc_com.'(['.$doc_special.']?[\w ]+):(.*)'; +my $doc_sect = $doc_com.'(['.$doc_special.']?[\w\s]+):(.*)'; my $doc_content = $doc_com.'(.*)'; my $doc_block = $doc_com.'DOC:\s*(.*)?'; @@ -583,14 +583,14 @@ sub output_function_xml(%) { $id = "API-".$args{'function'}; $id =~ s/[^A-Za-z0-9]/-/g; - print "\n"; + print "\n"; print "\n"; print " LINUX\n"; print " Kernel Hackers Manual\n"; print " $man_date\n"; print "\n"; print "\n"; - print " ".$args{'function'}."\n"; + print " ".$args{'function'}."\n"; print " 9\n"; print "\n"; print "\n"; @@ -659,14 +659,14 @@ sub output_struct_xml(%) { $id = "API-struct-".$args{'struct'}; $id =~ s/[^A-Za-z0-9]/-/g; - print "\n"; + print "\n"; print "\n"; print " LINUX\n"; print " Kernel Hackers Manual\n"; print " $man_date\n"; print "\n"; print "\n"; - print " ".$args{'type'}." ".$args{'struct'}."\n"; + print " ".$args{'type'}." ".$args{'struct'}."\n"; print " 9\n"; print "\n"; print "\n"; @@ -743,14 +743,14 @@ sub output_enum_xml(%) { $id = "API-enum-".$args{'enum'}; $id =~ s/[^A-Za-z0-9]/-/g; - print "\n"; + print "\n"; print "\n"; print " LINUX\n"; print " Kernel Hackers Manual\n"; print " $man_date\n"; print "\n"; print "\n"; - print " enum ".$args{'enum'}."\n"; + print " enum ".$args{'enum'}."\n"; print " 9\n"; print "\n"; print "\n"; @@ -809,14 +809,14 @@ sub output_typedef_xml(%) { $id = "API-typedef-".$args{'typedef'}; $id =~ s/[^A-Za-z0-9]/-/g; - print "\n"; + print "\n"; print "\n"; print " LINUX\n"; print " Kernel Hackers Manual\n"; print " $man_date\n"; print "\n"; print "\n"; - print " typedef ".$args{'typedef'}."\n"; + print " typedef ".$args{'typedef'}."\n"; print " 9\n"; print "\n"; print "\n"; @@ -1433,7 +1433,7 @@ sub create_parameterlist($$$) { } elsif ($arg =~ m/\(.*\*/) { # pointer-to-function $arg =~ tr/#/,/; - $arg =~ m/[^\(]+\(\*([^\)]+)\)/; + $arg =~ m/[^\(]+\(\*\s*([^\)]+)\)/; $param = $1; $type = $arg; $type =~ s/([^\(]+\(\*)$param/$1/; @@ -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/\[.*//; @@ -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; @@ -1500,6 +1512,7 @@ sub push_parameter($$$) { " No description found for parameter '$param'\n"; ++$warnings; } + } push @parameterlist, $param; $parametertypes{$param} = $type; @@ -1523,7 +1536,7 @@ sub dump_function($$) { $prototype =~ s/^__always_inline +//; $prototype =~ s/^noinline +//; $prototype =~ s/__devinit +//; - $prototype =~ s/^#define +//; #ak added + $prototype =~ s/^#define\s+//; #ak added $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//; # Yes, this truly is vile. We are looking for: