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 686666 - introduce G_TYPE_ENUM_UINT and friends, deprecate G_TYPE_ENUM
introduce G_TYPE_ENUM_UINT and friends, deprecate G_TYPE_ENUM
Status: RESOLVED DUPLICATE of bug 686662
Product: glib
Classification: Platform
Component: gobject
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-10-22 21:06 UTC by Colin Walters
Modified: 2012-10-25 19:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests/signals: Disable large enumeration value test that is failing on PPC64 (1.38 KB, patch)
2012-10-25 19:38 UTC, Colin Walters
none Details | Review

Description Colin Walters 2012-10-22 21:06:01 UTC
See https://bugzilla.redhat.com/864196 for downstream discussion.

The executive summary is that in for enums in C, the compiler will choose a storage type (unsigned int, long long) based on what the enum contains.  For GCC, if the enum's values fit in the range of 0-G_MAXUINT, unsigned int will be chosen.  This fits "most" enums.  If you have negative numbers, but the range fits into G_MAXINT, you get an int, unsurprisingly.

A case that's not handled at all by G_TYPE_ENUM is if you have > G_MAXINT values.  GCC will choose e.g. guint64, but the public enum API is only 32 bit sized.  

A corner case here is that enums that fit in G_MAXUINT but not G_MAXINT will fail on some architectures like PPC64, which is the issue linked above.

Now, what we need to do is add types so that library users can explicitly specify the size of the enum.  This is going to be tedious and painful; but I suspect most library users will just need to do s/G_TYPE_ENUM/G_TYPE_ENUM_UINT/.

Still do be done for this is an analysis of which modules in GNOME need patching.
Comment 1 Allison Karlitskaya (desrt) 2012-10-22 22:21:22 UTC

*** This bug has been marked as a duplicate of bug 686662 ***
Comment 2 Colin Walters 2012-10-25 19:38:28 UTC
Created attachment 227299 [details] [review]
tests/signals: Disable large enumeration value test that is failing on PPC64

Basically due to a combination of va_args semantics around
signed/unsigned ints, this test case fails on ppc64.  At the moment,
we have as yet to find any real-world consumer with such a large
enumeration value.

Unfortunately, the possible fixes for this are extremely invasive;
we would have to define a new enum API.

Given both of these facts, we believe it makes the most sense at the
current time to simply not test this. If we at a later time determine
there is such a real-world consumer, we can look at doing the
necessary fixes.
Comment 3 Colin Walters 2012-10-25 19:43:09 UTC
Comment on attachment 227299 [details] [review]
tests/signals: Disable large enumeration value test that is failing on PPC64

Wrong bug