# HG changeset patch # User Jerry James # Date 1429564151 21600 # Node ID 23178aa71f8b985a32f9b80e5c6da660700a0315 # Parent d3d073aceaea16ee1625363380337b3dad916861 Define ALIGNOF using C11 and C++11 operators. See in xemacs-patches for more information. diff -r d3d073aceaea -r 23178aa71f8b src/ChangeLog --- 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 + + * 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 * sequence.c (Fclear_string): New, API from GNU. Zero a string's diff -r d3d073aceaea -r 23178aa71f8b src/lisp.h --- 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)