[gtk-doc] gtkdoc-scan: Ignore decorators containing parentheses



commit 8a8eb035a43c24a2f94fa8accb2b02ae174015b0
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Thu Nov 7 11:31:03 2013 +0100

    gtkdoc-scan: Ignore decorators containing parentheses
    
    Remove the \b after the IGNORE_DECORATORS regexp to allow passing a
    decorator containing parentheses like in deprecation macros such as
    G_DEPRECATED_FOR().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711598

 gtkdoc-scan.in                      |   28 ++++++++++++++--------------
 tests/bugs/docs/Makefile.am         |    2 +-
 tests/bugs/docs/tester-sections.txt |    2 ++
 tests/bugs/src/tester.c             |    9 +++++++++
 tests/bugs/src/tester.h             |    4 ++++
 5 files changed, 30 insertions(+), 15 deletions(-)
---
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index 4a3526b..cf72293 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -456,8 +456,8 @@ sub ScanHeader {
 
                 }
             # FUNCTION POINTER VARIABLES
-            #                                                                       $1                       
         $3            $4             $5
-            } elsif 
(m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((const\s+|G_CONST_RETURN\s+)?\w+)(\s+const)?\s*(\**)\s*\(\*\s*(\w+)\)\s*\(/o)
 {
+            #                                                                     $1                         
       $3            $4             $5
+            } elsif 
(m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\s*)*((const\s+|G_CONST_RETURN\s+)?\w+)(\s+const)?\s*(\**)\s*\(\*\s*(\w+)\)\s*\(/o)
 {
                 my $p3 = defined($3) ? $3 : "";
                 $ret_type = "$1$p3 $4";
                 $symbol = $5;
@@ -563,8 +563,8 @@ sub ScanHeader {
 
             # We assume that functions which start with '_' are private, so
             # we skip them.
-            #                                                                       $1                       
                                                                             $2                               
                           $3
-            } elsif 
(m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s+|\*)+(?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*(_[A-Za-z]\w*)\s*\(/o)
 {
+            #                                                                     $1                         
                                                                           $2                                 
                         $3
+            } elsif 
(m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s+|\*)+(?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*(_[A-Za-z]\w*)\s*\(/o)
 {
                 $ret_type = $1;
                 if (defined ($2)) { $ret_type .= " $2"; }
                 $symbol = $3;
@@ -578,8 +578,8 @@ sub ScanHeader {
                     $skip_block = 1;
                 }
 
-            #                                                                       $1                       
                                                                             $2                               
                           $3
-            } elsif 
(m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s+|\*)+(?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*([A-Za-z]\w*)\s*\(/o)
 {
+            #                                                                     $1                         
                                                                           $2                                 
                         $3
+            } elsif 
(m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s+|\*)+(?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*([A-Za-z]\w*)\s*\(/o)
 {
                 $ret_type = $1;
                 if (defined ($2)) { $ret_type .= " $2"; }
                 $symbol = $3;
@@ -602,8 +602,8 @@ sub ScanHeader {
 
                 if ($previous_line !~ m/^\s*G_INLINE_FUNC/) {
                     if ($previous_line !~ m/^\s*static\s+/) {
-                        #                                                                       $1           
                                                                                        $2
-                        if ($previous_line =~ 
m/^\s*(?:\b(?:extern|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o)
 {
+                        #                                                                     $1             
                                                                                      $2
+                        if ($previous_line =~ 
m/^\s*(?:\b(?:extern|${IGNORE_DECORATORS})\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o)
 {
                             $ret_type = $1;
                             if (defined ($2)) { $ret_type .= " $2"; }
                             @TRACE@("Function  (2): $symbol, Returns: $ret_type");
@@ -613,8 +613,8 @@ sub ScanHeader {
                         @TRACE@("skip block after inline function");
                         # now we we need to skip a whole { } block
                         $skip_block = 1;
-                        #                                                                                    
$1                                                                                                   $2
-                        if ($previous_line =~ 
m/^\s*(?:\b(?:extern|static|inline|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o)
 {
+                        #                                                                                  
$1                                                                                                    $2
+                        if ($previous_line =~ 
m/^\s*(?:\b(?:extern|static|inline|${IGNORE_DECORATORS})\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o)
 {
                             $ret_type = $1;
                             if (defined ($2)) { $ret_type .= " $2"; }
                             @TRACE@("Function  (3): $symbol, Returns: $ret_type");
@@ -627,8 +627,8 @@ sub ScanHeader {
                         @TRACE@("skip block after inline function");
                         # now we we need to skip a whole { } block
                         $skip_block = 1;
-                        #                                                                                    
$1                                                                                                    $2
-                        if ($previous_line =~ 
m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o)
 {
+                        #                                                                                  
$1                                                                                                    $2
+                        if ($previous_line =~ 
m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|long\s+|short\s+|struct\s+|union\s+|enum\s+)*\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o)
 {
                             $ret_type = $1;
                             if (defined ($2)) { $ret_type .= " $2"; }
                             @TRACE@("Function (4): $symbol, Returns: $ret_type");
@@ -641,14 +641,14 @@ sub ScanHeader {
             # on the previous line(s), and the start of the parameters on this.
             } elsif (m/^\s*\(/) {
                 $decl = $';
-                if ($previous_line =~ 
m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|enum\s+)*\w+)(\s+\*+|\*+|\s)\s*([A-Za-z]\w*)\s*$/o)
 {
+                if ($previous_line =~ 
m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|enum\s+)*\w+)(\s+\*+|\*+|\s)\s*([A-Za-z]\w*)\s*$/o)
 {
                     $ret_type = "$1 $2";
                     $symbol = $3;
                     @TRACE@("Function (5): $symbol, Returns: $ret_type");
                     $in_declaration = "function";
 
                 } elsif ($previous_line =~ m/^\s*\w+\s*$/
-                         && $pre_previous_line =~ 
m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|struct\s+|union\s+|enum\s+)*\w+(?:\**\s+\**(?:const|G_CONST_RETURN))?(?:\s+|\s*\*+))\s*$/o)
 {
+                         && $pre_previous_line =~ 
m/^\s*(?:\b(?:extern|G_INLINE_FUNC|${IGNORE_DECORATORS})\s*)*((?:const\s+|G_CONST_RETURN\s+|signed\s+|unsigned\s+|struct\s+|union\s+|enum\s+)*\w+(?:\**\s+\**(?:const|G_CONST_RETURN))?(?:\s+|\s*\*+))\s*$/o)
 {
                     $ret_type = $1;
                     $ret_type =~ s/\s*\n//;
                     $in_declaration = "function";
diff --git a/tests/bugs/docs/Makefile.am b/tests/bugs/docs/Makefile.am
index e008d3a..edcdab5 100644
--- a/tests/bugs/docs/Makefile.am
+++ b/tests/bugs/docs/Makefile.am
@@ -19,7 +19,7 @@ SCANGOBJ_OPTIONS=
 
 # Extra options to supply to gtkdoc-scan.
 SCAN_OPTIONS=--deprecated-guards="GTKDOC_TESTER_DISABLE_DEPRECATED" \
-  --ignore-decorators='GLIB_VAR|GTKDOC_GNUC_CONST' \
+  --ignore-decorators='GLIB_VAR|GTKDOC_GNUC_CONST|BUG_711598_DEPRECATED_FOR\(.+\)' \
   --rebuild-types
 
 # Extra options to supply to gtkdoc-mkdb.
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index e03d838..a7df5c3 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -62,6 +62,7 @@ bug_624001b
 bug_624001c
 bug_624001d
 bug_624001e
+bug_711598
 deprecation_notice
 gst_play_marshal_BUFFER__BOXED
 <SUBSECTION Standard>
@@ -70,6 +71,7 @@ GTKDOC_GNUC_CONST
 G_GNUC_DEPRECATED
 G_GNUC_DEPRECATED_FOR
 GLIB_DEPRECATED
+BUG_711598_DEPRECATED_FOR
 bug_554833_new
 </SECTION>
 
diff --git a/tests/bugs/src/tester.c b/tests/bugs/src/tester.c
index 3e60f84..7cd861c 100644
--- a/tests/bugs/src/tester.c
+++ b/tests/bugs/src/tester.c
@@ -397,6 +397,15 @@ void bug_624001e(void)
 }
 
 /**
+ * bug_711598:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=711598
+ */
+void bug_711598(void)
+{
+}
+
+/**
  * deprecation_notice:
  *
  * Foo.
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index 0349d71..b4efb99 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -483,6 +483,10 @@ void bug_624001d(void);
 GLIB_DEPRECATED
 void bug_624001e (void);
 
+#define BUG_711598_DEPRECATED_FOR(f) G_GNUC_DEPRECATED_FOR(f)
+BUG_711598_DEPRECATED_FOR(bug_711598b) void
+bug_711598(void);
+
 #ifdef GTKDOC_DISABLE_DEPRECATED
 void deprecation_notice(void);
 #endif


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