summaryrefslogtreecommitdiff
path: root/tests/scanner/regress.h
diff options
context:
space:
mode:
authorTorsten Schönfeld <kaffeetisch@gmx.de>2011-09-10 16:52:51 +0200
committerTorsten Schönfeld <kaffeetisch@gmx.de>2011-09-11 00:34:28 +0200
commitea68ec234ad31b0a1d92adbf0c911a5dd541b647 (patch)
tree125930f400320b4bddfa7948396a10915f83c1b5 /tests/scanner/regress.h
parentc3da3d46ffa9c3b53e7f7132eaa9c9c722ebc859 (diff)
downloadgobject-introspection-ea68ec234ad31b0a1d92adbf0c911a5dd541b647.tar.gz
scanner: correctly handle structs with arrays of anon unions
This applies mainly to GValue, which is defined as: struct _GValue { /*< private >*/ GType g_type; /* public for GTypeValueTable methods */ union { gint v_int; guint v_uint; glong v_long; gulong v_ulong; gint64 v_int64; guint64 v_uint64; gfloat v_float; gdouble v_double; gpointer v_pointer; } data[2]; }; Previously, the scanner did not understand the array of unions. This resulted in g_struct_info_get_size returning an incorrect size for GValue (at least on 32bit systems). Fix this by making up a separate union declaration for the GIR that can be referenced by the array. https://bugzilla.gnome.org/show_bug.cgi?id=657040
Diffstat (limited to 'tests/scanner/regress.h')
-rw-r--r--tests/scanner/regress.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index f30fcd78..4afb9b06 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -243,6 +243,23 @@ struct _RegressTestStructD
GPtrArray *garray;
};
+/* This one has an array of anonymous unions, inspired by GValue */
+struct RegressTestStructE
+{
+ GType some_type;
+ union {
+ gint v_int;
+ guint v_uint;
+ glong v_long;
+ gulong v_ulong;
+ gint64 v_int64;
+ guint64 v_uint64;
+ gfloat v_float;
+ gdouble v_double;
+ gpointer v_pointer;
+ } some_union[2];
+};
+
/* plain-old-data boxed types */
typedef struct _RegressTestSimpleBoxedA RegressTestSimpleBoxedA;
typedef struct _RegressTestSimpleBoxedB RegressTestSimpleBoxedB;