From: Rich Felker Date: Tue, 29 Dec 2015 17:46:15 +0000 (-0500) Subject: adjust i386 max_align_t definition to work around some broken compilers X-Git-Tag: v1.1.13~105 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=71991a803c8a8fe10a6ed49bc4f0a1f4890d6c46;p=oweals%2Fmusl.git adjust i386 max_align_t definition to work around some broken compilers at least gcc 4.7 claims c++11 support but does not accept the alignas keyword, causing breakage when stddef.h is included in c++11 mode. instead, prefer using __attribute__((__aligned__)) on any compiler with GNU extensions, and only use the alignas keyword as a fallback for other C++ compilers. C code should not be affected by this patch. --- diff --git a/arch/i386/bits/alltypes.h.in b/arch/i386/bits/alltypes.h.in index b8902db7..1a8432d3 100644 --- a/arch/i386/bits/alltypes.h.in +++ b/arch/i386/bits/alltypes.h.in @@ -26,10 +26,12 @@ TYPEDEF long double float_t; TYPEDEF long double double_t; #endif -#ifdef __cplusplus -TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t; -#else +#if !defined(__cplusplus) TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t; +#elif defined(__GNUC__) +TYPEDEF struct { __attribute__((__aligned__(8))) long long __ll; long double __ld; } max_align_t; +#else +TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t; #endif TYPEDEF long time_t;