From: Paul Eggert Date: Mon, 22 Apr 2019 04:45:04 +0000 (-0700) Subject: Simplify XPNTR X-Git-Tag: emacs-27.0.90~3152 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=418400ab7b36d873905f5ab5e1e07f2bdbd05f9c;p=emacs.git 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. --- diff --git a/src/alloc.c b/src/alloc.c index a9cdd77ef2e..186a4c6a098 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -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