> From: "Todd C. Miller" <todd.mil...@courtesan.com> > Date: Thu, 05 Jan 2017 15:50:02 -0700 > > I think you need to also define __CLANG_MAX_ALIGN_T_DEFINED and > perhaps _GCC_MAX_ALIGN_T to avoid libcxx from redefining max_align_t > as a different type. E.g. in src/lib/libcxx/include/stddef.h > > // Re-use the compiler's <stddef.h> max_align_t where possible. > #if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) > typedef long double max_align_t; > #endif > > FreeBSD defines both __CLANG_MAX_ALIGN_T_DEFINED and _GCC_MAX_ALIGN_T > when defining max_align_t in stddef.h, we probably need to as well.
Good point. I don't really see a reason to define _GCC_MAX_ALIGN_T as libstdc++ doesn't try to define its own max_align_t like libc++ does. We do need to make sure that we define max_align_t for C++11 and up though. New diff below. ok? Index: include/stddef.h =================================================================== RCS file: /cvs/src/include/stddef.h,v retrieving revision 1.13 diff -u -p -r1.13 stddef.h --- include/stddef.h 9 Sep 2016 18:12:37 -0000 1.13 +++ include/stddef.h 6 Jan 2017 11:19:39 -0000 @@ -71,4 +71,14 @@ typedef __mbstate_t mbstate_t; #define offsetof(type, member) ((size_t)(&((type *)0)->member)) #endif +#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103 +#ifndef __CLANG_MAX_ALIGN_T_DEFINED +#define __CLANG_MAX_ALIGN_T_DEFINED +typedef struct { + long long __max_align_ll __aligned(__alignof__(long long)); + long double __max_align_ld __aligned(__alignof__(long double)); +} max_align_t; +#endif +#endif + #endif /* _STDDEF_H_ */ Index: sys/sys/cdefs.h =================================================================== RCS file: /cvs/src/sys/sys/cdefs.h,v retrieving revision 1.39 diff -u -p -r1.39 cdefs.h --- sys/sys/cdefs.h 18 Apr 2014 11:51:17 -0000 1.39 +++ sys/sys/cdefs.h 6 Jan 2017 11:19:39 -0000 @@ -375,14 +375,19 @@ #endif /* - * _ISOC99_SOURCE and __STDC_VERSION__ override any of the other macros since - * they are non-exclusive. + * _ISOC99_SOURCE, _ISOC11_SOURCE and __STDC_VERSION__ override any of + * the other macros since they are non-exclusive. */ #if defined(_ISOC99_SOURCE) || \ (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901) || \ (defined(__cplusplus) && __cplusplus >= 201103) # undef __ISO_C_VISIBLE # define __ISO_C_VISIBLE 1999 +#endif +#if defined(_ISOC11_SOURCE) || \ + (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112) +# undef __ISO_C_VISIBLE +# define __ISO_C_VISIBLE 2011 #endif /*