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:
Sebastian Wilhelmi 2000-09-28 07:45:04 +00:00 committed by Sebastian Wilhelmi
parent 6088718e19
commit abb813df20
10 changed files with 58 additions and 7 deletions

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -1,5 +1,10 @@
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
statically as it might call a function. So do it at first call.

View File

@ -236,19 +236,25 @@ if test x$ac_cv_sizeof_long_long = x8; then
# long long is a 64 bit integer.
AC_MSG_CHECKING(for format to printf and scanf a gint64)
AC_CACHE_VAL(glib_cv_long_long_format,[
for format in ll q; do
AC_TRY_RUN([#include <stdio.h>
int main()
{
long long b, a = -0x3AFAFAFAFAFAFAFALL;
char buffer[1000];
sprintf (buffer, "%llu", a);
sscanf (buffer, "%llu", &b);
sprintf (buffer, "%${format}u", a);
sscanf (buffer, "%${format}u", &b);
exit (b!=a);
}
],
glib_cv_long_long_format=ll,
glib_cv_long_long_format=q)])
glib_cv_long_long_format=${format}
break)
done])
if test -n "$glib_cv_long_long_format"; then
AC_MSG_RESULT(%${glib_cv_long_long_format}i)
else
AC_MSG_RESULT(none)
fi
fi
dnl long doubles were not used, and a portability problem
@ -1244,12 +1250,15 @@ _______EOF
${glib_extension}typedef signed $gint64 gint64;
${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_GUINT64_FORMAT $guint64_format
#define G_GINT64_CONSTANT(val) $gint64_constant
_______EOF
fi
fi
case x$glib_size_t in
x2) echo "typedef gint16 gssize;" >> $outfile
@ -1476,8 +1485,10 @@ $ac_cv_sizeof_long)
;;
$ac_cv_sizeof_long_long)
gint64='long long'
if test -n "$glib_cv_long_long_format"; then
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))'
;;

View File

@ -113,7 +113,7 @@ main (int argc,
g_assert (gu16t1 == gu16t2);
g_assert (gu32t1 == gu32t2);
#ifdef G_HAVE_GINT64
#if defined (G_HAVE_GINT64) && defined (G_GINT64_FORMAT)
gi64t1 = G_GINT64_CONSTANT (-0x3AFAFAFAFAFAFAFA);
gu64t1 = G_GINT64_CONSTANT (0xFAFAFAFAFAFAFAFA);
#define FORMAT64 "%" G_GINT64_FORMAT " %" G_GUINT64_FORMAT "\n"