diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 32 |
1 files changed, 3 insertions, 29 deletions
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) | |||
| 528 | return (void *) ROUNDUP ((uintptr_t) ptr, alignment); | 528 | return (void *) ROUNDUP ((uintptr_t) ptr, alignment); |
| 529 | } | 529 | } |
| 530 | 530 | ||
| 531 | /* Define PNTR_ADD and XPNTR as functions, which are cleaner and can | ||
| 532 | be used in debuggers. Also, define them as macros if | ||
| 533 | DEFINE_KEY_OPS_AS_MACROS, for performance in that case. | ||
| 534 | The macro_* macros are private to this section of code. */ | ||
| 535 | |||
| 536 | /* Add a pointer P to an integer I without gcc -fsanitize complaining | ||
| 537 | about the result being out of range of the underlying array. */ | ||
| 538 | |||
| 539 | #define macro_PNTR_ADD(p, i) ((p) + (i)) | ||
| 540 | |||
| 541 | static ATTRIBUTE_NO_SANITIZE_UNDEFINED ATTRIBUTE_UNUSED char * | ||
| 542 | PNTR_ADD (char *p, EMACS_UINT i) | ||
| 543 | { | ||
| 544 | return macro_PNTR_ADD (p, i); | ||
| 545 | } | ||
| 546 | |||
| 547 | #if DEFINE_KEY_OPS_AS_MACROS | ||
| 548 | # define PNTR_ADD(p, i) macro_PNTR_ADD (p, i) | ||
| 549 | #endif | ||
| 550 | |||
| 551 | /* Extract the pointer hidden within O. */ | 531 | /* Extract the pointer hidden within O. */ |
| 552 | 532 | ||
| 553 | #define macro_XPNTR(o) \ | ||
| 554 | ((void *) \ | ||
| 555 | (SYMBOLP (o) \ | ||
| 556 | ? PNTR_ADD ((char *) lispsym, \ | ||
| 557 | (XLI (o) \ | ||
| 558 | - ((EMACS_UINT) Lisp_Symbol << (USE_LSB_TAG ? 0 : VALBITS)))) \ | ||
| 559 | : (char *) XLP (o) - (XLI (o) & ~VALMASK))) | ||
| 560 | |||
| 561 | static ATTRIBUTE_NO_SANITIZE_UNDEFINED void * | 533 | static ATTRIBUTE_NO_SANITIZE_UNDEFINED void * |
| 562 | XPNTR (Lisp_Object a) | 534 | XPNTR (Lisp_Object a) |
| 563 | { | 535 | { |
| 564 | return macro_XPNTR (a); | 536 | return (SYMBOLP (a) |
| 537 | ? (char *) lispsym + (XLI (a) - LISP_WORD_TAG (Lisp_Symbol)) | ||
| 538 | : (char *) XLP (a) - (XLI (a) & ~VALMASK)); | ||
| 565 | } | 539 | } |
| 566 | 540 | ||
| 567 | static void | 541 | static void |