]> code.delx.au - gnu-emacs/commitdiff
Replace union hack with C11-style max_align_t
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 13 Dec 2014 01:51:03 +0000 (17:51 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 13 Dec 2014 01:54:02 +0000 (17:54 -0800)
* 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
admin/merge-gnulib
lib/gnulib.mk
src/alloc.c

index 9d9aea676c4a57a492f9b0cc06eebdfe731a6dbb..85edd9faf18f362f35fb75d9dffd0b423ec90fbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <eggert@cs.ucla.edu>
 
        Git ignore lib/std*.h
index dc3cd6cf5413da71bc1fd29925c0123db57c27fb..64514f79bddcb1b7906cc676a1af17e925f5d40d 100755 (executable)
@@ -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
index c54b8117842ff84fe8597acd569a9b797e5736e6..740ebb1e96c2e61dbe404d1b1a4183854bc966b1 100644 (file)
@@ -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
index 35a5ee2784ffd95b27db22eb4b0fb2a7f7386c59..43287457c8d21c9f78fb3e8252f72b3a66d3a9d4 100644 (file)
@@ -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 \