From 7fc616afcfbaebea1658149da269110da94d6e59 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 12 Dec 2014 17:51:03 -0800 Subject: [PATCH] Replace union hack with C11-style max_align_t * admin/merge-gnulib (GNULIB_MODULES): Add stddef, for max_align_t. * lib/gnulib.mk: Regenerate. * src/alloc.c (XMALLOC_BASE_ALIGNMENT): Use max_align_t instead of a hack involving a union. --- ChangeLog | 8 ++++++++ admin/merge-gnulib | 2 +- lib/gnulib.mk | 2 +- src/alloc.c | 3 +-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d9aea676c4..85edd9faf18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-12-13 Paul Eggert + + Replace union hack with C11-style max_align_t + * admin/merge-gnulib (GNULIB_MODULES): Add stddef, for max_align_t. + * lib/gnulib.mk: Regenerate. + * src/alloc.c (XMALLOC_BASE_ALIGNMENT): Use max_align_t instead of + a hack involving a union. + 2014-12-12 Paul Eggert Git ignore lib/std*.h diff --git a/admin/merge-gnulib b/admin/merge-gnulib index dc3cd6cf541..64514f79bdd 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -35,7 +35,7 @@ GNULIB_MODULES=' intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat - sig2str socklen stat-time stdalign stdio + sig2str socklen stat-time stdalign stddef stdio strftime strtoimax strtoumax symlink sys_stat sys_time time time_r timer-time timespec-add timespec-sub unsetenv update-copyright utimens diff --git a/lib/gnulib.mk b/lib/gnulib.mk index c54b8117842..740ebb1e96c 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -21,7 +21,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stdio strftime strtoimax strtoumax symlink sys_stat sys_time time time_r timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode fstatat fsync getloadavg getopt-gnu gettime gettimeofday intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qacl readlink readlinkat sig2str socklen stat-time stdalign stddef stdio strftime strtoimax strtoumax symlink sys_stat sys_time time time_r timer-time timespec-add timespec-sub unsetenv update-copyright utimens vla warnings MOSTLYCLEANFILES += core *.stackdump diff --git a/src/alloc.c b/src/alloc.c index 35a5ee2784f..43287457c8d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -534,8 +534,7 @@ buffer_memory_full (ptrdiff_t nbytes) /* Define XMALLOC_OVERRUN_SIZE_SIZE so that (1) it's large enough to hold a size_t value and (2) the header size is a multiple of the alignment that Emacs needs for C types and for USE_LSB_TAG. */ -#define XMALLOC_BASE_ALIGNMENT \ - alignof (union { long double d; intmax_t i; void *p; }) +#define XMALLOC_BASE_ALIGNMENT alignof (max_align_t) #if USE_LSB_TAG # define XMALLOC_HEADER_ALIGNMENT \ -- 2.39.2