Mercurial > hg > octave-jordi > gnulib-hg
changeset 18074:5954852b97de
Improve port of stdalign to C++11
Problem reported by Sundaram in:
http://lists.gnu.org/archive/html/bug-gnulib/2015-08/msg00003.html
* lib/stdalign.in.h (alignof, alignas): Don't define if C++11 or newer.
(__alignas_is_defined): Define if C++11 or newer.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 03 Aug 2015 12:34:38 -0700 |
parents | 77cfc81a8ea5 |
children | 4c772e8197e9 |
files | ChangeLog lib/stdalign.in.h |
diffstat | 2 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-08-03 Paul Eggert <eggert@cs.ucla.edu> + + Improve port of stdalign to C++11 + Problem reported by Sundaram in: + http://lists.gnu.org/archive/html/bug-gnulib/2015-08/msg00003.html + * lib/stdalign.in.h (alignof, alignas): Don't define if C++11 or newer. + (__alignas_is_defined): Define if C++11 or newer. + 2015-08-01 Assaf Gordon <assafgordon@gmail.com> (tiny change) pmccabe2html: fix gawk regex escaping
--- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -64,7 +64,9 @@ # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) # endif #endif -#define alignof _Alignof +#if ! (defined __cplusplus && 201103 <= __cplusplus) +# define alignof _Alignof +#endif #define __alignof_is_defined 1 /* alignas (A), also known as _Alignas (A), aligns a variable or type @@ -105,8 +107,11 @@ # define _Alignas(a) __declspec (align (a)) # endif #endif -#if defined _Alignas || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__) +#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \ + || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__)) # define alignas _Alignas +#endif +#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus) # define __alignas_is_defined 1 #endif