[gtk-doc] scan: only end structs/unions with '}' at the start of the line



commit e3d72165a44757961f7af7f2bf7370254ffd0a2d
Author: Stefan Kost <ensonic users sf net>
Date:   Sun May 1 22:10:23 2011 +0300

    scan: only end structs/unions with '}' at the start of the line
    
    Fix preliminary ending of structs/unions. Add a test.

 gtkdoc-scan.in                      |    2 +-
 tests/bugs/docs/tester-sections.txt |    1 +
 tests/bugs/src/tester.h             |   21 +++++++++++++++++++++
 3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in
index a5a4238..1f2e145 100755
--- a/gtkdoc-scan.in
+++ b/gtkdoc-scan.in
@@ -770,7 +770,7 @@ sub ScanHeader {
         # We try to handle nested stucts/unions, but unmatched brackets in
         # comments will cause problems.
         if ($in_declaration eq 'struct' or $in_declaration eq 'union') {
-            if ($level <= 1 && $decl =~ m/\}\s*(\w*);\s*$/) {
+            if (($level <= 1) && ($decl =~ m/\n\}\s*(\w*);\s*$/)) {
                 if ($symbol eq "") {
                     $symbol = $1;
                 }
diff --git a/tests/bugs/docs/tester-sections.txt b/tests/bugs/docs/tester-sections.txt
index a4ea291..3cc3d00 100644
--- a/tests/bugs/docs/tester-sections.txt
+++ b/tests/bugs/docs/tester-sections.txt
@@ -10,6 +10,7 @@ Bug446648
 Bug512154
 Bug642998
 Bug644291
+Bug000000Scope
 <SUBSECTION Functions>
 bug_000000_va1
 BUG_000000_VA2
diff --git a/tests/bugs/src/tester.h b/tests/bugs/src/tester.h
index aea05a0..8f644ca 100644
--- a/tests/bugs/src/tester.h
+++ b/tests/bugs/src/tester.h
@@ -397,4 +397,25 @@ extern void bug_000000_va1 (gchar name, ...);
  */
 #define BUG_000000_VA3(name,args...)
 
+/**
+ * Bug000000Scope:
+ *
+ * Opaque structure.
+ * "warning: Field descriptions for Bug000000Scope are missing in source code comment block."
+ * but not if we remove the blank line before "int b";
+ */
+typedef struct _Bug000000Scope Bug000000Scope;
+struct _Bug000000Scope {
+  /*< private >*/
+  union {
+    struct {
+      /* comment */
+      int a;
+    } ABI;
+    gpointer _reserved[4 - 1];
+  } abidata;
+
+  int b;
+};
+
 #endif // GTKDOC_TESTER_H



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