From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Matthias Koeppe Newsgroups: gmane.lisp.guile.devel Subject: Re: Portability bug with UINTPTR_MAX in Solaris/Forte Date: Wed, 25 Jun 2003 17:17:05 +0200 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <87isr0cjlb.fsf@zip.com.au> <87wufcqts1.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1056565472 32671 80.91.224.249 (25 Jun 2003 18:24:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 25 Jun 2003 18:24:32 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jun 25 20:24:31 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19VEuq-0008J1-00 for ; Wed, 25 Jun 2003 20:22:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19VEZP-00028g-Aw for guile-devel@m.gmane.org; Wed, 25 Jun 2003 14:00:35 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19VETx-0000Vn-Et for guile-devel@gnu.org; Wed, 25 Jun 2003 13:54:57 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19VDzx-0000l0-2O for guile-devel@gnu.org; Wed, 25 Jun 2003 13:23:59 -0400 Original-Received: from gnuftp.gnu.org ([199.232.41.6]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19VD9D-0000WW-JS for guile-devel@gnu.org; Wed, 25 Jun 2003 12:29:27 -0400 Original-Received: from merkur.math.uni-magdeburg.de ([141.44.75.40]) by gnuftp.gnu.org with esmtp (Exim 4.20) id 19VC6F-0001JE-6w for guile-devel@gnu.org; Wed, 25 Jun 2003 11:22:19 -0400 Original-Received: from beta ([141.44.75.78] helo=beta.math.uni-magdeburg.de) by merkur.math.uni-magdeburg.de with esmtp (Exim 4.10) id 19VC1D-0006fc-00 for guile-devel@gnu.org; Wed, 25 Jun 2003 17:17:07 +0200 Original-Received: (from mkoeppe@localhost) by beta.math.uni-magdeburg.de (8.11.7+Sun/8.11.7) id h5PFH6s21310; Wed, 25 Jun 2003 17:17:06 +0200 (MEST) X-Authentication-Warning: beta.math.uni-magdeburg.de: mkoeppe set sender to mkoeppe@mail.math.uni-magdeburg.de using -f Original-To: guile-devel@gnu.org In-Reply-To: <87wufcqts1.fsf@zip.com.au> (Kevin Ryde's message of "Tue, 24 Jun 2003 09:05:34 +1000") Original-Lines: 73 User-Agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.3.50 (sparc-sun-solaris2.8) X-Warning: no 'abuse'-account in domain mail.math.uni-magdeburg.de (cf. RFC2142/4.) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2579 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2579 Kevin Ryde writes: > Matthias Koeppe 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