diff options
| author | Paul Eggert | 2014-09-10 09:52:50 -0700 |
|---|---|---|
| committer | Paul Eggert | 2014-09-10 09:52:50 -0700 |
| commit | c9c0610d077a6a31f2c2aa06f201936034837184 (patch) | |
| tree | 0068fdcf8a81a7b348eee1fb3b30f283a1099774 /src | |
| parent | 47003633639a963d2a911d51bf69f4e29d36ff53 (diff) | |
| download | emacs-c9c0610d077a6a31f2c2aa06f201936034837184.tar.gz emacs-c9c0610d077a6a31f2c2aa06f201936034837184.zip | |
* lisp.h (DEFINE_GDB_SYMBOL_ENUM): Remove.
These can generate a constant with the correct value but the wrong
width, which doesn't work as a printf argument. All uses removed.
Problem reported by Dmitry Antipov in:
http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00213.html
(ENUMABLE): Remove; no longer needed.
(ARRAY_MARK_FLAG_val, PSEUDOVECTOR_FLAG_val, VALMASK_val):
Remove; no longer needed because of the above change.
Each definiens moved to the only use.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/lisp.h | 45 |
2 files changed, 17 insertions, 38 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b98d4eef355..ed9c3e71a55 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,15 @@ | |||
| 1 | 2014-09-10 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2014-09-10 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * lisp.h (DEFINE_GDB_SYMBOL_ENUM): Remove. | ||
| 4 | These can generate a constant with the correct value but the wrong | ||
| 5 | width, which doesn't work as a printf argument. All uses removed. | ||
| 6 | Problem reported by Dmitry Antipov in: | ||
| 7 | http://lists.gnu.org/archive/html/emacs-devel/2014-09/msg00213.html | ||
| 8 | (ENUMABLE): Remove; no longer needed. | ||
| 9 | (ARRAY_MARK_FLAG_val, PSEUDOVECTOR_FLAG_val, VALMASK_val): | ||
| 10 | Remove; no longer needed because of the above change. | ||
| 11 | Each definiens moved to the only use. | ||
| 12 | |||
| 3 | Improve the experimental local and scoped allocation. | 13 | Improve the experimental local and scoped allocation. |
| 4 | * alloc.c (local_string_init, local_vector_init): | 14 | * alloc.c (local_string_init, local_vector_init): |
| 5 | New functions, defined if USE_LOCAL_ALLOCATORS. | 15 | New functions, defined if USE_LOCAL_ALLOCATORS. |
diff --git a/src/lisp.h b/src/lisp.h index 3c7eb44b36d..1415ab270bc 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -36,31 +36,15 @@ INLINE_HEADER_BEGIN | |||
| 36 | 36 | ||
| 37 | /* Define a TYPE constant ID as an externally visible name. Use like this: | 37 | /* Define a TYPE constant ID as an externally visible name. Use like this: |
| 38 | 38 | ||
| 39 | #define ID_val (some integer preprocessor expression) | ||
| 40 | #if ENUMABLE (ID_val) | ||
| 41 | DEFINE_GDB_SYMBOL_ENUM (ID) | ||
| 42 | #else | ||
| 43 | DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID) | 39 | DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID) |
| 44 | # define ID ID_val | 40 | # define ID (some integer preprocessor expression of type TYPE) |
| 45 | DEFINE_GDB_SYMBOL_END (ID) | 41 | DEFINE_GDB_SYMBOL_END (ID) |
| 46 | #endif | ||
| 47 | 42 | ||
| 48 | This hack is for the benefit of compilers that do not make macro | 43 | This hack is for the benefit of compilers that do not make macro |
| 49 | definitions visible to the debugger. It's used for symbols that | 44 | definitions or enums visible to the debugger. It's used for symbols |
| 50 | .gdbinit needs, symbols whose values may not fit in 'int' (where an | 45 | that .gdbinit needs. */ |
| 51 | enum would suffice). | ||
| 52 | 46 | ||
| 53 | Some GCC versions before GCC 4.2 omit enums in debugging output; | 47 | #ifdef MAIN_PROGRAM |
| 54 | see GCC bug 23336. So don't use enums with older GCC. */ | ||
| 55 | |||
| 56 | #if !defined __GNUC__ || 4 < __GNUC__ + (2 <= __GNUC_MINOR__) | ||
| 57 | # define ENUMABLE(val) (INT_MIN <= (val) && (val) <= INT_MAX) | ||
| 58 | #else | ||
| 59 | # define ENUMABLE(val) 0 | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #define DEFINE_GDB_SYMBOL_ENUM(id) enum { id = id##_val }; | ||
| 63 | #if defined MAIN_PROGRAM | ||
| 64 | # define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE | 48 | # define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE |
| 65 | # define DEFINE_GDB_SYMBOL_END(id) = id; | 49 | # define DEFINE_GDB_SYMBOL_END(id) = id; |
| 66 | #else | 50 | #else |
| @@ -600,25 +584,15 @@ LISP_MACRO_DEFUN (XIL, Lisp_Object, (EMACS_INT i), (i)) | |||
| 600 | 584 | ||
| 601 | /* In the size word of a vector, this bit means the vector has been marked. */ | 585 | /* In the size word of a vector, this bit means the vector has been marked. */ |
| 602 | 586 | ||
| 603 | #define ARRAY_MARK_FLAG_val PTRDIFF_MIN | ||
| 604 | #if ENUMABLE (ARRAY_MARK_FLAG_val) | ||
| 605 | DEFINE_GDB_SYMBOL_ENUM (ARRAY_MARK_FLAG) | ||
| 606 | #else | ||
| 607 | DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG) | 587 | DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG) |
| 608 | # define ARRAY_MARK_FLAG ARRAY_MARK_FLAG_val | 588 | # define ARRAY_MARK_FLAG PTRDIFF_MIN |
| 609 | DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG) | 589 | DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG) |
| 610 | #endif | ||
| 611 | 590 | ||
| 612 | /* In the size word of a struct Lisp_Vector, this bit means it's really | 591 | /* In the size word of a struct Lisp_Vector, this bit means it's really |
| 613 | some other vector-like object. */ | 592 | some other vector-like object. */ |
| 614 | #define PSEUDOVECTOR_FLAG_val (PTRDIFF_MAX - PTRDIFF_MAX / 2) | ||
| 615 | #if ENUMABLE (PSEUDOVECTOR_FLAG_val) | ||
| 616 | DEFINE_GDB_SYMBOL_ENUM (PSEUDOVECTOR_FLAG) | ||
| 617 | #else | ||
| 618 | DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG) | 593 | DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG) |
| 619 | # define PSEUDOVECTOR_FLAG PSEUDOVECTOR_FLAG_val | 594 | # define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) |
| 620 | DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG) | 595 | DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG) |
| 621 | #endif | ||
| 622 | 596 | ||
| 623 | /* In a pseudovector, the size field actually contains a word with one | 597 | /* In a pseudovector, the size field actually contains a word with one |
| 624 | PSEUDOVECTOR_FLAG bit set, and one of the following values extracted | 598 | PSEUDOVECTOR_FLAG bit set, and one of the following values extracted |
| @@ -671,14 +645,9 @@ enum More_Lisp_Bits | |||
| 671 | that cons. */ | 645 | that cons. */ |
| 672 | 646 | ||
| 673 | /* Mask for the value (as opposed to the type bits) of a Lisp object. */ | 647 | /* Mask for the value (as opposed to the type bits) of a Lisp object. */ |
| 674 | #define VALMASK_val (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) | ||
| 675 | #if ENUMABLE (VALMASK_val) | ||
| 676 | DEFINE_GDB_SYMBOL_ENUM (VALMASK) | ||
| 677 | #else | ||
| 678 | DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) | 648 | DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) |
| 679 | # define VALMASK VALMASK_val | 649 | # define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) |
| 680 | DEFINE_GDB_SYMBOL_END (VALMASK) | 650 | DEFINE_GDB_SYMBOL_END (VALMASK) |
| 681 | #endif | ||
| 682 | 651 | ||
| 683 | /* Largest and smallest representable fixnum values. These are the C | 652 | /* Largest and smallest representable fixnum values. These are the C |
| 684 | values. They are macros for use in static initializers. */ | 653 | values. They are macros for use in static initializers. */ |