changeset 17837:399c34835df9

stdalign: work around Apple GCC 4.0 bug Reported by David Fang in: http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00194.html * lib/stdalign.in.h (_Alignas): * m4/stdalign.m4 (gl_STDALIGN_H): Do not use aligned attribute with GCC 4.0 on Apple.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 16 Dec 2014 17:29:33 -0800
parents 27ed6751aa8a
children eac9c3308ec8
files ChangeLog lib/stdalign.in.h m4/stdalign.m4
diffstat 3 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-12-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+	stdalign: work around Apple GCC 4.0 bug
+	Reported by David Fang in:
+	http://lists.gnu.org/archive/html/bug-gnulib/2014-12/msg00194.html
+	* lib/stdalign.in.h (_Alignas):
+	* m4/stdalign.m4 (gl_STDALIGN_H):
+	Do not use aligned attribute with GCC 4.0 on Apple.
+
 2014-12-16  Pádraig Brady  <P@draigBrady.com>
 
 	getcwd: fix test failure on OS X 10.9
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -95,7 +95,10 @@
 #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
 # if defined __cplusplus && 201103 <= __cplusplus
 #  define _Alignas(a) alignas (a)
-# elif (__GNUC__ || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__ \
+# elif ((defined __APPLE__ && defined __MACH__                  \
+         ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__)                 \
+         : __GNUC__)                                            \
+        || __HP_cc || __HP_aCC || __IBMC__ || __IBMCPP__        \
         || __ICC || 0x5110 <= __SUNPRO_C)
 #  define _Alignas(a) __attribute__ ((__aligned__ (a)))
 # elif 1300 <= _MSC_VER
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -32,7 +32,10 @@
             /* Test _Alignas only on platforms where gnulib can help.  */
             #if \
                 ((defined __cplusplus && 201103 <= __cplusplus) \
-                 || __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC \
+                 || (defined __APPLE__ && defined __MACH__ \
+                     ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+                     : __GNUC__) \
+                 || __IBMC__ || __IBMCPP__ || __ICC \
                  || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
               struct alignas_test { char c; char alignas (8) alignas_8; };
               char test_alignas[offsetof (struct alignas_test, alignas_8) == 8