diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/alloc.c b/src/alloc.c index a551dd821b8..e5f412bb4c3 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -533,12 +533,7 @@ buffer_memory_full (ptrdiff_t nbytes) | |||
| 533 | hold a size_t value and (2) the header size is a multiple of the | 533 | hold a size_t value and (2) the header size is a multiple of the |
| 534 | alignment that Emacs needs for C types and for USE_LSB_TAG. */ | 534 | alignment that Emacs needs for C types and for USE_LSB_TAG. */ |
| 535 | #define XMALLOC_BASE_ALIGNMENT \ | 535 | #define XMALLOC_BASE_ALIGNMENT \ |
| 536 | offsetof ( \ | 536 | alignof (union { long double d; intmax_t i; void *p; }) |
| 537 | struct { \ | ||
| 538 | union { long double d; intmax_t i; void *p; } u; \ | ||
| 539 | char c; \ | ||
| 540 | }, \ | ||
| 541 | c) | ||
| 542 | 537 | ||
| 543 | #if USE_LSB_TAG | 538 | #if USE_LSB_TAG |
| 544 | # define XMALLOC_HEADER_ALIGNMENT \ | 539 | # define XMALLOC_HEADER_ALIGNMENT \ |
| @@ -4652,10 +4647,10 @@ mark_maybe_pointer (void *p) | |||
| 4652 | } | 4647 | } |
| 4653 | 4648 | ||
| 4654 | 4649 | ||
| 4655 | /* Alignment of pointer values. Use offsetof, as it sometimes returns | 4650 | /* Alignment of pointer values. Use alignof, as it sometimes returns |
| 4656 | a smaller alignment than GCC's __alignof__ and mark_memory might | 4651 | a smaller alignment than GCC's __alignof__ and mark_memory might |
| 4657 | miss objects if __alignof__ were used. */ | 4652 | miss objects if __alignof__ were used. */ |
| 4658 | #define GC_POINTER_ALIGNMENT offsetof (struct {char a; void *b;}, b) | 4653 | #define GC_POINTER_ALIGNMENT alignof (void *) |
| 4659 | 4654 | ||
| 4660 | /* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does | 4655 | /* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does |
| 4661 | not suffice, which is the typical case. A host where a Lisp_Object is | 4656 | not suffice, which is the typical case. A host where a Lisp_Object is |
| @@ -5103,17 +5098,11 @@ pure_alloc (size_t size, int type) | |||
| 5103 | #if USE_LSB_TAG | 5098 | #if USE_LSB_TAG |
| 5104 | size_t alignment = (1 << GCTYPEBITS); | 5099 | size_t alignment = (1 << GCTYPEBITS); |
| 5105 | #else | 5100 | #else |
| 5106 | size_t alignment = sizeof (EMACS_INT); | 5101 | size_t alignment = alignof (EMACS_INT); |
| 5107 | 5102 | ||
| 5108 | /* Give Lisp_Floats an extra alignment. */ | 5103 | /* Give Lisp_Floats an extra alignment. */ |
| 5109 | if (type == Lisp_Float) | 5104 | if (type == Lisp_Float) |
| 5110 | { | 5105 | alignment = alignof (struct Lisp_Float); |
| 5111 | #if defined __GNUC__ && __GNUC__ >= 2 | ||
| 5112 | alignment = __alignof (struct Lisp_Float); | ||
| 5113 | #else | ||
| 5114 | alignment = sizeof (struct Lisp_Float); | ||
| 5115 | #endif | ||
| 5116 | } | ||
| 5117 | #endif | 5106 | #endif |
| 5118 | 5107 | ||
| 5119 | again: | 5108 | again: |