mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-23 15:49:16 +02: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
47
configure.ac
47
configure.ac
@ -834,6 +834,41 @@ int main ()
|
|||||||
|
|
||||||
AC_MSG_RESULT($glib_ssize_type)
|
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
|
# 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(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)
|
AC_CHECK_FUNCS(lchmod lchown fchmod fchown utimes getresuid)
|
||||||
@ -3018,6 +3053,17 @@ $ac_cv_sizeof_int)
|
|||||||
guint64_constant='(val)'
|
guint64_constant='(val)'
|
||||||
;;
|
;;
|
||||||
$ac_cv_sizeof_long)
|
$ac_cv_sizeof_long)
|
||||||
|
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=long
|
||||||
gint64_modifier='"l"'
|
gint64_modifier='"l"'
|
||||||
gint64_format='"li"'
|
gint64_format='"li"'
|
||||||
@ -3025,6 +3071,7 @@ $ac_cv_sizeof_long)
|
|||||||
glib_extension=
|
glib_extension=
|
||||||
gint64_constant='(val##L)'
|
gint64_constant='(val##L)'
|
||||||
guint64_constant='(val##UL)'
|
guint64_constant='(val##UL)'
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
$ac_cv_sizeof_long_long)
|
$ac_cv_sizeof_long_long)
|
||||||
gint64='long long'
|
gint64='long long'
|
||||||
|
37
meson.build
37
meson.build
@ -1073,6 +1073,39 @@ else
|
|||||||
ssizet_size = cc.sizeof('ssize_t')
|
ssizet_size = cc.sizeof('ssize_t')
|
||||||
endif
|
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'
|
int64_m = 'll'
|
||||||
char_align = cc.alignment('char')
|
char_align = cc.alignment('char')
|
||||||
short_align = cc.alignment('short')
|
short_align = cc.alignment('short')
|
||||||
@ -1149,7 +1182,7 @@ if int_size == 8
|
|||||||
gint64_constant='(val)'
|
gint64_constant='(val)'
|
||||||
guint64_constant='(val)'
|
guint64_constant='(val)'
|
||||||
guint64_align = int_align
|
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'
|
gint64 = 'long'
|
||||||
glib_extension=''
|
glib_extension=''
|
||||||
gint64_modifier='l'
|
gint64_modifier='l'
|
||||||
@ -1158,7 +1191,7 @@ elif long_size == 8
|
|||||||
gint64_constant='(val##L)'
|
gint64_constant='(val##L)'
|
||||||
guint64_constant='(val##UL)'
|
guint64_constant='(val##UL)'
|
||||||
guint64_align = long_align
|
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'
|
gint64 = 'long long'
|
||||||
glib_extension='G_GNUC_EXTENSION '
|
glib_extension='G_GNUC_EXTENSION '
|
||||||
gint64_modifier=int64_m
|
gint64_modifier=int64_m
|
||||||
|
Loading…
x
Reference in New Issue
Block a user