GNOME Bugzilla – Bug 741488
Mismatch between gint64 and int64_t in OSX 64-bit.
Last modified: 2018-05-24 17:20:23 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.
Created attachment 292672 [details] [review] Always typedef gint64 to long long on Macs.
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.
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.
-- 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.