[libcxx-commits] [libcxx] 7c2f4a8 - [libc++] Revert 03dd205c151 "Adjust max_align_t handling"
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 25 08:43:24 PST 2020
Author: Louis Dionne
Date: 2020-02-25T11:42:08-05:00
New Revision: 7c2f4a8370829aae5a96b7353fb0727d4e47e8fd
URL: https://github.com/llvm/llvm-project/commit/7c2f4a8370829aae5a96b7353fb0727d4e47e8fd
DIFF: https://github.com/llvm/llvm-project/commit/7c2f4a8370829aae5a96b7353fb0727d4e47e8fd.diff
LOG: [libc++] Revert 03dd205c151 "Adjust max_align_t handling"
That commit was made without approval from a libc++ reviewer, and it
also broke the build in C++03 mode.
Added:
Modified:
libcxx/include/cstddef
libcxx/include/new
libcxx/include/stddef.h
Removed:
################################################################################
diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef
index 2a0bfeb6e15f..87eee4bf5b42 100644
--- a/libcxx/include/cstddef
+++ b/libcxx/include/cstddef
@@ -25,7 +25,7 @@ Types:
ptr
diff _t
size_t
- max_align_t // C++11
+ max_align_t
nullptr_t
byte // C++17
@@ -49,8 +49,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::ptr
diff _t;
using ::size_t;
-#if !defined(_LIBCPP_CXX03_LANG)
+#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.
using ::max_align_t;
+#else
+typedef long double max_align_t;
#endif
template <class _Tp> struct __libcpp_is_integral { enum { value = 0 }; };
diff --git a/libcxx/include/new b/libcxx/include/new
index b64057a87854..40d351e9b770 100644
--- a/libcxx/include/new
+++ b/libcxx/include/new
@@ -226,19 +226,9 @@ inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT
_LIBCPP_BEGIN_NAMESPACE_STD
-#if defined(_LIBCPP_CXX03_LANG)
-union __libcpp_max_align_t {
- void * __f1;
- long long int __f2;
- long double __f3;
-};
-#endif
-
_LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new(size_t __align) _NOEXCEPT {
#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__;
-#elif defined(_LIBCPP_CXX03_LANG)
- return __align > alignment_of<__libcpp_max_align_t>::value;
#else
return __align > alignment_of<max_align_t>::value;
#endif
diff --git a/libcxx/include/stddef.h b/libcxx/include/stddef.h
index ba28b29c0b3f..6497dcda2af4 100644
--- a/libcxx/include/stddef.h
+++ b/libcxx/include/stddef.h
@@ -51,6 +51,12 @@ extern "C++" {
using std::nullptr_t;
}
+// Re-use the compiler's <stddef.h> max_align_t where possible.
+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
+ !defined(__DEFINED_max_align_t) && !defined(__NetBSD__)
+typedef long double max_align_t;
+#endif
+
#endif
#endif // _LIBCPP_STDDEF_H
More information about the libcxx-commits
mailing list