>From 905233bd1b667d87ad5b801c2d2613d7eb075799 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 16 Dec 2014 17:29:33 -0800 Subject: [PATCH 1/2] 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. --- ChangeLog | 9 +++++++++ lib/stdalign.in.h | 5 ++++- m4/stdalign.m4 | 5 ++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d654b60..a2c5645 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2014-12-16 Paul Eggert + + 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 getcwd: fix test failure on OS X 10.9 diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index 32ae4c5..dd25f04 100644 --- 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 diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 9efafe5..2b1f90e 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -32,7 +32,10 @@ AC_DEFUN([gl_STDALIGN_H], /* 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 -- 1.9.3