[gtk-doc] Fix functions with function pointer arguments



commit 8688e1d689d498f541d0f64ca141b503c9620837
Author: P. F. Chimento <philip chimento gmail com>
Date:   Mon Oct 4 11:54:27 2010 +0300

    Fix functions with function pointer arguments
    
    This patch fixes bug #597937 and adds a test case.

 gtkdoc-common.pl.in                 |    7 +++----
 tests/bugs/docs/tester-sections.txt |    1 +
 tests/bugs/src/tester.c             |    7 +++++++
 tests/bugs/src/tester.h             |    1 +
 4 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gtkdoc-common.pl.in b/gtkdoc-common.pl.in
index f7acca6..23d851c 100644
--- a/gtkdoc-common.pl.in
+++ b/gtkdoc-common.pl.in
@@ -397,8 +397,8 @@ sub ParseFunctionDeclaration {
             push @result, $label;
 
         # Try to match parameters which are functions
-        #                            $1                                                                  $2          $3      $4                        $5                    $7             $8
-	} elsif ($declaration =~ s/^(const\s+|G_CONST_RETURN\s+|G_GNUC_[A-Z_]+\s+|signed\s+|unsigned\s+)*(struct\s+)?(\w+)\s*(\**)\s*(?:restrict\b)?\s*(const\s+)?\(\s*\*+\s*(\w+)\s*\)\s*\(([^)]*)\)\s*[,\n]//) {
+        #                            $1                                                                  $2          $3      $4                        $5              $6            $7             $8
+	} elsif ($declaration =~ s/^(const\s+|G_CONST_RETURN\s+|G_GNUC_[A-Z_]+\s+|signed\s+|unsigned\s+)*(struct\s+)?(\w+)\s*(\**)\s*(?:restrict\b)?\s*(const\s+)?\(\s*(\*[\s\*]*)\s*(\w+)\s*\)\s*\(([^)]*)\)\s*[,\n]//) {
  	    my $mod1 = defined($1) ? $1 : "";
 	    if (defined($2)) { $mod1 .= $2; }
 	    my $type = $3;
@@ -416,10 +416,9 @@ sub ParseFunctionDeclaration {
 	    if ($ptr1 && $ptr1 !~ m/\*$/) { $ptr1 .= " "; }
 	    $func_ptr  =~ s/\s+//g;
 
-	    #print "Type: [$mod1][$xref][$ptr1][$mod2] ([$func_ptr][$name]) ($func_params)\n";
-
 	    push @result, $name;
             my $xref = defined $typefunc ? $typefunc->($type, "<type>$type</type>") : $type;
+            #print "Type: [$mod1][$xref][$ptr1][$mod2] ([$func_ptr][$name]) ($func_params)\n";#
             my $label = "$mod1$xref$ptr1$mod2 ($func_ptr$name) ($func_params)";
             if (defined $namefunc) {
                 $label = $namefunc->($label)
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index d9386a1..fcf5a67 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -35,6 +35,7 @@ bug_580300a_get_type
 bug_580300b_get_type
 bug_580300c_get_type
 bug_580300d_get_type
+bug_597937
 bug_602518a
 bug_602518b
 bug_602518c
diff --git a/tests/bugs/src/tester.c b/tests/bugs/src/tester.c
index 50aa172..cde05da 100644
--- a/tests/bugs/src/tester.c
+++ b/tests/bugs/src/tester.c
@@ -185,6 +185,13 @@ void bug_580300c_get_type() { }
  */
 int bug_580300d_get_type() { return 0; }
 
+/**
+ * bug_597937:
+ * @function_arg: value
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=597937
+ */
+void bug_597937(void (*function_arg)(int arg1, char arg2, void *)) { }
 
 /**
  * bug_602518a:
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index 065c60a..92aba94 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -247,6 +247,7 @@ void bug_580300b_get_type(gint a);
 void bug_580300c_get_type();
 extern int bug_580300d_get_type();
 
+void bug_597937(void (*function_arg)(int arg1, char arg2, void *));
 
 long int bug_602518a(void);
 unsigned long int bug_602518b(void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]