mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-27 07:56:14 +01:00
Merge branch '972-integers-on-os-x' into 'master'
build: Mismatch between gint64 and int64_t in OSX 64-bit Closes #972 See merge request GNOME/glib!256
This commit is contained in:
commit
d589c18845
61
configure.ac
61
configure.ac
@ -834,6 +834,41 @@ int main ()
|
||||
|
||||
AC_MSG_RESULT($glib_ssize_type)
|
||||
|
||||
dnl Some platforms (Apple) hard-code int64_t to long long instead of
|
||||
dnl using long on 64-bit architectures. This can cause type mismatch
|
||||
dnl warnings when trying to interface with code using the standard
|
||||
dnl library type. Test for the warnings and set gint64 to whichever
|
||||
dnl works.
|
||||
dnl
|
||||
AS_IF([test $ac_cv_sizeof_long_long = $ac_cv_sizeof_long], [
|
||||
GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
|
||||
#if defined(_AIX) && !defined(__GNUC__)
|
||||
#pragma options langlvl=stdc99
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
int main ()
|
||||
{
|
||||
int64_t i1 = 1;
|
||||
long *i2 = &i1;
|
||||
return 1;
|
||||
}
|
||||
]])],[ glib_cv_int64_t=long ],
|
||||
[GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
|
||||
#if defined(_AIX) && !defined(__GNUC__)
|
||||
#pragma options langlvl=stdc99
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
int main ()
|
||||
{
|
||||
int64_t i1 = 1;
|
||||
long long *i2 = &i1;
|
||||
return 1;
|
||||
}
|
||||
]])],[ glib_cv_int64_t=long_long ])])
|
||||
])
|
||||
|
||||
# Check for some functions
|
||||
AC_CHECK_FUNCS(lstat strsignal vsnprintf stpcpy strcasecmp strncasecmp poll vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk mkostemp link)
|
||||
AC_CHECK_FUNCS(lchmod lchown fchmod fchown utimes getresuid)
|
||||
@ -3018,13 +3053,25 @@ $ac_cv_sizeof_int)
|
||||
guint64_constant='(val)'
|
||||
;;
|
||||
$ac_cv_sizeof_long)
|
||||
gint64=long
|
||||
gint64_modifier='"l"'
|
||||
gint64_format='"li"'
|
||||
guint64_format='"lu"'
|
||||
glib_extension=
|
||||
gint64_constant='(val##L)'
|
||||
guint64_constant='(val##UL)'
|
||||
if test "x$glib_cv_int64_t" = "xlong_long"; then
|
||||
gint64='long long'
|
||||
if test -n "$glib_cv_long_long_format"; then
|
||||
gint64_modifier='"'$glib_cv_long_long_format'"'
|
||||
gint64_format='"'$glib_cv_long_long_format'i"'
|
||||
guint64_format='"'$glib_cv_long_long_format'u"'
|
||||
fi
|
||||
glib_extension='G_GNUC_EXTENSION '
|
||||
gint64_constant='(G_GNUC_EXTENSION (val##LL))'
|
||||
guint64_constant='(G_GNUC_EXTENSION (val##ULL))'
|
||||
else
|
||||
gint64=long
|
||||
gint64_modifier='"l"'
|
||||
gint64_format='"li"'
|
||||
guint64_format='"lu"'
|
||||
glib_extension=
|
||||
gint64_constant='(val##L)'
|
||||
guint64_constant='(val##UL)'
|
||||
fi
|
||||
;;
|
||||
$ac_cv_sizeof_long_long)
|
||||
gint64='long long'
|
||||
|
37
meson.build
37
meson.build
@ -1073,6 +1073,39 @@ else
|
||||
ssizet_size = cc.sizeof('ssize_t')
|
||||
endif
|
||||
|
||||
# Some platforms (Apple) hard-code int64_t to long long instead of
|
||||
# using long on 64-bit architectures. This can cause type mismatch
|
||||
# warnings when trying to interface with code using the standard
|
||||
# library type. Test for the warnings and set gint64 to whichever
|
||||
# works.
|
||||
if long_long_size == long_size
|
||||
if cc.compiles('''#if defined(_AIX) && !defined(__GNUC__)
|
||||
#pragma options langlvl=stdc99
|
||||
#endif
|
||||
#pragma GCC diagnostic error "-Wincompatible-pointer-types"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
int main () {
|
||||
int64_t i1 = 1;
|
||||
long *i2 = &i1;
|
||||
return 1;
|
||||
}''', name : 'int64_t is long')
|
||||
int64_t_typedef = 'long'
|
||||
elif cc.compiles('''#if defined(_AIX) && !defined(__GNUC__)
|
||||
#pragma options langlvl=stdc99
|
||||
#endif
|
||||
#pragma GCC diagnostic error "-Wincompatible-pointer-types"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
int main () {
|
||||
int64_t i1 = 1;
|
||||
long long *i2 = &i1;
|
||||
return 1;
|
||||
}''', name : 'int64_t is long long')
|
||||
int64_t_typedef = 'long long'
|
||||
endif
|
||||
endif
|
||||
|
||||
int64_m = 'll'
|
||||
char_align = cc.alignment('char')
|
||||
short_align = cc.alignment('short')
|
||||
@ -1149,7 +1182,7 @@ if int_size == 8
|
||||
gint64_constant='(val)'
|
||||
guint64_constant='(val)'
|
||||
guint64_align = int_align
|
||||
elif long_size == 8
|
||||
elif long_size == 8 and (long_long_size != long_size or int64_t_typedef == 'long')
|
||||
gint64 = 'long'
|
||||
glib_extension=''
|
||||
gint64_modifier='l'
|
||||
@ -1158,7 +1191,7 @@ elif long_size == 8
|
||||
gint64_constant='(val##L)'
|
||||
guint64_constant='(val##UL)'
|
||||
guint64_align = long_align
|
||||
elif long_long_size == 8
|
||||
elif long_long_size == 8 and (long_long_size != long_size or int64_t_typedef == 'long long')
|
||||
gint64 = 'long long'
|
||||
glib_extension='G_GNUC_EXTENSION '
|
||||
gint64_modifier=int64_m
|
||||
|
Loading…
Reference in New Issue
Block a user