[libcxx-commits] [PATCH] D127132: [libc++] Remove _LIBCPP_PREFERRED_ALIGNOF
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 6 10:56:34 PDT 2022
philnik created this revision.
philnik added a reviewer: ldionne.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D127132
Files:
libcxx/include/__config
libcxx/include/type_traits
Index: libcxx/include/type_traits
===================================================================
--- libcxx/include/type_traits
+++ libcxx/include/type_traits
@@ -747,7 +747,8 @@
template <class _Tp>
struct __align_type
{
- static const size_t value = _LIBCPP_PREFERRED_ALIGNOF(_Tp);
+ // We want the preferred alignof instead of the minimum, so use __alignof instead
+ static const size_t value = __alignof(_Tp);
typedef _Tp type;
};
@@ -881,8 +882,9 @@
template <size_t _Len, class _Type0, class ..._Types>
struct aligned_union
{
- static const size_t alignment_value = __static_max<_LIBCPP_PREFERRED_ALIGNOF(_Type0),
- _LIBCPP_PREFERRED_ALIGNOF(_Types)...>::value;
+ // We want the preferred alignof instead of the minimum, so use __alignof instead
+ static const size_t alignment_value = __static_max<__alignof(_Type0),
+ __alignof(_Types)...>::value;
static const size_t __len = __static_max<_Len, sizeof(_Type0),
sizeof(_Types)...>::value;
typedef typename aligned_storage<__len, alignment_value>::type type;
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -394,8 +394,6 @@
# error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang"
#endif
-#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
-
#if defined(_LIBCPP_COMPILER_CLANG_BASED)
#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127132.434533.patch
Type: text/x-patch
Size: 1673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220606/67320224/attachment.bin>
More information about the libcxx-commits
mailing list