Mercurial > hg > xemacs-beta
changeset 5894:23178aa71f8b
Define ALIGNOF using C11 and C++11 operators.
See <CAHCOHQmG51R61KwGUNY7T5t9tXxzbyg=aGijUKYstbE+wL2-6Q@mail.gmail.com> in
xemacs-patches for more information.
author | Jerry James <james@xemacs.org> |
---|---|
date | Mon, 20 Apr 2015 15:09:11 -0600 |
parents | d3d073aceaea |
children | b2709239b1f6 |
files | src/ChangeLog src/lisp.h |
diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Sat Apr 18 23:10:40 2015 +0100 +++ b/src/ChangeLog Mon Apr 20 15:09:11 2015 -0600 @@ -1,3 +1,9 @@ +2015-04-20 Jerry James <james@xemacs.org> + + * lisp.h (max_align_t): Do not define if C11 or C++11, or a later + version of either, is in use. + (ALIGNOF): Define with native operators in C11 and C++11 and later. + 2015-04-18 Aidan Kehoe <kehoea@parhasard.net> * sequence.c (Fclear_string): New, API from GNU. Zero a string's
--- a/src/lisp.h Sat Apr 18 23:10:40 2015 +0100 +++ b/src/lisp.h Mon Apr 20 15:09:11 2015 -0600 @@ -1154,6 +1154,8 @@ /* ------------------------ alignment definitions ------------------- */ +#if (!defined (__STDC_VERSION__) || __STDC_VERSION__ < 201112L) && \ + (!defined (__cplusplus) || __cplusplus < 201103L) /* No type has a greater alignment requirement than max_align_t. (except perhaps for types we don't use, like long double) */ typedef union @@ -1163,6 +1165,7 @@ struct { void (*f)(void); } f; struct { double d; } d; } max_align_t; +#endif /* ALIGNOF returns the required alignment of a type -- i.e. a value such that data of this type must begin at a memory address which is a @@ -1170,7 +1173,11 @@ as the type itself. */ #ifndef ALIGNOF -# if defined (__GNUC__) && (__GNUC__ >= 2) +# if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define ALIGNOF(type) _Alignof(type) +# elif defined (__cplusplus) && __cplusplus >= 201103L +# define ALIGNOF(type) alignof(type) +# elif defined (__GNUC__) && (__GNUC__ >= 2) /* gcc has an extension that gives us exactly what we want. */ # define ALIGNOF(type) __alignof__ (type) # elif ! defined (__cplusplus)