gtk-doc r665 - in trunk: . tests/bugs/docs tests/bugs/src



Author: stefkost
Date: Mon Jan 26 08:35:34 2009
New Revision: 665
URL: http://svn.gnome.org/viewvc/gtk-doc?rev=665&view=rev

Log:
	* gtkdoc-scan.in:
	* tests/bugs/docs/tester-sections.txt:
	* tests/bugs/src/tester.c:
	* tests/bugs/src/tester.h:
	  Handle inline functions in headers. Fixes #532395.



Modified:
   trunk/ChangeLog
   trunk/gtkdoc-scan.in
   trunk/tests/bugs/docs/tester-sections.txt
   trunk/tests/bugs/src/tester.c
   trunk/tests/bugs/src/tester.h

Modified: trunk/gtkdoc-scan.in
==============================================================================
--- trunk/gtkdoc-scan.in	(original)
+++ trunk/gtkdoc-scan.in	Mon Jan 26 08:35:34 2009
@@ -237,6 +237,7 @@
     my ($in_comment) = 0;		  # True if we are in a comment.
     my ($in_declaration) = "";	  # The type of declaration we are in, e.g.
 				  #   'function' or 'macro'.
+    my ($skip_block) = 0;		  # True if we should skip a block.
     my ($symbol);		  # The current symbol being declared.
     my ($decl);			  # Holds the declaration of the current symbol.
     my ($ret_type);		  # For functions and function typedefs this
@@ -303,6 +304,18 @@
 	    }
 	    next;
 	}
+	# Skip complete blocks, needed fo inline macros
+	if ($skip_block==1) {
+	    if (m%{%) {
+	        $skip_block=2;
+	    }
+	    next;
+	} elsif ($skip_block==2) {
+	    if (m%}%) {
+	        $skip_block=0;
+	    }
+	    next;
+	}
 
         # Keep a count of #if, #ifdef, #ifndef nesting,
         # and if we enter a deprecation-symbol-bracketed
@@ -485,14 +498,32 @@
 		$symbol = $1;
 		$decl = $';
 
-		if ($previous_line !~ m/^\s*G_INLINE_FUNC/
-		    && $previous_line !~ m/^\s*static\s+/) {
-		    if ($previous_line =~ m/^\s*(?:\b(?:extern|${IGNORE_DECORATORS})\b\s*)*((?:const\s+|G_CONST_RETURN\s+|unsigned\s+|struct\s+|enum\s+)?\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o) {
-			$ret_type = $1;
-			if (defined ($2)) { $ret_type .= " $2"; }
-			#print "DEBUG: Function: $symbol, Returns: $ret_type\n";
-			$in_declaration = "function";
-		    }
+		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+|unsigned\s+|struct\s+|enum\s+)?\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o) {
+                            $ret_type = $1;
+                            if (defined ($2)) { $ret_type .= " $2"; }
+                            #print "DEBUG: Function: $symbol, Returns: $ret_type\n";
+                            $in_declaration = "function";
+                        }
+                    }
+                }
+                else {
+		    if ($previous_line !~ m/^\s*static\s+/) {
+                        #print "DEBUG: skip block after inline function\n";
+                        # 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+|unsigned\s+|struct\s+|enum\s+)?\w+)((?:\s*(?:\*+|\bconst\b|\bG_CONST_RETURN\b))*)\s*$/o) {
+                            $ret_type = $1;
+                            if (defined ($2)) { $ret_type .= " $2"; }
+                            #print "DEBUG: Function: $symbol, Returns: $ret_type\n";
+                            $in_declaration = "function";
+                            # this is a hack to detect the end of declaration
+                            $decl.=";"
+                        }
+                    }
 		}
 
 	    # Try to catch function declarations with the return type and name
@@ -507,14 +538,14 @@
 
 		} 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+|unsigned\s+|struct\s+|enum\s+)*\w+(?:\**\s+\**(?:const|G_CONST_RETURN))?(?:\s+|\s*\*+))\s*$/o) {
-			$ret_type = $1;
-			$ret_type =~ s/\s*\n//;
-			$in_declaration = "function";
-
-                        $symbol = $previous_line;
-                        $symbol =~ s/^\s+//;
-                        $symbol =~ s/\s*\n//;
-                        #print "DEBUG: Function: $symbol, Returns: $ret_type\n";
+                    $ret_type = $1;
+                    $ret_type =~ s/\s*\n//;
+                    $in_declaration = "function";
+                    
+                    $symbol = $previous_line;
+                    $symbol =~ s/^\s+//;
+                    $symbol =~ s/\s*\n//;
+                    #print "DEBUG: Function: $symbol, Returns: $ret_type\n";
 		}
 
 	    #} elsif (m/^extern\s+/) {

Modified: trunk/tests/bugs/docs/tester-sections.txt
==============================================================================
--- trunk/tests/bugs/docs/tester-sections.txt	(original)
+++ trunk/tests/bugs/docs/tester-sections.txt	Mon Jan 26 08:35:34 2009
@@ -18,6 +18,8 @@
 bug_471014
 bug_477532
 bug_501038
+bug_532395a
+bug_532395b
 bug_544172
 bug_552602
 bug_554833

Modified: trunk/tests/bugs/src/tester.c
==============================================================================
--- trunk/tests/bugs/src/tester.c	(original)
+++ trunk/tests/bugs/src/tester.c	Mon Jan 26 08:35:34 2009
@@ -109,9 +109,9 @@
  *
  * http://bugzilla.gnome.org/show_bug.cgi?id=446648
  **/
- 
- 
- /**
+
+
+/**
  * bug_552602:
  *
  * http://bugzilla.gnome.org/show_bug.cgi?id=552602
@@ -122,3 +122,4 @@
   return NULL;
 }
 
+

Modified: trunk/tests/bugs/src/tester.h
==============================================================================
--- trunk/tests/bugs/src/tester.h	(original)
+++ trunk/tests/bugs/src/tester.h	Mon Jan 26 08:35:34 2009
@@ -120,6 +120,36 @@
  */
 #define BUG_530758 "dummy"
 
+
+/**
+ * bug_532395a:
+ * @number: a number
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=532395
+ *
+ * Returns: number
+ */
+/**
+ * bug_532395b:
+ *
+ * http://bugzilla.gnome.org/show_bug.cgi?id=532395
+ */
+G_INLINE_FUNC guint
+bug_532395a (gulong number)
+{
+#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
+  return G_LIKELY (number) ?
+	   ((GLIB_SIZEOF_LONG * 8 - 1) ^ __builtin_clzl(number)) + 1 : 1;
+#else
+  return 0;
+#endif
+}
+G_INLINE_FUNC void
+bug_532395b (void)
+{
+}
+
+
 /** 
  * bug_544172:
  * @self: object pointer.
@@ -142,5 +172,6 @@
 struct _bug_554833 *
                 bug_554833_new (void);
 
+
 #endif // GTKDOC_TESTER_H
 



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