Date: Mon, 28 Nov 2016 18:36:37 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309258 - in stable: 10/include 10/sys/sys 11/include 11/sys/sys Message-ID: <201611281836.uASIabsc010497@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Nov 28 18:36:37 2016 New Revision: 309258 URL: https://svnweb.freebsd.org/changeset/base/309258 Log: 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 Modified: stable/11/include/stddef.h stable/11/sys/sys/_types.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/include/stddef.h stable/10/sys/sys/_types.h Directory Properties: stable/10/ (props changed) Modified: stable/11/include/stddef.h ============================================================================== --- stable/11/include/stddef.h Mon Nov 28 17:55:32 2016 (r309257) +++ stable/11/include/stddef.h Mon Nov 28 18:36:37 2016 (r309258) @@ -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_ */ Modified: stable/11/sys/sys/_types.h ============================================================================== --- stable/11/sys/sys/_types.h Mon Nov 28 17:55:32 2016 (r309257) +++ stable/11/sys/sys/_types.h Mon Nov 28 18:36:37 2016 (r309258) @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611281836.uASIabsc010497>