Commit 418400ab authored by Paul Eggert's avatar Paul Eggert

Simplify XPNTR

Because XPNTR now uses ATTRIBUTE_NO_SANITIZE_UNDEFINED,
it can be simplified.
* src/alloc.c (macro_PNTR_ADD, PNTR_ADD, macro_XPNTR): Remove.
(XPNTR): Open-code rather than using the removed macros and
functions.  Also, simplify by using LISP_WORD_TAG.
parent e85bff0b
Pipeline #1394 passed with stage
in 50 minutes and 56 seconds
......@@ -528,40 +528,14 @@ pointer_align (void *ptr, int alignment)
return (void *) ROUNDUP ((uintptr_t) ptr, alignment);
}
/* Define PNTR_ADD and XPNTR as functions, which are cleaner and can
be used in debuggers. Also, define them as macros if
DEFINE_KEY_OPS_AS_MACROS, for performance in that case.
The macro_* macros are private to this section of code. */
/* Add a pointer P to an integer I without gcc -fsanitize complaining
about the result being out of range of the underlying array. */
#define macro_PNTR_ADD(p, i) ((p) + (i))
static ATTRIBUTE_NO_SANITIZE_UNDEFINED ATTRIBUTE_UNUSED char *
PNTR_ADD (char *p, EMACS_UINT i)
{
return macro_PNTR_ADD (p, i);
}
#if DEFINE_KEY_OPS_AS_MACROS
# define PNTR_ADD(p, i) macro_PNTR_ADD (p, i)
#endif
/* Extract the pointer hidden within O. */
#define macro_XPNTR(o) \
((void *) \
(SYMBOLP (o) \
? PNTR_ADD ((char *) lispsym, \
(XLI (o) \
- ((EMACS_UINT) Lisp_Symbol << (USE_LSB_TAG ? 0 : VALBITS)))) \
: (char *) XLP (o) - (XLI (o) & ~VALMASK)))
static ATTRIBUTE_NO_SANITIZE_UNDEFINED void *
XPNTR (Lisp_Object a)
{
return macro_XPNTR (a);
return (SYMBOLP (a)
? (char *) lispsym + (XLI (a) - LISP_WORD_TAG (Lisp_Symbol))
: (char *) XLP (a) - (XLI (a) & ~VALMASK));
}
static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment