mirror of git://git.musl-libc.org/musl
add max_align_t definition for C11 and C++11
unfortunately this needs to be able to vary by arch, because of a huge mess GCC made: the GCC definition, which became the ABI, depends on quirks in GCC's definition of __alignof__, which does not match the formal alignment of the type. GCC's __alignof__ unexpectedly exposes the an implementation detail, its "preferred alignment" for the type, rather than the formal/ABI alignment of the type, which it only actually uses in structures. on most archs the two values are the same, but on some (at least i386) the preferred alignment is greater than the ABI alignment. I considered using _Alignas(8) unconditionally, but on at least one arch (or1k), the alignment of max_align_t with GCC's definition is only 4 (even the "preferred alignment" for these types is only 4).
This commit is contained in:
parent
4992ace942
commit
321f4fa906
|
@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
|
|||
TYPEDEF float float_t;
|
||||
TYPEDEF double double_t;
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ TYPEDEF long double float_t;
|
|||
TYPEDEF long double double_t;
|
||||
#endif
|
||||
|
||||
TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
|
|||
TYPEDEF float float_t;
|
||||
TYPEDEF double double_t;
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
|
|||
TYPEDEF float float_t;
|
||||
TYPEDEF double double_t;
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
|
|||
TYPEDEF float float_t;
|
||||
TYPEDEF double double_t;
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
|
|||
TYPEDEF float float_t;
|
||||
TYPEDEF double double_t;
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ TYPEDEF unsigned wint_t;
|
|||
TYPEDEF float float_t;
|
||||
TYPEDEF double double_t;
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ TYPEDEF float float_t;
|
|||
TYPEDEF double double_t;
|
||||
#endif
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long long time_t;
|
||||
TYPEDEF long long suseconds_t;
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ TYPEDEF float float_t;
|
|||
TYPEDEF double double_t;
|
||||
#endif
|
||||
|
||||
TYPEDEF struct { long long __ll; long double __ld; } max_align_t;
|
||||
|
||||
TYPEDEF long time_t;
|
||||
TYPEDEF long suseconds_t;
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
#define __NEED_ptrdiff_t
|
||||
#define __NEED_size_t
|
||||
#define __NEED_wchar_t
|
||||
#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
|
||||
#define __NEED_max_align_t
|
||||
#endif
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue