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 741488 - Mismatch between gint64 and int64_t in OSX 64-bit.
Mismatch between gint64 and int64_t in OSX 64-bit.
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
2.43.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-12-13 20:08 UTC by John Ralls
Modified: 2018-05-24 17:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Always typedef gint64 to long long on Macs. (1.19 KB, patch)
2014-12-13 20:10 UTC, John Ralls
none Details | Review
Test for the compiler warnings instead of hard-coding for Apple. (2.91 KB, patch)
2014-12-14 00:44 UTC, John Ralls
none Details | Review

Description John Ralls 2014-12-13 20:08:05 UTC
Unlike most other Unixes, Apple typdefs int64_t to long long without qualification, and when building with -arch x86_64 sizeof(long) and sizeof(long long) are both 8.

Glib sets gint64 based on finding the smallest of int, long, and long long with a size of 8, which results in this case with gint64 being typedeffed to long. This causes
  int64_t foo = 10;
  gint64 bar = foo; //Warns about a type mismatch
  printf (G_GINT64_FORMAT, foo); //Warns about wrong type for format.
Comment 1 John Ralls 2014-12-13 20:10:30 UTC
Created attachment 292672 [details] [review]
Always typedef gint64 to long long on Macs.
Comment 2 Dan Winship 2014-12-13 21:25:36 UTC
Comment on attachment 292672 [details] [review]
Always typedef gint64 to long long on Macs.

>+AS_IF([test x$glib_have_carbon = xyes],

Compare the int-vs-long size_t test around line 860; rather than just hardcoding an answer based on platform, it actually tries both ways to see which type generates a warning and which doesn't. The same sort of thing would be better here as well.
Comment 3 John Ralls 2014-12-14 00:44:21 UTC
Created attachment 292682 [details] [review]
Test for the compiler warnings instead of hard-coding for Apple.

Yes, much better, this protects against Apple changing their typedef in a later SDK.
Comment 4 GNOME Infrastructure Team 2018-05-24 17:20:23 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/972.