2014-09-10 Paul Eggert <eggert@cs.ucla.edu>
+ * 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.
+
Improve the experimental local and scoped allocation.
* alloc.c (local_string_init, local_vector_init):
New functions, defined if USE_LOCAL_ALLOCATORS.
/* Define a TYPE constant ID as an externally visible name. Use like this:
- #define ID_val (some integer preprocessor expression)
- #if ENUMABLE (ID_val)
- DEFINE_GDB_SYMBOL_ENUM (ID)
- #else
DEFINE_GDB_SYMBOL_BEGIN (TYPE, ID)
- # define ID ID_val
+ # define ID (some integer preprocessor expression of type TYPE)
DEFINE_GDB_SYMBOL_END (ID)
- #endif
This hack is for the benefit of compilers that do not make macro
- definitions visible to the debugger. It's used for symbols that
- .gdbinit needs, symbols whose values may not fit in 'int' (where an
- enum would suffice).
+ definitions or enums visible to the debugger. It's used for symbols
+ that .gdbinit needs. */
- Some GCC versions before GCC 4.2 omit enums in debugging output;
- see GCC bug 23336. So don't use enums with older GCC. */
-
-#if !defined __GNUC__ || 4 < __GNUC__ + (2 <= __GNUC_MINOR__)
-# define ENUMABLE(val) (INT_MIN <= (val) && (val) <= INT_MAX)
-#else
-# define ENUMABLE(val) 0
-#endif
-
-#define DEFINE_GDB_SYMBOL_ENUM(id) enum { id = id##_val };
-#if defined MAIN_PROGRAM
+#ifdef MAIN_PROGRAM
# define DEFINE_GDB_SYMBOL_BEGIN(type, id) type const id EXTERNALLY_VISIBLE
# define DEFINE_GDB_SYMBOL_END(id) = id;
#else
/* In the size word of a vector, this bit means the vector has been marked. */
-#define ARRAY_MARK_FLAG_val PTRDIFF_MIN
-#if ENUMABLE (ARRAY_MARK_FLAG_val)
-DEFINE_GDB_SYMBOL_ENUM (ARRAY_MARK_FLAG)
-#else
DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, ARRAY_MARK_FLAG)
-# define ARRAY_MARK_FLAG ARRAY_MARK_FLAG_val
+# define ARRAY_MARK_FLAG PTRDIFF_MIN
DEFINE_GDB_SYMBOL_END (ARRAY_MARK_FLAG)
-#endif
/* In the size word of a struct Lisp_Vector, this bit means it's really
some other vector-like object. */
-#define PSEUDOVECTOR_FLAG_val (PTRDIFF_MAX - PTRDIFF_MAX / 2)
-#if ENUMABLE (PSEUDOVECTOR_FLAG_val)
-DEFINE_GDB_SYMBOL_ENUM (PSEUDOVECTOR_FLAG)
-#else
DEFINE_GDB_SYMBOL_BEGIN (ptrdiff_t, PSEUDOVECTOR_FLAG)
-# define PSEUDOVECTOR_FLAG PSEUDOVECTOR_FLAG_val
+# define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2)
DEFINE_GDB_SYMBOL_END (PSEUDOVECTOR_FLAG)
-#endif
/* In a pseudovector, the size field actually contains a word with one
PSEUDOVECTOR_FLAG bit set, and one of the following values extracted
that cons. */
/* Mask for the value (as opposed to the type bits) of a Lisp object. */
-#define VALMASK_val (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX)
-#if ENUMABLE (VALMASK_val)
-DEFINE_GDB_SYMBOL_ENUM (VALMASK)
-#else
DEFINE_GDB_SYMBOL_BEGIN (EMACS_INT, VALMASK)
-# define VALMASK VALMASK_val
+# define VALMASK (USE_LSB_TAG ? - (1 << GCTYPEBITS) : VAL_MAX)
DEFINE_GDB_SYMBOL_END (VALMASK)
-#endif
/* Largest and smallest representable fixnum values. These are the C
values. They are macros for use in static initializers. */