[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1
From: |
Matthias Koeppe |
Subject: |
Re: Portability problem with SCM_DEBUG_TYPING_STRICTNESS=1 |
Date: |
08 Jun 2001 11:04:17 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6 |
Dirk Herrmann <address@hidden> writes:
> could you please check whether the recent cvs version solves your
> compilation problems?
Thanks Dirk, but a few places have remained (they weren't reported
before because the compiler was confused):
"unif.c", line 1927: a cast does not yield an lvalue
"unif.c", line 1930: a cast does not yield an lvalue
"unif.c", line 2019: a cast does not yield an lvalue
While we are at it: I also get
"./eval.c", line 1698: warning: improper pointer/integer combination: op "="
where the constant initializer of scm_debug_opts tries to put a
SCM_BOOL_T into the unsigned long `val' member of struct scm_option_t.
Maybe a cast to scm_bits_t would be appropriate here.
The compiler also reports integer overflows:
"goops.c", line 557: warning: integer overflow detected: op "<<"
"goops.c", line 557: warning: integer overflow detected: op "<<"
"goops.c", line 576: warning: integer overflow detected: op "<<"
"goops.c", line 1311: warning: integer overflow detected: op "<<"
"goops.c", line 2486: warning: integer overflow detected: op "<<"
"struct.c", line 345: warning: integer overflow detected: op "<<"
They can be resolved by the following patch:
Index: struct.h
===================================================================
RCS file: /cvs/guile/guile-core/libguile/struct.h,v
retrieving revision 1.37
diff -u -u -r1.37 struct.h
--- struct.h 2001/05/27 22:00:03 1.37
+++ struct.h 2001/06/08 08:54:38
@@ -72,9 +72,9 @@
typedef size_t (*scm_struct_free_t) (scm_bits_t * vtable, scm_bits_t * data);
-#define SCM_STRUCTF_MASK (0xFFF << 20)
-#define SCM_STRUCTF_ENTITY (1L << 30) /* Indicates presence of proc slots */
-#define SCM_STRUCTF_LIGHT (1L << 31) /* Light representation
+#define SCM_STRUCTF_MASK (0xFFFUL << 20)
+#define SCM_STRUCTF_ENTITY (1UL << 30) /* Indicates presence of proc slots */
+#define SCM_STRUCTF_LIGHT (1UL << 31) /* Light representation
(no hidden words) */
/* Dirk:FIXME:: the SCM_STRUCTP predicate is also fulfilled for glocs */
And, finally, in num2integral.i.c when included for ptrdiff_t:
"../libguile/num2integral.i.c", line 26: warning: integer overflow detected: op
"<<"
"../libguile/num2integral.i.c", line 26: warning: integer overflow detected: op
"<<"
"../libguile/num2integral.i.c", line 45: warning: integer overflow detected: op
"<<"
"../libguile/num2integral.i.c", line 123: warning: integer overflow detected:
op "<<"
But this only caused by the dirty way PTRDIFF_MIN is computed. The
following patch helps to avoid the warning; but it's not much cleaner,
of course:
Index: numbers.c
===================================================================
RCS file: /cvs/guile/guile-core/libguile/numbers.c,v
retrieving revision 1.132
diff -u -u -r1.132 numbers.c
--- numbers.c 2001/06/07 21:12:19 1.132
+++ numbers.c 2001/06/08 09:03:11
@@ -4202,7 +4202,7 @@
#define SIZE_MAX ((size_t) (-1))
/* the below is not really guaranteed to work (I think), but probably does: */
-#define PTRDIFF_MIN ((ptrdiff_t) ((ptrdiff_t)1 << (sizeof (ptrdiff_t) * 8 -
1)))
+#define PTRDIFF_MIN ((ptrdiff_t) ((size_t)1 << (sizeof (ptrdiff_t) * 8 - 1)))
#define PTRDIFF_MAX (~ PTRDIFF_MIN)
#define NUM2INTEGRAL scm_num2short
Best regards:
--
Matthias Köppe -- http://www.math.uni-magdeburg.de/~mkoeppe