diff options
author | Paul Eggert <[email protected]> | 2011-01-16 23:16:08 -0800 |
---|---|---|
committer | Paul Eggert <[email protected]> | 2011-01-16 23:16:08 -0800 |
commit | 6df4097e922af99c7f051978be2df0ffbc51c929 (patch) | |
tree | f927cfcf7326a8ebde3a1ca29cb7fa8d76b881da /src/lisp.h | |
parent | 410ed5c357ccc4944cbfdbb6759683b65df6568c (diff) |
* 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.
Diffstat (limited to 'src/lisp.h')
-rw-r--r-- | src/lisp.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lisp.h b/src/lisp.h index eadbbacbff..e177f48345 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -327,13 +327,14 @@ typedef EMACS_INT Lisp_Object; #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 @@ enum pvec_type ((((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 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); #endif /* EMACS_LISP_H */ - |