aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/lisp.h b/src/lisp.h
index c7fc5962349..af54887a51a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -36,14 +36,21 @@ 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
39 DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID) 43 DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID)
40 #define ID something 44 # define ID ID_val
41 DEFINE_GDB_SYMBOL_END (ID) 45 DEFINE_GDB_SYMBOL_END (ID)
46 #endif
42 47
43 This hack is for the benefit of compilers that do not make macro 48 This hack is for the benefit of compilers that do not make macro
44 definitions visible to the debugger. It's used for symbols that 49 definitions visible to the debugger. It's used for symbols that
45 .gdbinit needs, symbols whose values may not fit in 'int' (where an 50 .gdbinit needs, symbols whose values may not fit in 'int' (where an
46 enum would suffice). */ 51 enum would suffice). */
52#define ENUMABLE(val) (INT_MIN <= (val) && (val) <= INT_MAX)
53#define DEFINE_GDB_SYMBOL_ENUM(id) enum { id = id##_val };
47#if defined MAIN_PROGRAM 54#if defined MAIN_PROGRAM
48# define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE 55# define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE
49# define DEFINE_GDB_SYMBOL_END(id) = id; 56# define DEFINE_GDB_SYMBOL_END(id) = id;
@@ -571,15 +578,25 @@ LISP_MACRO_DEFUN (XIL, Lisp_Object, (EMACS_INT i), (i))
571 578
572/* In the size word of a vector, this bit means the vector has been marked. */ 579/* In the size word of a vector, this bit means the vector has been marked. */
573 580
581#define ARRAY_MARK_FLAG_val PTRDIFF_MIN
582#if ENUMABLE (ARRAY_MARK_FLAG_val)
583DEFINE_GDB_SYMBOL_ENUM (ARRAY_MARK_FLAG)
584#else
574DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG) 585DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG)
575#define ARRAY_MARK_FLAG PTRDIFF_MIN 586# define ARRAY_MARK_FLAG ARRAY_MARK_FLAG_val
576DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG) 587DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG)
588#endif
577 589
578/* In the size word of a struct Lisp_Vector, this bit means it's really 590/* In the size word of a struct Lisp_Vector, this bit means it's really
579 some other vector-like object. */ 591 some other vector-like object. */
592#define PSEUDOVECTOR_FLAG_val (PTRDIFF_MAX - PTRDIFF_MAX / 2)
593#if ENUMABLE (PSEUDOVECTOR_FLAG_val)
594DEFINE_GDB_SYMBOL_ENUM (PSEUDOVECTOR_FLAG)
595#else
580DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG) 596DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG)
581#define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) 597# define PSEUDOVECTOR_FLAG PSEUDOVECTOR_FLAG_val
582DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG) 598DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG)
599#endif
583 600
584/* In a pseudovector, the size field actually contains a word with one 601/* In a pseudovector, the size field actually contains a word with one
585 PSEUDOVECTOR_FLAG bit set, and one of the following values extracted 602 PSEUDOVECTOR_FLAG bit set, and one of the following values extracted
@@ -641,9 +658,15 @@ enum More_Lisp_Bits
641 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for 658 XCONS (tem) is the struct Lisp_Cons * pointing to the memory for
642 that cons. */ 659 that cons. */
643 660
661/* Mask for the value (as opposed to the type bits) of a Lisp object. */
662#define VALMASK_val (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX)
663#if ENUMABLE (VALMASK_val)
664DEFINE_GDB_SYMBOL_ENUM (VALMASK)
665#else
644DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK) 666DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK)
645#define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX) 667# define VALMASK VALMASK_val
646DEFINE_GDB_SYMBOL_END (VALMASK) 668DEFINE_GDB_SYMBOL_END (VALMASK)
669#endif
647 670
648/* Largest and smallest representable fixnum values. These are the C 671/* Largest and smallest representable fixnum values. These are the C
649 values. They are macros for use in static initializers. */ 672 values. They are macros for use in static initializers. */