GNOME Bugzilla – Bug 666978
Fails to compile glib applications with ISO C90 compiler
Last modified: 2012-01-02 16:39:49 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
The commit which has introduced the issue: http://git.gnome.org/browse/glib/commit/glib/deprecated/gthread.h?id=a5800ef336661e51db019d7bc4b98b184b06ba86
as a data point: anonymous unions and structs are a GCC extension, and will only be available in the C1x spec, AFAIR.
Created attachment 204461 [details] [review] gthread.h: avoid anonymous union This is a GNU extension.
Attachment 204461 [details] pushed as fc731de - gthread.h: avoid anonymous union