emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102874: * lisp.h: Redo flags and XSE


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102874: * lisp.h: Redo flags and XSET slightly to avoid overflow diagnostics.
Date: Sun, 16 Jan 2011 23:17:23 -0800
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102874 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2011-01-16 23:17:23 -0800
message:
  * lisp.h: Redo flags and XSET slightly to avoid overflow diagnostics.
modified:
  src/ChangeLog
  src/lisp.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-01-17 07:07:30 +0000
+++ b/src/ChangeLog     2011-01-17 07:16:08 +0000
@@ -1,5 +1,13 @@
 2011-01-17  Paul Eggert  <address@hidden>
 
+       * lisp.h: Redo flags and XSET slightly to avoid overflow diagnostics.
+       These changes make compilation easier to follow with Sun cc.
+       (ARRAY_MARK_FLAG): Make it signed, so that it can be assigned to
+       EMACS_INT values without provoking overflow diagnostics.
+       (PSEUDOVECTOR_FLAG): Likewise, for consistency.
+       (XSET) [! USE_LSB_TAG]: Use unsigned left shift to avoid overflow
+       diagnostic with signed left shift.
+
        * fileio.c (make_temp_name): Remove unreachable code.
 
        * fontset.c (free_realized_fontset): Mark unreachable code with if (0).

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2011-01-14 17:18:41 +0000
+++ b/src/lisp.h        2011-01-17 07:16:08 +0000
@@ -327,13 +327,14 @@
 #define LISP_MAKE_RVALUE(o) (0+(o))
 #endif /* USE_LISP_UNION_TYPE */
 
-/* In the size word of a vector, this bit means the vector has been marked.  */
+/* In the size word of a vector, this bit means the vector has been marked.
+   (Shift -1 left, not 1, to avoid provoking overflow diagnostics.)  */
 
-#define ARRAY_MARK_FLAG ((EMACS_UINT) 1 << (BITS_PER_EMACS_INT - 1))
+#define ARRAY_MARK_FLAG ((EMACS_INT) -1 << (BITS_PER_EMACS_INT - 1))
 
 /* In the size word of a struct Lisp_Vector, this bit means it's really
    some other vector-like object.  */
-#define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1))
+#define PSEUDOVECTOR_FLAG ((EMACS_INT) 1 << (BITS_PER_EMACS_INT - 2))
 
 /* In a pseudovector, the size field actually contains a word with one
    PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
@@ -437,8 +438,9 @@
   ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
 #endif
 
-#define XSET(var, type, ptr) \
-   ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
+#define XSET(var, type, ptr)                             \
+   ((var) = ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
+            + ((EMACS_INT) (ptr) & VALMASK)))
 
 #define XPNTR(a) ((EMACS_UINT) ((a) & VALMASK))
 
@@ -3670,4 +3672,3 @@
 
 
 #endif /* EMACS_LISP_H */
-


reply via email to

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