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 666978 - Fails to compile glib applications with ISO C90 compiler
Fails to compile glib applications with ISO C90 compiler
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gthread
2.31.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-12-29 08:49 UTC by Jean-Philippe Orsini
Modified: 2012-01-02 16:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gthread.h: avoid anonymous union (710 bytes, patch)
2012-01-02 16:39 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Jean-Philippe Orsini 2011-12-29 08:49:12 UTC
gthread.h is using a unnamed union which is not supported by ISO C90 compiler:

http://git.gnome.org/browse/glib/tree/glib/deprecated/gthread.h?id=2f9ab64ac9dc4aeba4a6a297888986d26515d6f8#n158

Compilation error stack:
In file included from /usr/include/glib-2.0/glib.h:107:0,
                 from /usr/include/libgtop-2.0/glibtop.h:25,
                 from /usr/include/libgtop-2.0/glibtop/cpu.h:25,
/usr/include/glib-2.0/glib/deprecated/gthread.h:165:4: error: ISO C90 doesn't support unnamed structs/unions [-Werror=edantic]

The concerned part of gthread.h:
struct _GStaticRecMutex
{
  /*< private >*/
  GStaticMutex mutex;
  guint depth;

  /* ABI compat only */
  union {   <= ***** UNNAMED UNION *****
#ifdef G_OS_WIN32
    void *owner;
#else
    pthread_t owner;
#endif
    gdouble dummy;
  };
};

It prevents compilation of psensor on future Ubuntu Precise:
https://bugs.launchpad.net/ubuntu/+source/glib2.0/+bug/905893
Comment 1 Jean-Philippe Orsini 2011-12-29 08:59:51 UTC
The commit which has introduced the issue:
http://git.gnome.org/browse/glib/commit/glib/deprecated/gthread.h?id=a5800ef336661e51db019d7bc4b98b184b06ba86
Comment 2 Emmanuele Bassi (:ebassi) 2011-12-29 17:15:04 UTC
as a data point: anonymous unions and structs are a GCC extension, and will only be available in the C1x spec, AFAIR.
Comment 3 Allison Karlitskaya (desrt) 2012-01-02 16:39:01 UTC
Created attachment 204461 [details] [review]
gthread.h: avoid anonymous union

This is a GNU extension.
Comment 4 Allison Karlitskaya (desrt) 2012-01-02 16:39:46 UTC
Attachment 204461 [details] pushed as fc731de - gthread.h: avoid anonymous union