unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de>
Subject: Re: Portability bug with UINTPTR_MAX in Solaris/Forte
Date: Wed, 25 Jun 2003 17:17:05 +0200	[thread overview]
Message-ID: <uw5el1iqj9q.fsf@saturn.math.uni-magdeburg.de> (raw)
In-Reply-To: <87wufcqts1.fsf@zip.com.au> (Kevin Ryde's message of "Tue, 24 Jun 2003 09:05:34 +1000")

Kevin Ryde <user42@zip.com.au> writes:

> Matthias Koeppe <mkoeppe@merkur.math.uni-magdeburg.de> writes:
>> +/* On Solaris 7 and 8, /usr/include/sys/int_limits.h defines
>> +   INTPTR_MAX and UINTPTR_MAX to empty, INTPTR_MIN is not defined.
>
> That's a typo there is it?  Only UINTPTR_MAX defined to empty.

No, it's exactly as I wrote.  From int_limits.h:

| /*
|  * The following 2 macros are provided for testing whether the types
|  * intptr_t and uintptr_t (integers large enough to hold a void *) are
|  * defined in this header. They are needed in case the architecture can't
|  * represent a pointer in any standard integral type.
|  */
| #define INTPTR_MAX
| #define UINTPTR_MAX
 
>> +#if SCM_SIZEOF_INTPTR_T != 0 && defined(INTPTR_MAX) && defined(INTPTR_MIN) && INTPTR_MAX-0 != 0 && INTPTR_MIN-0 != 0
>
> While you're at it you might like to merge the tests so scm_t_bits and
> scm_t_signed_bits are both based on "intptr" stuff, or both on "long",
> rather than having separate conditionals.  Wouldn't want them to come
> out different.

OK, here is an updated patch.  Will you commit this change?  (I don't
have CVS write permissions.)

--- tags.h.~1.103.~	Mon Jun 16 16:50:07 2003
+++ tags.h	Wed Jun 25 16:51:10 2003
@@ -39,24 +39,30 @@
 
 /* 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 \
+  && SCM_SIZEOF_UINTPTR_T != 0 && defined(UINTPTR_MAX) && UINTPTR_MAX-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
-#else
-typedef signed long scm_t_signed_bits;
-#define SCM_T_SIGNED_BITS_MAX LONG_MAX
-#define SCM_T_SIGNED_BITS_MIN LONG_MIN
-#endif
-
-#if SCM_SIZEOF_UINTPTR_T != 0 && defined(UINTPTR_MAX)
 typedef uintptr_t scm_t_bits;
 #define SIZEOF_SCM_T_BITS SCM_SIZEOF_UINTPTR_T
 #define SCM_T_BITS_MAX UINTPTR_MAX
+
 #else
+
+typedef signed long scm_t_signed_bits;
+#define SCM_T_SIGNED_BITS_MAX LONG_MAX
+#define SCM_T_SIGNED_BITS_MIN LONG_MIN
 typedef unsigned long scm_t_bits;
 #define SIZEOF_SCM_T_BITS SCM_SIZEOF_UNSIGNED_LONG
 #define SCM_T_BITS_MAX ULONG_MAX
+
 #endif
 
 /* But as external interface, we use SCM, which may, according to the desired

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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-06-25 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-18  6:25 Portability bug with UINTPTR_MAX in Solaris/Forte Matthias Koeppe
2003-06-21  1:20 ` Kevin Ryde
2003-06-23  9:15   ` Matthias Koeppe
2003-06-23 23:05     ` Kevin Ryde
2003-06-25 15:17       ` Matthias Koeppe [this message]
2003-07-05  0:03         ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uw5el1iqj9q.fsf@saturn.math.uni-magdeburg.de \
    --to=mkoeppe@mail.math.uni-magdeburg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).