diff options
| author | Paul Eggert | 2011-01-16 23:16:08 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-01-16 23:16:08 -0800 |
| commit | 6df4097e922af99c7f051978be2df0ffbc51c929 (patch) | |
| tree | f927cfcf7326a8ebde3a1ca29cb7fa8d76b881da /src | |
| parent | 410ed5c357ccc4944cbfdbb6759683b65df6568c (diff) | |
| download | emacs-6df4097e922af99c7f051978be2df0ffbc51c929.tar.gz emacs-6df4097e922af99c7f051978be2df0ffbc51c929.zip | |
* 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')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/lisp.h | 13 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 40b6e0e6195..cb51917bb31 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2011-01-17 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-01-17 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * lisp.h: Redo flags and XSET slightly to avoid overflow diagnostics. | ||
| 4 | These changes make compilation easier to follow with Sun cc. | ||
| 5 | (ARRAY_MARK_FLAG): Make it signed, so that it can be assigned to | ||
| 6 | EMACS_INT values without provoking overflow diagnostics. | ||
| 7 | (PSEUDOVECTOR_FLAG): Likewise, for consistency. | ||
| 8 | (XSET) [! USE_LSB_TAG]: Use unsigned left shift to avoid overflow | ||
| 9 | diagnostic with signed left shift. | ||
| 10 | |||
| 3 | * fileio.c (make_temp_name): Remove unreachable code. | 11 | * fileio.c (make_temp_name): Remove unreachable code. |
| 4 | 12 | ||
| 5 | * fontset.c (free_realized_fontset): Mark unreachable code with if (0). | 13 | * fontset.c (free_realized_fontset): Mark unreachable code with if (0). |
diff --git a/src/lisp.h b/src/lisp.h index eadbbacbff4..e177f483452 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -327,13 +327,14 @@ typedef EMACS_INT Lisp_Object; | |||
| 327 | #define LISP_MAKE_RVALUE(o) (0+(o)) | 327 | #define LISP_MAKE_RVALUE(o) (0+(o)) |
| 328 | #endif /* USE_LISP_UNION_TYPE */ | 328 | #endif /* USE_LISP_UNION_TYPE */ |
| 329 | 329 | ||
| 330 | /* In the size word of a vector, this bit means the vector has been marked. */ | 330 | /* In the size word of a vector, this bit means the vector has been marked. |
| 331 | (Shift -1 left, not 1, to avoid provoking overflow diagnostics.) */ | ||
| 331 | 332 | ||
| 332 | #define ARRAY_MARK_FLAG ((EMACS_UINT) 1 << (BITS_PER_EMACS_INT - 1)) | 333 | #define ARRAY_MARK_FLAG ((EMACS_INT) -1 << (BITS_PER_EMACS_INT - 1)) |
| 333 | 334 | ||
| 334 | /* In the size word of a struct Lisp_Vector, this bit means it's really | 335 | /* In the size word of a struct Lisp_Vector, this bit means it's really |
| 335 | some other vector-like object. */ | 336 | some other vector-like object. */ |
| 336 | #define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1)) | 337 | #define PSEUDOVECTOR_FLAG ((EMACS_INT) 1 << (BITS_PER_EMACS_INT - 2)) |
| 337 | 338 | ||
| 338 | /* In a pseudovector, the size field actually contains a word with one | 339 | /* In a pseudovector, the size field actually contains a word with one |
| 339 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to | 340 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to |
| @@ -437,8 +438,9 @@ enum pvec_type | |||
| 437 | ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS) | 438 | ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS) |
| 438 | #endif | 439 | #endif |
| 439 | 440 | ||
| 440 | #define XSET(var, type, ptr) \ | 441 | #define XSET(var, type, ptr) \ |
| 441 | ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK)) | 442 | ((var) = ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \ |
| 443 | + ((EMACS_INT) (ptr) & VALMASK))) | ||
| 442 | 444 | ||
| 443 | #define XPNTR(a) ((EMACS_UINT) ((a) & VALMASK)) | 445 | #define XPNTR(a) ((EMACS_UINT) ((a) & VALMASK)) |
| 444 | 446 | ||
| @@ -3670,4 +3672,3 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object); | |||
| 3670 | 3672 | ||
| 3671 | 3673 | ||
| 3672 | #endif /* EMACS_LISP_H */ | 3674 | #endif /* EMACS_LISP_H */ |
| 3673 | |||