[libcxx-commits] [PATCH] D129440: [libc++] Use _Alignas instead of __attribute__((__aligned__()))
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 10 04:48:27 PDT 2022
philnik created this revision.
philnik added reviewers: ldionne, Mordante, var-const.
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/D129440
Files:
libcxx/include/__config
libcxx/include/__memory/shared_ptr.h
libcxx/include/array
libcxx/test/support/test_macros.h
Index: libcxx/test/support/test_macros.h
===================================================================
--- libcxx/test/support/test_macros.h
+++ libcxx/test/support/test_macros.h
@@ -127,7 +127,7 @@
# else
# define TEST_ALIGNOF(...) __alignof(__VA_ARGS__)
# endif
-# define TEST_ALIGNAS(...) __attribute__((__aligned__(__VA_ARGS__)))
+# define TEST_ALIGNAS(...) _Alignas(__VA_ARGS__)
# define TEST_CONSTEXPR
# define TEST_NOEXCEPT throw()
# define TEST_NOEXCEPT_FALSE
Index: libcxx/include/array
===================================================================
--- libcxx/include/array
+++ libcxx/include/array
@@ -272,7 +272,7 @@
char>::type _CharType;
struct _ArrayInStructT { _Tp __data_[1]; };
- _ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)];
+ _ALIGNAS(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)];
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
value_type* data() _NOEXCEPT {return nullptr;}
Index: libcxx/include/__memory/shared_ptr.h
===================================================================
--- libcxx/include/__memory/shared_ptr.h
+++ libcxx/include/__memory/shared_ptr.h
@@ -330,7 +330,7 @@
// we now use a properly aligned char buffer while making sure that we maintain
// the same layout that we had when we used a compressed pair.
using _CompressedPair = __compressed_pair<_Alloc, _Tp>;
- struct _ALIGNAS_TYPE(_CompressedPair) _Storage {
+ struct _ALIGNAS(_CompressedPair) _Storage {
char __blob_[sizeof(_CompressedPair)];
_LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) {
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -394,8 +394,7 @@
# ifndef _LIBCPP_CXX03_LANG
# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp)
-# define _ALIGNAS_TYPE(x) alignas(x)
-# define _ALIGNAS(x) alignas(x)
+# define _ALIGNAS(...) alignas(__VA_ARGS__)
# define _LIBCPP_NORETURN [[noreturn]]
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
@@ -403,8 +402,7 @@
# else
# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
-# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))
-# define _ALIGNAS(x) __attribute__((__aligned__(x)))
+# define _ALIGNAS(...) _Alignas(__VA_ARGS__)
# define _LIBCPP_NORETURN __attribute__((noreturn))
# define _LIBCPP_HAS_NO_NOEXCEPT
# define nullptr __nullptr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129440.443491.patch
Type: text/x-patch
Size: 2560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220710/102ead13/attachment.bin>
More information about the libcxx-commits
mailing list