Skip to content

Commit 7c2f4a8

Browse files
committed
[libc++] Revert 03dd205 "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.
1 parent ab41129 commit 7c2f4a8

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

libcxx/include/cstddef

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Types:
2525
2626
ptrdiff_t
2727
size_t
28-
max_align_t // C++11
28+
max_align_t
2929
nullptr_t
3030
byte // C++17
3131
@@ -49,8 +49,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4949
using ::ptrdiff_t;
5050
using ::size_t;
5151

52-
#if !defined(_LIBCPP_CXX03_LANG)
52+
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
53+
defined(__DEFINED_max_align_t) || defined(__NetBSD__)
54+
// Re-use the compiler's <stddef.h> max_align_t where possible.
5355
using ::max_align_t;
56+
#else
57+
typedef long double max_align_t;
5458
#endif
5559

5660
template <class _Tp> struct __libcpp_is_integral { enum { value = 0 }; };

libcxx/include/new

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,19 +226,9 @@ inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT
226226

227227
_LIBCPP_BEGIN_NAMESPACE_STD
228228

229-
#if defined(_LIBCPP_CXX03_LANG)
230-
union __libcpp_max_align_t {
231-
void * __f1;
232-
long long int __f2;
233-
long double __f3;
234-
};
235-
#endif
236-
237229
_LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new(size_t __align) _NOEXCEPT {
238230
#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__
239231
return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__;
240-
#elif defined(_LIBCPP_CXX03_LANG)
241-
return __align > alignment_of<__libcpp_max_align_t>::value;
242232
#else
243233
return __align > alignment_of<max_align_t>::value;
244234
#endif

libcxx/include/stddef.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ extern "C++" {
5151
using std::nullptr_t;
5252
}
5353

54+
// Re-use the compiler's <stddef.h> max_align_t where possible.
55+
#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
56+
!defined(__DEFINED_max_align_t) && !defined(__NetBSD__)
57+
typedef long double max_align_t;
58+
#endif
59+
5460
#endif
5561

5662
#endif // _LIBCPP_STDDEF_H

0 commit comments

Comments
 (0)