joerg created this revision.
joerg added a reviewer: mclow.lists.
Herald added a subscriber: christof.
max_align_t has been introduced by C++11 and C99. When an older language mode
is explicitly requested, the system headers might not provide. Don't define it
in this case unless other headers (<new>) depend on it.
https://reviews.llvm.org/D73245
Files:
libcxx/include/cstddef
Index: libcxx/include/cstddef
===================================================================
--- libcxx/include/cstddef
+++ libcxx/include/cstddef
@@ -49,6 +49,9 @@
using ::ptrdiff_t;
using ::size_t;
+// max_align_t is part of C99/C++11, but necessary for <new>
+// if the compiler doesn't tell us the default new alignment.
+#if !defined(_LIBCPP_CXX03_LANG) || !defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
defined(__DEFINED_max_align_t) || defined(__NetBSD__)
// Re-use the compiler's <stddef.h> max_align_t where possible.
@@ -56,6 +59,7 @@
#else
typedef long double max_align_t;
#endif
+#endif
_LIBCPP_END_NAMESPACE_STD
Index: libcxx/include/cstddef
===================================================================
--- libcxx/include/cstddef
+++ libcxx/include/cstddef
@@ -49,6 +49,9 @@
using ::ptrdiff_t;
using ::size_t;
+// max_align_t is part of C99/C++11, but necessary for <new>
+// if the compiler doesn't tell us the default new alignment.
+#if !defined(_LIBCPP_CXX03_LANG) || !defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
defined(__DEFINED_max_align_t) || defined(__NetBSD__)
// Re-use the compiler's <stddef.h> max_align_t where possible.
@@ -56,6 +59,7 @@
#else
typedef long double max_align_t;
#endif
+#endif
_LIBCPP_END_NAMESPACE_STD
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits