[gtk+] gtktextattributes: Only use transparent union for g-ir-scanner



commit 3c6c90086fe3507563abdd1d511e6f264d131572
Author: Colin Walters <walters verbum org>
Date:   Wed Nov 13 12:59:57 2013 -0500

    gtktextattributes: Only use transparent union for g-ir-scanner
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711158

 gtk/gtktextattributes.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktextattributes.h b/gtk/gtktextattributes.h
index 616fc8b..cd20c7c 100644
--- a/gtk/gtktextattributes.h
+++ b/gtk/gtktextattributes.h
@@ -94,10 +94,24 @@ struct _GtkTextAppearance
   guint inside_selection : 1;
   guint is_text : 1;
 
+  /* For the sad story of this bit of code, see
+   * https://bugzilla.gnome.org/show_bug.cgi?id=711158
+   */
+#ifdef __GI_SCANNER__
+  /* The scanner should only see the transparent union, so that its
+   * content does not vary across architectures.
+   */
   union {
     GdkRGBA *rgba[2];
     guint padding[4];
   };
+#else
+  GdkRGBA *rgba[2];
+#if (defined(__SIZEOF_INT__) && defined(__SIZEOF_POINTER__)) && (__SIZEOF_INT__ == __SIZEOF_POINTER__)
+  /* unusable, just for ABI compat */
+  guint padding[2];
+#endif
+#endif
 };
 
 /**


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