]> Savannah Git Hosting - gnulib.git/commitdiff
Improve port of stdalign to C++11
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Aug 2015 19:34:38 +0000 (12:34 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 3 Aug 2015 19:35:02 +0000 (12:35 -0700)
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.

ChangeLog
lib/stdalign.in.h

index 855592ce456c10ff4295d722a3c872555035b330..b816e80a32464bfbb7aa27394560a8b694e28136 100644 (file)
--- 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
index 9b6c5abeb5af6f5e2de75c3a54b5d0eb37dd8193..9a7d5edd95e87762264e7b976f049763341746ca 100644 (file)
@@ -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
 #  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