[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109252: Use Gnulib stdalign and envi
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109252: Use Gnulib stdalign and environ modules (Bug#9772, Bug#9960). |
Date: |
Sat, 28 Jul 2012 16:05:32 -0700 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109252
fixes bugs: http://debbugs.gnu.org/9772 http://debbugs.gnu.org/9960
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2012-07-28 16:05:32 -0700
message:
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 <stdalign.h>.
(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.
added:
m4/environ.m4
modified:
.bzrignore
ChangeLog
admin/ChangeLog
admin/merge-gnulib
config.bat
configure.ac
lib/gnulib.mk
m4/gnulib-comp.m4
msdos/ChangeLog
msdos/sed2v2.inp
msdos/sedlibmk.inp
nt/ChangeLog
nt/config.nt
src/ChangeLog
src/alloc.c
src/buffer.c
src/lisp.h
=== modified file '.bzrignore'
--- a/.bzrignore 2012-06-06 01:38:04 +0000
+++ b/.bzrignore 2012-07-28 23:05:32 +0000
@@ -86,6 +86,7 @@
lib/c++defs.h
lib/getopt.h
lib/inttypes.h
+lib/stdalign.h
lib/stdbool.h
lib/stdio.h
lib/stdint.h
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-07-17 07:30:25 +0000
+++ b/ChangeLog 2012-07-28 23:05:32 +0000
@@ -1,3 +1,18 @@
+2012-07-28 Paul Eggert <address@hidden>
+
+ 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 <address@hidden>
Fix toolkit configuration report.
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog 2012-07-20 07:29:04 +0000
+++ b/admin/ChangeLog 2012-07-28 23:05:32 +0000
@@ -1,3 +1,8 @@
+2012-07-28 Paul Eggert <address@hidden>
+
+ Use Gnulib environ and stdalign modules (Bug#9772, Bug#9960).
+ * merge-gnulib: Add environ, stdalign.
+
2012-07-20 Dmitry Antipov <address@hidden>
* coccinelle/unibyte_string.cocci: Semantic patch to convert from
=== modified file 'admin/merge-gnulib'
--- a/admin/merge-gnulib 2012-07-06 21:07:46 +0000
+++ b/admin/merge-gnulib 2012-07-28 23:05:32 +0000
@@ -28,11 +28,12 @@
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
'
=== modified file 'config.bat'
--- a/config.bat 2012-05-27 13:42:13 +0000
+++ b/config.bat 2012-07-28 23:05:32 +0000
@@ -161,22 +161,6 @@
if exist ..\autogen\config.in sed -f ../msdos/sed2x.inp < ..\autogen\config.in
> config.tmp
:src4
sed -f ../msdos/sed2v2.inp <config.tmp >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 @@
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 djgpp_ver=
set sys_malloc=
set libxml=
-
=== modified file 'configure.ac'
--- a/configure.ac 2012-07-17 07:30:25 +0000
+++ b/configure.ac 2012-07-28 23:05:32 +0000
@@ -1298,19 +1298,6 @@
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.
=== modified file 'lib/gnulib.mk'
--- a/lib/gnulib.mk 2012-07-06 21:07:46 +0000
+++ b/lib/gnulib.mk 2012-07-28 23:05:32 +0000
@@ -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
=== added file 'm4/environ.m4'
--- a/m4/environ.m4 1970-01-01 00:00:00 +0000
+++ b/m4/environ.m4 2012-07-28 23:05:32 +0000
@@ -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 <unistd.h> to declare environ.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_HEADERS_ONCE([unistd.h])
+ gt_CHECK_VAR_DECL(
+ [#if HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.
*/
+ #include <stdlib.h>
+ ],
+ [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])
+])
=== modified file 'm4/gnulib-comp.m4'
--- a/m4/gnulib-comp.m4 2012-07-09 08:34:39 +0000
+++ b/m4/gnulib-comp.m4 2012-07-28 23:05:32 +0000
@@ -52,6 +52,7 @@
# 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 @@
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 @@
m4/c-strtod.m4
m4/clock_time.m4
m4/dup2.m4
+ m4/environ.m4
m4/extensions.m4
m4/filemode.m4
m4/getloadavg.m4
=== modified file 'msdos/ChangeLog'
--- a/msdos/ChangeLog 2012-07-14 10:03:30 +0000
+++ b/msdos/ChangeLog 2012-07-28 23:05:32 +0000
@@ -1,3 +1,10 @@
+2012-07-28 Paul Eggert <address@hidden>
+
+ 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 <address@hidden>
* sed1v2.inp: In the recipe for $(leimdir)/leim-list.el, edit the
=== modified file 'msdos/sed2v2.inp'
--- a/msdos/sed2v2.inp 2012-07-14 10:03:30 +0000
+++ b/msdos/sed2v2.inp 2012-07-28 23:05:32 +0000
@@ -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/
=== modified file 'msdos/sedlibmk.inp'
--- a/msdos/sedlibmk.inp 2012-07-14 10:03:30 +0000
+++ b/msdos/sedlibmk.inp 2012-07-28 23:05:32 +0000
@@ -647,6 +647,8 @@
s/address@hidden@/\#/
s/address@hidden@/\#/
s/address@hidden@//
+s/address@hidden@//
+s/address@hidden@/\#/
s/address@hidden@/\#/
s/address@hidden@/\#/
s/address@hidden@/\#/
=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog 2012-07-14 02:26:31 +0000
+++ b/nt/ChangeLog 2012-07-28 23:05:32 +0000
@@ -1,3 +1,8 @@
+2012-07-28 Paul Eggert <address@hidden>
+
+ Use Gnulib stdalign module (Bug#9772, Bug#9960).
+ * config.nt (HAVE_ATTRIBUTE_ALIGNED): Remove.
+
2012-07-14 Juanma Barranquero <address@hidden>
* config.nt: Sync with autogen/config.in.
=== modified file 'nt/config.nt'
--- a/nt/config.nt 2012-07-14 02:26:31 +0000
+++ b/nt/config.nt 2012-07-28 23:05:32 +0000
@@ -227,9 +227,6 @@
/* 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
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-07-28 16:57:57 +0000
+++ b/src/ChangeLog 2012-07-28 23:05:32 +0000
@@ -1,3 +1,15 @@
+2012-07-28 Paul Eggert <address@hidden>
+
+ 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 <stdalign.h>.
+ (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 <address@hidden>
Fix non-ASCII input in non-GUI frames on MS-Windows. (Bug#12055)
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2012-07-27 10:29:26 +0000
+++ b/src/alloc.c 2012-07-28 23:05:32 +0000
@@ -533,12 +533,7 @@
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 @@
}
-/* 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 @@
#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:
=== modified file 'src/buffer.c'
--- a/src/buffer.c 2012-07-27 09:24:34 +0000
+++ b/src/buffer.c 2012-07-28 23:05:32 +0000
@@ -56,7 +56,7 @@
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 @@
/* 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;
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-07-27 09:24:34 +0000
+++ b/src/lisp.h 2012-07-28 23:05:32 +0000
@@ -20,6 +20,7 @@
#ifndef EMACS_LISP_H
#define EMACS_LISP_H
+#include <stdalign.h>
#include <stdarg.h>
#include <stddef.h>
#include <inttypes.h>
@@ -151,10 +152,6 @@
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 @@
#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 @@
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 @@
# 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 @@
#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 @@
#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}; \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109252: Use Gnulib stdalign and environ modules (Bug#9772, Bug#9960).,
Paul Eggert <=