mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
Some platforms support 64 bit 'long long', but you can not printf or scanf
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in, tests/type-test.c: Some platforms support 64 bit 'long long', but you can not printf or scanf them. In that case, don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program to reflect that.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
6088718e19
commit
abb813df20
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
2000-09-28 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* configure.in, tests/type-test.c: Some platforms support 64 bit
|
||||||
|
'long long', but you can not printf or scanf them. In that case,
|
||||||
|
don't define G_G{UINT|INT}64_FORMAT. Changed the type-test program
|
||||||
|
to reflect that.
|
||||||
|
|
||||||
* gutils.c (g_get_current_dir): max_len can't be initialized
|
* gutils.c (g_get_current_dir): max_len can't be initialized
|
||||||
statically as it might call a function. So do it at first call.
|
statically as it might call a function. So do it at first call.
|
||||||
|
|
||||||
|
23
configure.in
23
configure.in
@@ -236,19 +236,25 @@ if test x$ac_cv_sizeof_long_long = x8; then
|
|||||||
# long long is a 64 bit integer.
|
# long long is a 64 bit integer.
|
||||||
AC_MSG_CHECKING(for format to printf and scanf a gint64)
|
AC_MSG_CHECKING(for format to printf and scanf a gint64)
|
||||||
AC_CACHE_VAL(glib_cv_long_long_format,[
|
AC_CACHE_VAL(glib_cv_long_long_format,[
|
||||||
|
for format in ll q; do
|
||||||
AC_TRY_RUN([#include <stdio.h>
|
AC_TRY_RUN([#include <stdio.h>
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
long long b, a = -0x3AFAFAFAFAFAFAFALL;
|
long long b, a = -0x3AFAFAFAFAFAFAFALL;
|
||||||
char buffer[1000];
|
char buffer[1000];
|
||||||
sprintf (buffer, "%llu", a);
|
sprintf (buffer, "%${format}u", a);
|
||||||
sscanf (buffer, "%llu", &b);
|
sscanf (buffer, "%${format}u", &b);
|
||||||
exit (b!=a);
|
exit (b!=a);
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
glib_cv_long_long_format=ll,
|
glib_cv_long_long_format=${format}
|
||||||
glib_cv_long_long_format=q)])
|
break)
|
||||||
|
done])
|
||||||
|
if test -n "$glib_cv_long_long_format"; then
|
||||||
AC_MSG_RESULT(%${glib_cv_long_long_format}i)
|
AC_MSG_RESULT(%${glib_cv_long_long_format}i)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(none)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl long doubles were not used, and a portability problem
|
dnl long doubles were not used, and a portability problem
|
||||||
@@ -1244,12 +1250,15 @@ _______EOF
|
|||||||
${glib_extension}typedef signed $gint64 gint64;
|
${glib_extension}typedef signed $gint64 gint64;
|
||||||
${glib_extension}typedef unsigned $gint64 guint64;
|
${glib_extension}typedef unsigned $gint64 guint64;
|
||||||
|
|
||||||
|
#define G_GINT64_CONSTANT(val) $gint64_constant
|
||||||
|
_______EOF
|
||||||
|
if test -n "$gint64_format"; then
|
||||||
|
cat >>$outfile <<_______EOF
|
||||||
#define G_GINT64_FORMAT $gint64_format
|
#define G_GINT64_FORMAT $gint64_format
|
||||||
#define G_GUINT64_FORMAT $guint64_format
|
#define G_GUINT64_FORMAT $guint64_format
|
||||||
#define G_GINT64_CONSTANT(val) $gint64_constant
|
|
||||||
|
|
||||||
_______EOF
|
_______EOF
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
case x$glib_size_t in
|
case x$glib_size_t in
|
||||||
x2) echo "typedef gint16 gssize;" >> $outfile
|
x2) echo "typedef gint16 gssize;" >> $outfile
|
||||||
@@ -1476,8 +1485,10 @@ $ac_cv_sizeof_long)
|
|||||||
;;
|
;;
|
||||||
$ac_cv_sizeof_long_long)
|
$ac_cv_sizeof_long_long)
|
||||||
gint64='long long'
|
gint64='long long'
|
||||||
|
if test -n "$glib_cv_long_long_format"; then
|
||||||
gint64_format='"'$glib_cv_long_long_format'i"'
|
gint64_format='"'$glib_cv_long_long_format'i"'
|
||||||
guint64_format='"'$glib_cv_long_long_format'u"'
|
guint64_format='"'$glib_cv_long_long_format'u"'
|
||||||
|
fi
|
||||||
glib_extension='G_GNUC_EXTENSION '
|
glib_extension='G_GNUC_EXTENSION '
|
||||||
gint64_constant='(G_GNUC_EXTENSION (val##LL))'
|
gint64_constant='(G_GNUC_EXTENSION (val##LL))'
|
||||||
;;
|
;;
|
||||||
|
@@ -113,7 +113,7 @@ main (int argc,
|
|||||||
g_assert (gu16t1 == gu16t2);
|
g_assert (gu16t1 == gu16t2);
|
||||||
g_assert (gu32t1 == gu32t2);
|
g_assert (gu32t1 == gu32t2);
|
||||||
|
|
||||||
#ifdef G_HAVE_GINT64
|
#if defined (G_HAVE_GINT64) && defined (G_GINT64_FORMAT)
|
||||||
gi64t1 = G_GINT64_CONSTANT (-0x3AFAFAFAFAFAFAFA);
|
gi64t1 = G_GINT64_CONSTANT (-0x3AFAFAFAFAFAFAFA);
|
||||||
gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA);
|
gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA);
|
||||||
#define FORMAT64 "%" G_GINT64_FORMAT " %" G_GUINT64_FORMAT "\n"
|
#define FORMAT64 "%" G_GINT64_FORMAT " %" G_GUINT64_FORMAT "\n"
|
||||||
|
Reference in New Issue
Block a user