After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 686366 - Use named union for _GtkSymbolicColor in gtk/gtksymboliccolor.c
Use named union for _GtkSymbolicColor in gtk/gtksymboliccolor.c
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkStyleContext
unspecified
Other HP-UX
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-10-18 11:28 UTC by Richard Lloyd
Modified: 2012-10-22 23:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Diff patch to name a union and any references to the union (11.13 KB, patch)
2012-10-18 16:15 UTC, Richard Lloyd
accepted-commit_now Details | Review

Description Richard Lloyd 2012-10-18 11:28:16 UTC
I'm using the HP ANSI C compiler on HP-UX 11 and it doesn't like unnamed unions. The only place in the whole GTK+ 3 source code that uses them is the union definition inside struct _GtkSymbolicColor (around line 60 of gtk/gtksymboliccolor.c).

Unfortunately, not only do you have to name the union (e.g. sym_col) like this at the end of the struct definition:

    struct
    {
      gchar *theme_class;
      gint id;
    } win32;
  } sym_col;
};

but HP's C also then wants you to use the name to access the union as well :-(
Examples with the union name added:

Line 100:       g_free (color->sym_col.name);
Line 103:       gtk_symbolic_color_unref (color->sym_col.shade.color);
and so on.

If no-one wants to edit the 50+ lines involved, I could do it agianst gtk+ 3.6.1 and post up a context diff here as a starting poiint.
Comment 1 Cosimo Cecchi 2012-10-18 14:57:06 UTC
I think we usually try to be compatible with different configurations and compilers as much as possible, if it doesn't make maintaining the code much harder.

What you propose here sounds quite reasonable, would you prepare a patch?
Comment 2 Richard Lloyd 2012-10-18 16:15:58 UTC
Created attachment 226750 [details] [review]
Diff patch to name a union and any references to the union

It's a unified diff (-u) that gives more change details than a context diff (-c), IMHO of course.
Comment 3 Cosimo Cecchi 2012-10-22 16:00:27 UTC
Review of attachment 226750 [details] [review]:

Thanks, this looks good to me.