aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/_types.h
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-10-21 23:50:02 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2016-10-21 23:50:02 +0000
commit5dd723425ee0bbe05c08d2c2272be9fc34695886 (patch)
tree0d6714baa25d9660a3383f3c9610a8ff45e7254d /sys/sys/_types.h
parent7627b33010f0907e2bfc9e6b826d102eb05f6b33 (diff)
downloadsrc-5dd723425ee0bbe05c08d2c2272be9fc34695886.tar.gz
src-5dd723425ee0bbe05c08d2c2272be9fc34695886.zip
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 Reviewed by: dim MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D8194
Notes
Notes: svn path=/head/; revision=307756
Diffstat (limited to 'sys/sys/_types.h')
-rw-r--r--sys/sys/_types.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index ecc1c7e05e4c..8736651ba6f0 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -100,6 +100,11 @@ typedef __uint_least32_t __char32_t;
#define _CHAR32_T_DECLARED
#endif
+typedef struct {
+ long long __max_align1 __aligned(_Alignof(long long));
+ long double __max_align2 __aligned(_Alignof(long double));
+} __max_align_t;
+
typedef __uint32_t __dev_t; /* device number */
typedef __uint32_t __fixpt_t; /* fixed point number */