fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / scripts / kernel-doc
index c9ca0c2..f50a70f 100755 (executable)
@@ -57,8 +57,8 @@ use strict;
 #      other functions are ignored.
 #
 #  -nofunction funcname
-#      If set, then only generate documentation for the other function(s).  All
-#      other functions are ignored. Cannot be used with -function together
+#      If set, then only generate documentation for the other function(s).
+#      Cannot be used together with -function
 #      (yes, that's a bug -- perl hackers can fix it 8))
 #
 #  c files - list of 'c' files to process
@@ -1262,7 +1262,9 @@ sub output_intro_text(%) {
 }
 
 ##
-# generic output function for typedefs
+# generic output function for all types (function, struct/union, typedef, enum);
+# calls the generated, variable output_ function name based on
+# functype and output_mode
 sub output_declaration {
     no strict 'refs';
     my $name = shift;
@@ -1278,8 +1280,7 @@ sub output_declaration {
 }
 
 ##
-# generic output function - calls the right one based
-# on current output mode.
+# generic output function - calls the right one based on current output mode.
 sub output_intro {
     no strict 'refs';
     my $func = "output_intro_".$output_mode;
@@ -1429,7 +1430,7 @@ sub create_parameterlist($$$) {
            # corresponding data structures "correctly". Catch it later in
            # output_* subs.
            push_parameter($arg, "", $file);
-       } elsif ($arg =~ m/\(/) {
+       } elsif ($arg =~ m/\(.*\*/) {
            # pointer-to-function
            $arg =~ tr/#/,/;
            $arg =~ m/[^\(]+\(\*([^\)]+)\)/;
@@ -1468,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/\[.*//;
@@ -1483,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;
@@ -1499,6 +1512,7 @@ sub push_parameter($$$) {
                         " No description found for parameter '$param'\n";
            ++$warnings;
         }
+        }
 
        push @parameterlist, $param;
        $parametertypes{$param} = $type;
@@ -1518,6 +1532,9 @@ sub dump_function($$) {
     $prototype =~ s/^asmlinkage +//;
     $prototype =~ s/^inline +//;
     $prototype =~ s/^__inline__ +//;
+    $prototype =~ s/^__inline +//;
+    $prototype =~ s/^__always_inline +//;
+    $prototype =~ s/^noinline +//;
     $prototype =~ s/__devinit +//;
     $prototype =~ s/^#define +//; #ak added
     $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//;
@@ -1778,8 +1795,9 @@ sub process_file($) {
                $in_doc_sect = 1;
                $contents = $newcontents;
                if ($contents ne "") {
-                   if (substr($contents, 0, 1) eq " ") {
-                       $contents = substr($contents, 1);
+                   while ((substr($contents, 0, 1) eq " ") ||
+                       substr($contents, 0, 1) eq "\t") {
+                           $contents = substr($contents, 1);
                    }
                    $contents .= "\n";
                }