From e32a579975bc219bc24d403deeb1fa89187fc51e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 28 Jul 2012 16:05:32 -0700 Subject: [PATCH] Use Gnulib stdalign and environ modules (Bug#9772, Bug#9960). * .bzrignore: Add lib/stdalign.h. * config.bat: Do not set NO_DECL_ALIGN; no longer needed. Copy lib/stdalign.in.h to lib/stdalign.in-h as needed. * configure.ac (HAVE_ATTRIBUTE_ALIGNED): Remove the code that fiddles with this, as gnulib now does this for us. * admin/merge-gnulib: Add environ, stdalign. * m4/environ.m4: New file, from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * lib/stdalign.in.h, m4/stdalign.m4: New files, from gnulib. * sed2v2.inp (HAVE_ATTRIBUTE_ALIGNED): Remove edit. * sedlibmk.inp (STDALIGN_H, @GL_GENERATE_STDALIGN_H_TRUE@) (GL_GENERATE_STDALIGN_H_FALSE): New edits. * nt/config.nt (HAVE_ATTRIBUTE_ALIGNED): Remove. * src/alloc.c (XMALLOC_BASE_ALIGNMENT, GC_POINTER_ALIGNMENT, pure_alloc): Simplify by using alignof. (pure_alloc) [! USE_LSB_TAG]: Don't over-align EMACS_INT values. * src/lisp.h: Include . (GCALIGNMENT): New macro and constant. (DECL_ALIGN): Remove. All uses replaced by alignas (GCALIGNMENT). (USE_LSB_TAG): ifdef on alignas, not on DECL_ALIGN. (stdalign): New macro, if not already defined. --- ChangeLog | 15 +++++++++++++++ admin/ChangeLog | 5 +++++ admin/merge-gnulib | 5 +++-- config.bat | 18 +----------------- configure.ac | 13 ------------- lib/gnulib.mk | 2 +- m4/environ.m4 | 47 ++++++++++++++++++++++++++++++++++++++++++++++ m4/gnulib-comp.m4 | 4 ++++ msdos/ChangeLog | 7 +++++++ msdos/sed2v2.inp | 1 - msdos/sedlibmk.inp | 2 ++ nt/ChangeLog | 5 +++++ nt/config.nt | 3 --- src/ChangeLog | 12 ++++++++++++ src/alloc.c | 21 +++++---------------- src/buffer.c | 4 ++-- src/lisp.h | 46 +++++++++++++++++---------------------------- 17 files changed, 126 insertions(+), 84 deletions(-) create mode 100644 m4/environ.m4 diff --git a/ChangeLog b/ChangeLog index 03f4291a634..f9546f9e056 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2012-07-28 Paul Eggert + + Use Gnulib environ module (Bug#9772). + * m4/environ.m4: New file, from gnulib. + * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + This should improve portability of macros like alignof and DECL_ALIGN. + * lib/stdalign.in.h, m4/stdalign.m4: New files, from gnulib. + * .bzrignore: Add lib/stdalign.h. + * config.bat: Do not set NO_DECL_ALIGN; no longer needed. + Copy lib/stdalign.in.h to lib/stdalign.in-h as needed. + * configure.ac (HAVE_ATTRIBUTE_ALIGNED): Remove the code that + fiddles with this, as gnulib now does this for us. + 2012-07-17 Dmitry Antipov Fix toolkit configuration report. diff --git a/admin/ChangeLog b/admin/ChangeLog index b4c88c20ed1..d97e7dde32d 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Paul Eggert + + Use Gnulib environ and stdalign modules (Bug#9772, Bug#9960). + * merge-gnulib: Add environ, stdalign. + 2012-07-20 Dmitry Antipov * coccinelle/unibyte_string.cocci: Semantic patch to convert from diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 727b701cfe0..49d194c8033 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -28,11 +28,12 @@ GNULIB_URL=git://git.savannah.gnu.org/gnulib.git GNULIB_MODULES=' alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 - dtoastr dtotimespec dup2 + dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink - socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat + socklen stat-time stdalign stdarg stdio + strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings ' diff --git a/config.bat b/config.bat index 4803ad899c1..d3443d450d6 100644 --- a/config.bat +++ b/config.bat @@ -161,22 +161,6 @@ if exist config.in sed -f ../msdos/sed2x.inp < config.in > config.tmp if exist ..\autogen\config.in sed -f ../msdos/sed2x.inp < ..\autogen\config.in > config.tmp :src4 sed -f ../msdos/sed2v2.inp config.h2 -Rem See if DECL_ALIGN can be supported with this GCC -rm -f junk.c junk.o junk junk.exe -echo struct { int i; char *p; } __attribute__((__aligned__(8))) foo; >junk.c -rem Two percent signs because it is a special character for COMMAND.COM/CMD -rem Filter thru Sed because "&" is special for CMD.EXE -echo int main(void) { return (unsigned long)"&"foo %% 8; } | sed "s/.&./\&/" >>junk.c -gcc -o junk junk.c -if not exist junk.exe coff2exe junk -junk -If Not ErrorLevel 1 Goto alignOk -Echo WARNING: Your GCC does not support 8-byte aligned variables. -Echo WARNING: Therefore Emacs cannot support buffers larger than 128MB. -rem The following line disables DECL_ALIGN which in turn disables USE_LSB_TAG -rem For details see lisp.h where it defines USE_LSB_TAG -echo #define NO_DECL_ALIGN >>config.h2 -:alignOk Rem See if they have libxml2 later than v2.2.0 installed Echo Checking whether libxml2 v2.2.1 or later is installed ... rm -f junk.c junk.o junk junk.exe @@ -281,6 +265,7 @@ Rem Rename files like djtar on plain DOS filesystem would. If Exist build-aux\snippet\c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h If Exist alloca.in.h update alloca.in.h alloca.in-h If Exist getopt.in.h update getopt.in.h getopt.in-h +If Exist stdalign.in.h update stdalign.in.h stdalign.in-h If Exist stdbool.in.h update stdbool.in.h stdbool.in-h If Exist signal.in.h update signal.in.h signal.in-h If Exist stdalign.in.h update stdalign.in.h stdalign.in-h @@ -346,4 +331,3 @@ set nodebug= set djgpp_ver= set sys_malloc= set libxml= - diff --git a/configure.ac b/configure.ac index fba98513825..b43087a0aa3 100644 --- a/configure.ac +++ b/configure.ac @@ -1298,19 +1298,6 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr, dnl Check for endianness. dnl AC_C_BIGENDIAN is done by gnulib. -AC_CACHE_CHECK([for __attribute__ ((__aligned__ (expr)))], - [emacs_cv_attribute_aligned], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[char __attribute__ ((__aligned__ (1 << 3))) c;]], - [[]])], - [emacs_cv_attribute_aligned=yes], - [emacs_cv_attribute_aligned=no])]) -if test $emacs_cv_attribute_aligned = yes; then - AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, - [Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works.]) -fi - dnl check for Make feature dnl AC_PROG_MAKE_SET is done by Automake. diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 6e2bf89786c..c85b923029e 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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens 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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings MOSTLYCLEANFILES += core *.stackdump diff --git a/m4/environ.m4 b/m4/environ.m4 new file mode 100644 index 00000000000..8eb57c9d999 --- /dev/null +++ b/m4/environ.m4 @@ -0,0 +1,47 @@ +# environ.m4 serial 6 +dnl Copyright (C) 2001-2004, 2006-2012 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_ENVIRON], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Persuade glibc to declare environ. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_HEADERS_ONCE([unistd.h]) + gt_CHECK_VAR_DECL( + [#if HAVE_UNISTD_H + #include + #endif + /* mingw, BeOS, Haiku declare environ in , not in . */ + #include + ], + [environ]) + if test $gt_cv_var_environ_declaration != yes; then + HAVE_DECL_ENVIRON=0 + fi +]) + +# Check if a variable is properly declared. +# gt_CHECK_VAR_DECL(includes,variable) +AC_DEFUN([gt_CHECK_VAR_DECL], +[ + define([gt_cv_var], [gt_cv_var_]$2[_declaration]) + AC_MSG_CHECKING([if $2 is properly declared]) + AC_CACHE_VAL([gt_cv_var], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[$1 + extern struct { int foo; } $2;]], + [[$2.foo = 1;]])], + [gt_cv_var=no], + [gt_cv_var=yes])]) + AC_MSG_RESULT([$gt_cv_var]) + if test $gt_cv_var = yes; then + AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, + [Define if you have the declaration of $2.]) + fi + undefine([gt_cv_var]) +]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 754086ec2e7..b0cd185a2b5 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -52,6 +52,7 @@ AC_DEFUN([gl_EARLY], # Code from module dtoastr: # Code from module dtotimespec: # Code from module dup2: + # Code from module environ: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Code from module filemode: @@ -148,6 +149,8 @@ if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then gl_PREREQ_DUP2 fi gl_UNISTD_MODULE_INDICATOR([dup2]) +gl_ENVIRON +gl_UNISTD_MODULE_INDICATOR([environ]) gl_FILEMODE gl_GETLOADAVG if test $HAVE_GETLOADAVG = 0; then @@ -598,6 +601,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/c-strtod.m4 m4/clock_time.m4 m4/dup2.m4 + m4/environ.m4 m4/extensions.m4 m4/filemode.m4 m4/getloadavg.m4 diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 85251afef05..c5b509c72af 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,10 @@ +2012-07-28 Paul Eggert + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + * sed2v2.inp (HAVE_ATTRIBUTE_ALIGNED): Remove edit. + * sedlibmk.inp (STDALIGN_H, @GL_GENERATE_STDALIGN_H_TRUE@) + (GL_GENERATE_STDALIGN_H_FALSE): New edits. + 2012-07-14 Eli Zaretskii * sed1v2.inp: In the recipe for $(leimdir)/leim-list.el, edit the diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index 759418f0f15..214480a27ab 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -35,7 +35,6 @@ /^#undef HAVE_FREXP *$/s/^.*$/#define HAVE_FREXP 1/ /^#undef HAVE_FMOD *$/s/^.*$/#define HAVE_FMOD 1/ /^#undef HAVE_RINT *$/s/^.*$/#define HAVE_RINT 1/ -/^#undef HAVE_ATTRIBUTE_ALIGNED *$/s/^.*$/#define HAVE_ATTRIBUTE_ALIGNED 1/ /^#undef HAVE_C99_STRTOLD *$/s/^.*$/#define HAVE_C99_STRTOLD 1/ /^#undef HAVE_CBRT *$/s/^.*$/#define HAVE_CBRT 1/ /^#undef HAVE_DIFFTIME *$/s/^.*$/#define HAVE_DIFFTIME 1/ diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp index 432749af92a..b5b66753bb3 100644 --- a/msdos/sedlibmk.inp +++ b/msdos/sedlibmk.inp @@ -647,6 +647,8 @@ s/^@GL_GENERATE_ALLOCA_H_TRUE@// s/^@GL_GENERATE_ALLOCA_H_FALSE@/\#/ s/^@GL_GENERATE_STDBOOL_H_TRUE@/\#/ s/^@GL_GENERATE_STDBOOL_H_FALSE@// +s/^@GL_GENERATE_STDALIGN_H_TRUE@// +s/^@GL_GENERATE_STDALIGN_H_FALSE@/\#/ s/^@GL_GENERATE_STDARG_H_TRUE@/\#/ s/^@GL_GENERATE_STDARG_H_FALSE@/\#/ s/^@GL_GENERATE_STDDEF_H_TRUE@/\#/ diff --git a/nt/ChangeLog b/nt/ChangeLog index 16a6577cb6c..f0e9f247d14 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,8 @@ +2012-07-28 Paul Eggert + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + * config.nt (HAVE_ATTRIBUTE_ALIGNED): Remove. + 2012-07-14 Juanma Barranquero * config.nt: Sync with autogen/config.in. diff --git a/nt/config.nt b/nt/config.nt index d727cd3fafd..d32ead3d9c0 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -227,9 +227,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if ALSA is available. */ #undef HAVE_ALSA -/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */ -#undef HAVE_ATTRIBUTE_ALIGNED - /* Define to 1 if strtold conforms to C99. */ #undef HAVE_C99_STRTOLD diff --git a/src/ChangeLog b/src/ChangeLog index 6457fc2209b..cc112f4b5da 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2012-07-28 Paul Eggert + + Use Gnulib stdalign module (Bug#9772, Bug#9960). + * alloc.c (XMALLOC_BASE_ALIGNMENT, GC_POINTER_ALIGNMENT, pure_alloc): + Simplify by using alignof. + (pure_alloc) [! USE_LSB_TAG]: Don't over-align EMACS_INT values. + * lisp.h: Include . + (GCALIGNMENT): New macro and constant. + (DECL_ALIGN): Remove. All uses replaced by alignas (GCALIGNMENT). + (USE_LSB_TAG): ifdef on alignas, not on DECL_ALIGN. + (stdalign): New macro, if not already defined. + 2012-07-28 Eli Zaretskii Fix non-ASCII input in non-GUI frames on MS-Windows. (Bug#12055) 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) 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 \ - offsetof ( \ - struct { \ - union { long double d; intmax_t i; void *p; } u; \ - char c; \ - }, \ - c) + alignof (union { long double d; intmax_t i; void *p; }) #if USE_LSB_TAG # define XMALLOC_HEADER_ALIGNMENT \ @@ -4652,10 +4647,10 @@ mark_maybe_pointer (void *p) } -/* Alignment of pointer values. Use offsetof, as it sometimes returns +/* Alignment of pointer values. Use alignof, as it sometimes returns a smaller alignment than GCC's __alignof__ and mark_memory might miss objects if __alignof__ were used. */ -#define GC_POINTER_ALIGNMENT offsetof (struct {char a; void *b;}, b) +#define GC_POINTER_ALIGNMENT alignof (void *) /* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does 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) #if USE_LSB_TAG size_t alignment = (1 << GCTYPEBITS); #else - size_t alignment = sizeof (EMACS_INT); + size_t alignment = alignof (EMACS_INT); /* Give Lisp_Floats an extra alignment. */ if (type == Lisp_Float) - { -#if defined __GNUC__ && __GNUC__ >= 2 - alignment = __alignof (struct Lisp_Float); -#else - alignment = sizeof (struct Lisp_Float); -#endif - } + alignment = alignof (struct Lisp_Float); #endif again: diff --git a/src/buffer.c b/src/buffer.c index 5e45882b892..70630de53cb 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -56,7 +56,7 @@ struct buffer *all_buffers; Setting the default value also goes through the alist of buffers and stores into each buffer that does not say it has a local value. */ -DECL_ALIGN (struct buffer, buffer_defaults); +struct buffer alignas (GCALIGNMENT) buffer_defaults; /* A Lisp_Object pointer to the above, used for staticpro */ @@ -83,7 +83,7 @@ struct buffer buffer_local_flags; /* This structure holds the names of symbols whose values may be buffer-local. It is indexed and accessed in the same way as the above. */ -DECL_ALIGN (struct buffer, buffer_local_symbols); +struct buffer alignas (GCALIGNMENT) buffer_local_symbols; /* A Lisp_Object pointer to the above, used for staticpro */ static Lisp_Object Vbuffer_local_symbols; diff --git a/src/lisp.h b/src/lisp.h index 80a9ab343c3..a45e9c2c892 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -20,6 +20,7 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_LISP_H #define EMACS_LISP_H +#include #include #include #include @@ -151,10 +152,6 @@ extern int suppress_checking EXTERNALLY_VISIBLE; on the few static Lisp_Objects used: all the defsubr as well as the two special buffers buffer_defaults and buffer_local_symbols. */ -/* First, try and define DECL_ALIGN(type,var) which declares a static - variable VAR of type TYPE with the added requirement that it be - TYPEBITS-aligned. */ - enum Lisp_Bits { /* Number of bits in a Lisp_Object tag. This can be used in #if, @@ -163,6 +160,12 @@ enum Lisp_Bits #define GCTYPEBITS 3 GCTYPEBITS, + /* 2**GCTYPEBITS. This must also be a macro that expands to a + literal integer constant, for MSVC. */ + GCALIGNMENT = +#define GCALIGNMENT 8 + GCALIGNMENT, + /* Number of bits in a Lisp_Object value, not counting the tag. */ VALBITS = BITS_PER_EMACS_INT - GCTYPEBITS, @@ -173,36 +176,22 @@ enum Lisp_Bits FIXNUM_BITS = VALBITS + 1 }; +#if GCALIGNMENT != 1 << GCTYPEBITS +# error "GCALIGNMENT and GCTYPEBITS are inconsistent" +#endif + /* The maximum value that can be stored in a EMACS_INT, assuming all bits other than the type bits contribute to a nonnegative signed value. This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below. */ #define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1)) -#ifndef NO_DECL_ALIGN -# ifndef DECL_ALIGN -# if HAVE_ATTRIBUTE_ALIGNED -# define DECL_ALIGN(type, var) \ - type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var -# elif defined(_MSC_VER) -# define ALIGN_GCTYPEBITS 8 -# if (1 << GCTYPEBITS) != ALIGN_GCTYPEBITS -# error ALIGN_GCTYPEBITS is wrong! -# endif -# define DECL_ALIGN(type, var) \ - type __declspec(align(ALIGN_GCTYPEBITS)) var -# else - /* What directives do other compilers use? */ -# endif -# endif -#endif - /* Unless otherwise specified, use USE_LSB_TAG on systems where: */ #ifndef USE_LSB_TAG /* 1. We know malloc returns a multiple of 8. */ # if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \ || defined DARWIN_OS || defined __sun) /* 2. We can specify multiple-of-8 alignment on static variables. */ -# ifdef DECL_ALIGN +# ifdef alignas /* 3. Pointers-as-ints exceed VAL_MAX. On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is: a. unnecessary, because the top bits of an EMACS_INT are unused, and @@ -223,12 +212,11 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; # define USE_LSB_TAG 0 #endif -/* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op. */ -#ifndef DECL_ALIGN +#ifndef alignas +# define alignas(alignment) /* empty */ # if USE_LSB_TAG -# error "USE_LSB_TAG used without defining DECL_ALIGN" +# error "USE_LSB_TAG requires alignas" # endif -# define DECL_ALIGN(type, var) type var #endif @@ -1882,7 +1870,7 @@ typedef struct { #ifdef _MSC_VER #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ - static DECL_ALIGN (struct Lisp_Subr, sname) = \ + static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ { (PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS) \ | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)), \ { (Lisp_Object (__cdecl *)(void))fnname }, \ @@ -1891,7 +1879,7 @@ typedef struct { #else /* not _MSC_VER */ #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ - static DECL_ALIGN (struct Lisp_Subr, sname) = \ + static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ { PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS, \ { .a ## maxargs = fnname }, \ minargs, maxargs, lname, intspec, 0}; \ -- 2.39.2