diff options
author | jhb <jhb@FreeBSD.org> | 2016-11-28 18:36:37 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-11-28 18:36:37 +0000 |
commit | f67daeff53a890faa88f5ce727193084d3b92b90 (patch) | |
tree | e76d6a084138fbf2e432a0e27af7b4bd81192bc4 /include | |
parent | aab078ec4f92422de4b01e7def22b32a1ef36943 (diff) | |
download | FreeBSD-src-f67daeff53a890faa88f5ce727193084d3b92b90.zip FreeBSD-src-f67daeff53a890faa88f5ce727193084d3b92b90.tar.gz |
MFC 307756: Define max_align_t for C11.
libc++'s stddef.h includes an existing definition of max_align_t for
C++11, but it is only defined for C++, not for C. In addition, GCC and
clang both define an alternate version of max_align_t that uses a
union of multiple types rather than a plain long double as in libc++.
This adds a __max_align_t to <sys/_types.h> that matches the GCC and
clang definition that is mapped to max_align_t in <stddef.h>.
PR: 210890
Diffstat (limited to 'include')
-rw-r--r-- | include/stddef.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/stddef.h b/include/stddef.h index 7898da2..7f2d2f0 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -62,6 +62,14 @@ typedef ___wchar_t wchar_t; #endif #endif +#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L +#ifndef __CLANG_MAX_ALIGN_T_DEFINED +typedef __max_align_t max_align_t; +#define __CLANG_MAX_ALIGN_T_DEFINED +#define __GCC_MAX_ALIGN_T +#endif +#endif + #define offsetof(type, member) __offsetof(type, member) #endif /* _STDDEF_H_ */ |