APPROVE COMMIT
This approach eliminates a couple of “val” may be used uninitialized in
this function warnings, as well as the casting trouble.
NOTE: This patch has been committed.
src/ChangeLog addition:
2007-06-22 Aidan Kehoe <kehoea(a)parhasard.net>
* eval.c (restore_int):
* eval.c (record_unwind_protect_restoring_int):
Conditionalise the munging of a C integer into a void pointer on
whether it's necessary at compile time, using INT_VALBITS (which
describes how many value bits a Lisp integer has) and INTBITS
(describing how many value bits a C integer has).
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: src/eval.c
===================================================================
RCS
Index: src/eval.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/eval.c,v
retrieving revision 1.96
diff -u -u -r1.96 eval.c
--- src/eval.c 2007/05/26 19:00:20 1.96
+++ src/eval.c 2007/06/22 00:04:46
@@ -6009,13 +6009,23 @@
int *addr = (int *) get_opaque_ptr (opaque);
int val;
+ /* In the event that a C integer will always fit in an Emacs int, we
+ haven't ever stored a C integer as an opaque pointer. This #ifdef
+ eliminates a warning on AMD 64, where EMACS_INT has 63 value bits and C
+ integers have 32 value bits. */
+#if INT_VALBITS < INTBITS
if (INTP (lval))
- val = XINT (lval);
+ {
+ val = XINT (lval);
+ }
else
{
val = (int) get_opaque_ptr (lval);
free_opaque_ptr (lval);
}
+#else /* !(INT_VALBITS < INTBITS) */
+ val = XINT(lval);
+#endif /* INT_VALBITS < INTBITS */
*addr = val;
free_opaque_ptr (opaque);
@@ -6032,10 +6042,19 @@
Lisp_Object opaque = make_opaque_ptr (addr);
Lisp_Object lval;
+ /* In the event that a C integer will always fit in an Emacs int, we don't
+ ever want to store a C integer as an opaque pointer. This #ifdef
+ eliminates a warning on AMD 64, where EMACS_INT has 63 value bits and C
+ integers have 32 value bits. */
+#if INT_VALBITS <= INTBITS
if (NUMBER_FITS_IN_AN_EMACS_INT (val))
lval = make_int (val);
else
lval = make_opaque_ptr ((void *) val);
+#else /* !(INT_VALBITS < INTBITS) */
+ lval = make_int (val);
+#endif /* INT_VALBITS <= INTBITS */
+
return record_unwind_protect (restore_int, noseeum_cons (opaque, lval));
}
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches