guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portability bug with UINTPTR_MAX in Solaris/Forte


From: Matthias Koeppe
Subject: Re: Portability bug with UINTPTR_MAX in Solaris/Forte
Date: Mon, 23 Jun 2003 11:15:27 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.3.50 (sparc-sun-solaris2.8)

Kevin Ryde <address@hidden> writes:

> Matthias Koeppe <address@hidden> writes:
>>
>> On Solaris, there is a uintptr_t, and UINTPTR_MAX is also a defined
>> macro, but it expands to nothing.
>
> Literally nothing?  Perhaps the change below would do the trick.
> Does the same apply to INTPTR_MAX?

Thanks, your trick does the change.  (I still think that tricky
things like this should be checked at `configure' time, rather than
during compilation, though.)

The same does not apply to the signed version because INTPTR_MIN is
not defined at all.  I have updated your patch to check this anyway,
for "completeness".

--- tags.h.~1.103.~     Mon Jun 16 16:50:07 2003
+++ tags.h      Mon Jun 23 11:13:09 2003
@@ -39,7 +39,11 @@
 
 /* In the beginning was the Word:
  */
-#if SCM_SIZEOF_INTPTR_T != 0 && defined(INTPTR_MAX) && defined(INTPTR_MIN)
+/* On Solaris 7 and 8, /usr/include/sys/int_limits.h defines
+   INTPTR_MAX and UINTPTR_MAX to empty, INTPTR_MIN is not defined.
+   To avoid uintptr_t and intptr_t in this case we require
+   UINTPTR_MAX-0 != 0 etc.  */
+#if SCM_SIZEOF_INTPTR_T != 0 && defined(INTPTR_MAX) && defined(INTPTR_MIN) && 
INTPTR_MAX-0 != 0 && INTPTR_MIN-0 != 0
 typedef intptr_t scm_t_signed_bits;
 #define SCM_T_SIGNED_BITS_MAX INTPTR_MAX
 #define SCM_T_SIGNED_BITS_MIN INTPTR_MIN
@@ -49,7 +53,7 @@
 #define SCM_T_SIGNED_BITS_MIN LONG_MIN
 #endif
 
-#if SCM_SIZEOF_UINTPTR_T != 0 && defined(UINTPTR_MAX)
+#if SCM_SIZEOF_UINTPTR_T != 0 && defined(UINTPTR_MAX) && UINTPTR_MAX-0 != 0
 typedef uintptr_t scm_t_bits;
 #define SIZEOF_SCM_T_BITS SCM_SIZEOF_UINTPTR_T
 #define SCM_T_BITS_MAX UINTPTR_MAX

-- 
Matthias Koeppe -- http://www.math.uni-magdeburg.de/~mkoeppe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]