scanner: correctly handle structs with arrays of anon unions
authorTorsten Schönfeld <kaffeetisch@gmx.de>
Sat, 10 Sep 2011 14:52:51 +0000 (16:52 +0200)
committerTorsten Schönfeld <kaffeetisch@gmx.de>
Sat, 10 Sep 2011 22:34:28 +0000 (00:34 +0200)
commitea68ec234ad31b0a1d92adbf0c911a5dd541b647
tree125930f400320b4bddfa7948396a10915f83c1b5
parentc3da3d46ffa9c3b53e7f7132eaa9c9c722ebc859
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
giscanner/transformer.py
tests/repository/Makefile.am
tests/repository/gitypelibtest.c
tests/scanner/Regress-1.0-expected.gir
tests/scanner/regress.h