kernel-doc: better format typedef function output
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 8 Oct 2015 19:14:45 +0000 (16:14 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Sat, 10 Oct 2015 13:29:06 +0000 (10:29 -0300)
A typedef function looks more likely a function and not a
normal typedef. Change the code to use the output_function_*,
in order to properly parse the function prototype parameters.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
scripts/kernel-doc

index 55ce47ffa02d98735ca7d8434ddb71c147f3d71b..0276d2b5eefe31218adf9475d1f263be6fe979bb 100755 (executable)
@@ -1869,24 +1869,37 @@ sub dump_typedef($$) {
     my $file = shift;
 
     $x =~ s@/\*.*?\*/@@gos;    # strip comments.
-    while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) {
-       $x =~ s/\(*.\)\s*;$/;/;
-       $x =~ s/\[*.\]\s*;$/;/;
-    }
 
-    if ($x =~ /typedef.*\s+(\w+)\s*;/) {
-       $declaration_name = $1;
+    # Parse function prototypes
+    if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/) {
+       # Function typedefs
+       $return_type = $1;
+       $declaration_name = $2;
+       my $args = $3;
+
+       create_parameterlist($args, ',', $file);
 
        output_declaration($declaration_name,
-                          'typedef',
-                          {'typedef' => $declaration_name,
+                          'function',
+                          {'function' => $declaration_name,
                            'module' => $modulename,
+                           'functiontype' => $return_type,
+                           'parameterlist' => \@parameterlist,
+                           'parameterdescs' => \%parameterdescs,
+                           'parametertypes' => \%parametertypes,
                            'sectionlist' => \@sectionlist,
                            'sections' => \%sections,
                            'purpose' => $declaration_purpose
                           });
+       return;
+    }
+
+    while (($x =~ /\(*.\)\s*;$/) || ($x =~ /\[*.\]\s*;$/)) {
+       $x =~ s/\(*.\)\s*;$/;/;
+       $x =~ s/\[*.\]\s*;$/;/;
     }
-    elsif ($x =~ /typedef\s+\w+\s*\(\*\s*(\w\S+)\s*\)\s*\(/) { # functions
+
+    if ($x =~ /typedef.*\s+(\w+)\s*;/) {
        $declaration_name = $1;
 
        output_declaration($declaration_name,