* Re: OpenBSD does not define INT8_MIN etc.
2004-07-10 14:43 ` Andreas Vögele
@ 2004-07-11 9:56 ` Andreas Vögele
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Vögele @ 2004-07-11 9:56 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 934 bytes --]
Andreas Vögele writes:
> I thought about the patch that I attached to my previous message. It's
> probably better to move the ifdefs from the printf statements into the
> C code so that the ifdefs don't get into scmconfig.h. I'll post an
> updated patch later.
Here's the patch that I currently use. I moved the limits stuff from
configure.in to gen-scmconfig.c. The patch introduces a lot of ifdefs
that check if INT8_MAX etc. are defined. If the macros are not
available constants are used. I've tested this patch on Debian
Woody/i386, OpenBSD 3.5/i386, HP-UX 11.0 and Mac OS X 10.3.4.
I also tried to build Guile under Cygwin. I could build guile.exe but
the binary segfaults. I don't think that this problem is related to my
changes. At least, scmconfig.h looks good. I'll try to investigate this
problem but I'm not familiar with Windows and Cygwin.
BTW, HP-UX doesn't seem to define SIZE_MAX.
[-- Attachment #2: limits.diff --]
[-- Type: application/octet-stream, Size: 16478 bytes --]
Index: configure.in
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/configure.in,v
retrieving revision 1.245
diff -u -r1.245 configure.in
--- configure.in 8 Jul 2004 22:50:45 -0000 1.245
+++ configure.in 11 Jul 2004 09:32:05 -0000
@@ -323,161 +323,123 @@
### Required type scm_t_int8
if test "$scm_stdint_has_int8"; then
SCM_I_GSC_T_INT8='"int8_t"'
- SCM_I_GSC_T_INT8_LIMITS='"INT8"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int8"; then
SCM_I_GSC_T_INT8='"int8_t"'
- SCM_I_GSC_T_INT8_LIMITS='"INT8"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_char" -eq 1; then
SCM_I_GSC_T_INT8='"signed char"'
- SCM_I_GSC_T_INT8_LIMITS='"SCHAR"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int8.])
fi
AC_SUBST([SCM_I_GSC_T_INT8])
-AC_SUBST([SCM_I_GSC_T_INT8_LIMITS])
### Required type scm_t_uint8
if test "$scm_stdint_has_uint8"; then
SCM_I_GSC_T_UINT8='"uint8_t"'
- SCM_I_GSC_T_UINT8_LIMITS='"UINT8"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint8"; then
SCM_I_GSC_T_UINT8='"uint8_t"'
- SCM_I_GSC_T_UINT8_LIMITS='"UINT8"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_char" -eq 1; then
SCM_I_GSC_T_UINT8='"unsigned char"'
- SCM_I_GSC_T_UINT8_LIMITS='"UCHAR"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint8.])
fi
AC_SUBST([SCM_I_GSC_T_UINT8])
-AC_SUBST([SCM_I_GSC_T_UINT8_LIMITS])
### Required type scm_t_int16 (ANSI C says int or short might work)
if test "$scm_stdint_has_int16"; then
SCM_I_GSC_T_INT16='"int16_t"'
- SCM_I_GSC_T_INT16_LIMITS='"INT16"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int16"; then
SCM_I_GSC_T_INT16='"int16_t"'
- SCM_I_GSC_T_INT16_LIMITS='"INT16"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" -eq 2; then
SCM_I_GSC_T_INT16='"int"'
- SCM_I_GSC_T_INT16_LIMITS='"INT"'
elif test "$ac_cv_sizeof_short" -eq 2; then
SCM_I_GSC_T_INT16='"short"'
- SCM_I_GSC_T_INT16_LIMITS='"SHRT"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int16.])
fi
AC_SUBST([SCM_I_GSC_T_INT16])
-AC_SUBST([SCM_I_GSC_T_INT16_LIMITS])
### Required type scm_t_uint16 (ANSI C says int or short might work)
if test "$scm_stdint_has_uint16"; then
SCM_I_GSC_T_UINT16='"uint16_t"'
- SCM_I_GSC_T_UINT16_LIMITS='"UINT16"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint16"; then
SCM_I_GSC_T_UINT16='"uint16_t"'
- SCM_I_GSC_T_UINT16_LIMITS='"UINT16"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_int" -eq 2; then
SCM_I_GSC_T_UINT16='"unsigned int"'
- SCM_I_GSC_T_UINT16_LIMITS='"UINT"'
elif test "$ac_cv_sizeof_unsigned_short" -eq 2; then
SCM_I_GSC_T_UINT16='"unsigned short"'
- SCM_I_GSC_T_UINT16_LIMITS='"USHRT"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint16.])
fi
AC_SUBST([SCM_I_GSC_T_UINT16])
-AC_SUBST([SCM_I_GSC_T_UINT16_LIMITS])
### Required type scm_t_int32 (ANSI C says int, short, or long might work)
if test "$scm_stdint_has_int32"; then
SCM_I_GSC_T_INT32='"int32_t"'
- SCM_I_GSC_T_INT32_LIMITS='"INT32"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int32"; then
SCM_I_GSC_T_INT32='"int32_t"'
- SCM_I_GSC_T_INT32_LIMITS='"INT32"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" -eq 4; then
SCM_I_GSC_T_INT32='"int"'
- SCM_I_GSC_T_INT32_LIMITS='"INT"'
elif test "$ac_cv_sizeof_long" -eq 4; then
SCM_I_GSC_T_INT32='"long"'
- SCM_I_GSC_T_INT32_LIMITS='"LONG"'
elif test "$ac_cv_sizeof_short" -eq 4; then
SCM_I_GSC_T_INT32='"short"'
- SCM_I_GSC_T_INT32_LIMITS='"SHRT"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int32.])
fi
AC_SUBST([SCM_I_GSC_T_INT32])
-AC_SUBST([SCM_I_GSC_T_INT32_LIMITS])
### Required type scm_t_uint32 (ANSI C says int, short, or long might work)
if test "$scm_stdint_has_uint32"; then
SCM_I_GSC_T_UINT32='"uint32_t"'
- SCM_I_GSC_T_UINT32_LIMITS='"UINT32"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint32"; then
SCM_I_GSC_T_UINT32='"uint32_t"'
- SCM_I_GSC_T_UINT32_LIMITS='"UINT32"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_int" -eq 4; then
SCM_I_GSC_T_UINT32='"unsigned int"'
- SCM_I_GSC_T_UINT32_LIMITS='"UINT"'
elif test "$ac_cv_sizeof_unsigned_long" -eq 4; then
SCM_I_GSC_T_UINT32='"unsigned long"'
- SCM_I_GSC_T_UINT32_LIMITS='"ULONG"'
elif test "$ac_cv_sizeof_unsigned_short" -eq 4; then
SCM_I_GSC_T_UINT32='"unsigned short"'
- SCM_I_GSC_T_UINT32_LIMITS='"USHRT"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint32.])
fi
AC_SUBST([SCM_I_GSC_T_UINT32])
-AC_SUBST([SCM_I_GSC_T_UINT32_LIMITS])
### Optional type scm_t_int64 (ANSI C says int, short, or long might work)
### Also try 'long long' and '__int64' if we have it.
SCM_I_GSC_T_INT64=0
if test "$scm_stdint_has_int64"; then
SCM_I_GSC_T_INT64='"int64_t"'
- SCM_I_GSC_T_INT64_LIMITS='"INT64"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_int64"; then
SCM_I_GSC_T_INT64='"int64_t"'
- SCM_I_GSC_T_INT64_LIMITS='"INT64"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_int" -eq 8; then
SCM_I_GSC_T_INT64='"int"'
- SCM_I_GSC_T_INT64_LIMITS='"INT"'
elif test "$ac_cv_sizeof_long" -eq 8; then
SCM_I_GSC_T_INT64='"long"'
- SCM_I_GSC_T_INT64_LIMITS='"LONG"'
elif test "$ac_cv_sizeof_short" -eq 8; then
SCM_I_GSC_T_INT64='"short"'
- SCM_I_GSC_T_INT64_LIMITS='"SHRT"'
elif test "$ac_cv_sizeof_long_long" -eq 8; then
SCM_I_GSC_T_INT64='"long long"'
- SCM_I_GSC_T_INT64_LIMITS='"SCM_I_LLONG"'
elif test "$ac_cv_sizeof___int64" -eq 8; then
SCM_I_GSC_T_INT64='"__int64"'
- SCM_I_GSC_T_INT64_LIMITS='"unknown"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_int64.])
fi
AC_SUBST([SCM_I_GSC_T_INT64])
-AC_SUBST([SCM_I_GSC_T_INT64_LIMITS])
### Optional type scm_t_uint64 (ANSI C says int, short, or long might work)
@@ -485,32 +447,24 @@
SCM_I_GSC_T_UINT64=0
if test "$scm_stdint_has_uint64"; then
SCM_I_GSC_T_UINT64='"uint64_t"'
- SCM_I_GSC_T_UINT64_LIMITS='"UINT64"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uint64"; then
SCM_I_GSC_T_UINT64='"uint64_t"'
- SCM_I_GSC_T_UINT64_LIMITS='"UINT64"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned_int" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned int"'
- SCM_I_GSC_T_UINT64_LIMITS='"UINT"'
elif test "$ac_cv_sizeof_unsigned_long" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned long"'
- SCM_I_GSC_T_UINT64_LIMITS='"ULONG"'
elif test "$ac_cv_sizeof_unsigned_short" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned short"'
- SCM_I_GSC_T_UINT64_LIMITS='"USHRT"'
elif test "$ac_cv_sizeof_unsigned_long_long" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned long long"'
- SCM_I_GSC_T_UINT64_LIMITS='"SCM_I_ULLONG"'
elif test "$ac_cv_sizeof_unsigned___int64" -eq 8; then
SCM_I_GSC_T_UINT64='"unsigned __int64"'
- SCM_I_GSC_T_UINT64_LIMITS='"unknown"'
else
AC_MSG_ERROR([Can't find appropriate type for scm_t_uint64.])
fi
AC_SUBST([SCM_I_GSC_T_UINT64])
-AC_SUBST([SCM_I_GSC_T_UINT64_LIMITS])
### Required type scm_t_intmax
###
@@ -520,24 +474,18 @@
SCM_I_GSC_T_INTMAX=0
if test "$scm_stdint_has_intmax"; then
SCM_I_GSC_T_INTMAX='"intmax_t"'
- SCM_I_GSC_T_INTMAX_LIMITS='"INTMAX"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_intmax"; then
SCM_I_GSC_T_INTMAX='"intmax_t"'
- SCM_I_GSC_T_INTMAX_LIMITS='"INTMAX"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof___int64" -ne 0; then
SCM_I_GSC_T_INTMAX='"__int64"'
- SCM_I_GSC_T_INTMAX_LIMITS='"unknown"'
elif test "$ac_cv_sizeof_long_long" -ne 0; then
SCM_I_GSC_T_INTMAX='"long long"'
- SCM_I_GSC_T_INTMAX_LIMITS='"SCM_I_LLONG"'
else
SCM_I_GSC_T_INTMAX='"long"'
- SCM_I_GSC_T_INTMAX_LIMITS='"LONG"'
fi
AC_SUBST([SCM_I_GSC_T_INTMAX])
-AC_SUBST([SCM_I_GSC_T_INTMAX_LIMITS])
### Required type scm_t_uintmax
###
@@ -547,24 +495,18 @@
SCM_I_GSC_T_UINTMAX=0
if test "$scm_stdint_has_uintmax"; then
SCM_I_GSC_T_UINTMAX='"uintmax_t"'
- SCM_I_GSC_T_UINTMAX_LIMITS='"UINTMAX"'
SCM_I_GSC_NEEDS_STDINT_H=1
elif test "$scm_inttypes_has_uintmax"; then
SCM_I_GSC_T_UINTMAX='"uintmax_t"'
- SCM_I_GSC_T_UINTMAX_LIMITS='"UINTMAX"'
SCM_I_GSC_NEEDS_INTTYPES_H=1
elif test "$ac_cv_sizeof_unsigned___int64" -ne 0; then
SCM_I_GSC_T_UINTMAX='"unsigned __int64"'
- SCM_I_GSC_T_UINTMAX_LIMITS='"unknown"'
elif test "$ac_cv_sizeof_unsigned_long_long" -ne 0; then
SCM_I_GSC_T_UINTMAX='"unsigned long long"'
- SCM_I_GSC_T_UINTMAX_LIMITS='"SCM_I_ULLONG"'
else
SCM_I_GSC_T_UINTMAX='"unsigned long"'
- SCM_I_GSC_T_UINTMAX_LIMITS='"ULONG"'
fi
AC_SUBST([SCM_I_GSC_T_UINTMAX])
-AC_SUBST([SCM_I_GSC_T_UINTMAX_LIMITS])
AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H])
Index: libguile/gen-scmconfig.h.in
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/gen-scmconfig.h.in,v
retrieving revision 1.3
diff -u -r1.3 gen-scmconfig.h.in
--- libguile/gen-scmconfig.h.in 7 Jul 2004 15:16:20 -0000 1.3
+++ libguile/gen-scmconfig.h.in 11 Jul 2004 09:32:05 -0000
@@ -16,25 +16,15 @@
#define SCM_I_GSC_NEEDS_STDINT_H @SCM_I_GSC_NEEDS_STDINT_H@
#define SCM_I_GSC_NEEDS_INTTYPES_H @SCM_I_GSC_NEEDS_INTTYPES_H@
#define SCM_I_GSC_T_INT8 @SCM_I_GSC_T_INT8@
-#define SCM_I_GSC_T_INT8_LIMITS @SCM_I_GSC_T_INT8_LIMITS@
#define SCM_I_GSC_T_UINT8 @SCM_I_GSC_T_UINT8@
-#define SCM_I_GSC_T_UINT8_LIMITS @SCM_I_GSC_T_UINT8_LIMITS@
#define SCM_I_GSC_T_INT16 @SCM_I_GSC_T_INT16@
-#define SCM_I_GSC_T_INT16_LIMITS @SCM_I_GSC_T_INT16_LIMITS@
#define SCM_I_GSC_T_UINT16 @SCM_I_GSC_T_UINT16@
-#define SCM_I_GSC_T_UINT16_LIMITS @SCM_I_GSC_T_UINT16_LIMITS@
#define SCM_I_GSC_T_INT32 @SCM_I_GSC_T_INT32@
-#define SCM_I_GSC_T_INT32_LIMITS @SCM_I_GSC_T_INT32_LIMITS@
#define SCM_I_GSC_T_UINT32 @SCM_I_GSC_T_UINT32@
-#define SCM_I_GSC_T_UINT32_LIMITS @SCM_I_GSC_T_UINT32_LIMITS@
#define SCM_I_GSC_T_INT64 @SCM_I_GSC_T_INT64@
-#define SCM_I_GSC_T_INT64_LIMITS @SCM_I_GSC_T_INT64_LIMITS@
#define SCM_I_GSC_T_UINT64 @SCM_I_GSC_T_UINT64@
-#define SCM_I_GSC_T_UINT64_LIMITS @SCM_I_GSC_T_UINT64_LIMITS@
#define SCM_I_GSC_T_INTMAX @SCM_I_GSC_T_INTMAX@
-#define SCM_I_GSC_T_INTMAX_LIMITS @SCM_I_GSC_T_INTMAX_LIMITS@
#define SCM_I_GSC_T_UINTMAX @SCM_I_GSC_T_UINTMAX@
-#define SCM_I_GSC_T_UINTMAX_LIMITS @SCM_I_GSC_T_UINTMAX_LIMITS@
#define SCM_I_GSC_T_PTRDIFF @SCM_I_GSC_T_PTRDIFF@
#define SCM_I_GSC_USE_PTHREAD_THREADS @SCM_I_GSC_USE_PTHREAD_THREADS@
#define SCM_I_GSC_USE_NULL_THREADS @SCM_I_GSC_USE_NULL_THREADS@
Index: libguile/gen-scmconfig.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/gen-scmconfig.c,v
retrieving revision 1.7
diff -u -r1.7 gen-scmconfig.c
--- libguile/gen-scmconfig.c 8 Jul 2004 15:31:39 -0000 1.7
+++ libguile/gen-scmconfig.c 11 Jul 2004 09:32:05 -0000
@@ -126,6 +126,13 @@
#include <stdio.h>
#include <string.h>
+#if SCM_I_GSC_NEEDS_STDINT_H
+# include <stdint.h>
+#endif
+#if SCM_I_GSC_NEEDS_INTTYPES_H
+# include <inttypes.h>
+#endif
+
#define pf printf
int
@@ -285,9 +292,21 @@
pf (" being on a C99 system (which we can't rely on yet). Thus,\n");
pf (" we define the limits on our own, assuming twos-complement.\n");
pf ("*/\n");
+#ifdef LLONG_MAX
+ pf ("#define SCM_I_LLONG_MAX LLONG_MAX\n");
+#else
pf ("#define SCM_I_LLONG_MAX ((long long) (SCM_I_ULLONG_MAX >> 1))\n");
+#endif
+#ifdef LLONG_MIN
+ pf ("#define SCM_I_LLONG_MIN LLONG_MIN\n");
+#else
pf ("#define SCM_I_LLONG_MIN (~SCM_I_LLONG_MAX)\n");
+#endif
+#ifdef ULLONG_MAX
+ pf ("#define SCM_I_ULLONG_MAX ULLONG_MAX\n");
+#else
pf ("#define SCM_I_ULLONG_MAX ((unsigned long long) (-1))\n");
+#endif
}
pf("\n");
@@ -316,15 +335,51 @@
pf ("typedef %s scm_t_intmax;\n", SCM_I_GSC_T_INTMAX);
pf ("typedef %s scm_t_uintmax;\n", SCM_I_GSC_T_UINTMAX);
- pf ("#define SCM_T_INT8_MIN %s_MIN\n", SCM_I_GSC_T_INT8_LIMITS);
- pf ("#define SCM_T_INT8_MAX %s_MAX\n", SCM_I_GSC_T_INT8_LIMITS);
- pf ("#define SCM_T_UINT8_MAX %s_MAX\n", SCM_I_GSC_T_UINT8_LIMITS);
- pf ("#define SCM_T_INT16_MIN %s_MIN\n", SCM_I_GSC_T_INT16_LIMITS);
- pf ("#define SCM_T_INT16_MAX %s_MAX\n", SCM_I_GSC_T_INT16_LIMITS);
- pf ("#define SCM_T_UINT16_MAX %s_MAX\n", SCM_I_GSC_T_UINT16_LIMITS);
- pf ("#define SCM_T_INT32_MIN %s_MIN\n", SCM_I_GSC_T_INT32_LIMITS);
- pf ("#define SCM_T_INT32_MAX %s_MAX\n", SCM_I_GSC_T_INT32_LIMITS);
- pf ("#define SCM_T_UINT32_MAX %s_MAX\n", SCM_I_GSC_T_UINT32_LIMITS);
+#ifdef INT8_MIN
+ pf ("#define SCM_T_INT8_MIN INT8_MIN\n");
+#else
+ pf ("#define SCM_T_INT8_MIN ((scm_t_int8)(-128))\n");
+#endif
+#ifdef INT8_MAX
+ pf ("#define SCM_T_INT8_MAX INT8_MAX\n");
+#else
+ pf ("#define SCM_T_INT8_MAX ((scm_t_int8)(127))\n");
+#endif
+#ifdef UINT8_MAX
+ pf ("#define SCM_T_UINT8_MAX UINT8_MAX\n");
+#else
+ pf ("#define SCM_T_UINT8_MAX ((scm_t_uint8)(255U))\n");
+#endif
+#ifdef INT16_MIN
+ pf ("#define SCM_T_INT16_MIN INT16_MIN\n");
+#else
+ pf ("#define SCM_T_INT16_MIN ((scm_t_int16)(-32767-1))\n");
+#endif
+#ifdef INT16_MAX
+ pf ("#define SCM_T_INT16_MAX INT16_MAX\n");
+#else
+ pf ("#define SCM_T_INT16_MAX ((scm_t_int16)(32767))\n");
+#endif
+#ifdef UINT16_MAX
+ pf ("#define SCM_T_UINT16_MAX UINT16_MAX\n");
+#else
+ pf ("#define SCM_T_UINT16_MAX ((scm_t_uint16)(65535U))\n");
+#endif
+#ifdef INT32_MIN
+ pf ("#define SCM_T_INT32_MIN INT32_MIN\n");
+#else
+ pf ("#define SCM_T_INT32_MIN ((scm_t_int32)(-2147483647-1))\n");
+#endif
+#ifdef INT32_MAX
+ pf ("#define SCM_T_INT32_MAX INT32_MAX\n");
+#else
+ pf ("#define SCM_T_INT32_MAX ((scm_t_int32)(2147483647))\n");
+#endif
+#ifdef UINT32_MAX
+ pf ("#define SCM_T_UINT32_MAX UINT32_MAX\n");
+#else
+ pf ("#define SCM_T_UINT32_MAX ((scm_t_uint32)(4294967295U))\n");
+#endif
pf ("\n");
pf ("/* 64-bit integer -- if available SCM_HAVE_T_INT64 will be 1 and\n"
@@ -334,8 +389,24 @@
{
pf ("#define SCM_HAVE_T_INT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_int64;\n", SCM_I_GSC_T_INT64);
- pf ("#define SCM_T_INT64_MIN %s_MIN\n", SCM_I_GSC_T_INT64_LIMITS);
- pf ("#define SCM_T_INT64_MAX %s_MAX\n", SCM_I_GSC_T_INT64_LIMITS);
+#ifdef INT64_MIN
+ pf ("#define SCM_T_INT64_MIN INT64_MIN\n");
+#else
+# ifdef INT64_C
+ pf ("#define SCM_T_INT64_MIN ((scm_t_int64)(INT64_C(-9223372036854775807)-1))\n");
+# else
+ pf ("#define SCM_T_INT64_MIN ((scm_t_int64)(-9223372036854775807LL-1))\n");
+# endif
+#endif
+#ifdef INT64_MAX
+ pf ("#define SCM_T_INT64_MAX INT64_MAX\n");
+#else
+# ifdef INT64_C
+ pf ("#define SCM_T_INT64_MAX ((scm_t_int64)(INT64_C(9223372036854775807)))\n");
+# else
+ pf ("#define SCM_T_INT64_MAX ((scm_t_int64)(9223372036854775807LL))\n");
+# endif
+#endif
}
else
pf ("#define SCM_HAVE_T_INT64 0 /* 0 or 1 */\n");
@@ -348,14 +419,40 @@
{
pf ("#define SCM_HAVE_T_UINT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_uint64;\n", SCM_I_GSC_T_UINT64);
- pf ("#define SCM_T_UINT64_MAX %s_MAX\n", SCM_I_GSC_T_UINT64_LIMITS);
+#ifdef UINT64_MAX
+ pf ("#define SCM_T_UINT64_MAX UINT64_MAX\n");
+#else
+# ifdef UINT64_C
+ pf ("#define SCM_T_UINT64_MAX ((scm_t_uint64)(UINT64_C(18446744073709551615)))\n");
+# else
+ pf ("#define SCM_T_UINT64_MAX ((scm_t_uint64)(18446744073709551615ULL))\n");
+# endif
+#endif
}
else
pf ("#define SCM_HAVE_T_UINT64 0 /* 0 or 1 */\n");
- pf ("#define SCM_T_INTMAX_MIN %s_MIN\n", SCM_I_GSC_T_INTMAX_LIMITS);
- pf ("#define SCM_T_INTMAX_MAX %s_MAX\n", SCM_I_GSC_T_INTMAX_LIMITS);
- pf ("#define SCM_T_UINTMAX_MAX %s_MAX\n", SCM_I_GSC_T_UINTMAX_LIMITS);
+#ifdef INTMAX_MIN
+ pf ("#define SCM_T_INTMAX_MIN INTMAX_MIN\n");
+#elif SIZEOF_LONG_LONG
+ pf ("#define SCM_T_INTMAX_MIN SCM_I_LLONG_MIN\n");
+#else
+ pf ("#define SCM_T_INTMAX_MIN LONG_MIN\n");
+#endif
+#ifdef INTMAX_MAX
+ pf ("#define SCM_T_INTMAX_MAX INTMAX_MAX\n");
+#elif SIZEOF_LONG_LONG
+ pf ("#define SCM_T_INTMAX_MAX SCM_I_LLONG_MAX\n");
+#else
+ pf ("#define SCM_T_INTMAX_MAX LONG_MAX\n");
+#endif
+#ifdef UINTMAX_MAX
+ pf ("#define SCM_T_UINTMAX_MAX UINTMAX_MAX\n");
+#elif SIZEOF_LONG_LONG
+ pf ("#define SCM_T_UINTMAX_MAX SCM_I_ULLONG_MAX\n");
+#else
+ pf ("#define SCM_T_UINTMAX_MAX ULONG_MAX\n");
+#endif
pf ("\n");
pf ("/* scm_t_ptrdiff_t and size, always defined -- defined to long if\n"
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 6+ messages in thread