diff --git a/libcxx/.clang-format b/libcxx/.clang-format --- a/libcxx/.clang-format +++ b/libcxx/.clang-format @@ -17,7 +17,6 @@ '_LIBCPP_CONSTEXPR_AFTER_CXX17', '_LIBCPP_CONSTEXPR_AFTER_CXX20', '_LIBCPP_ALIGNOF', - '_ALIGNAS_TYPE', '_ALIGNAS', '_LIBCPP_NORETURN', '_LIBCPP_ALWAYS_INLINE', diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/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 diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h --- a/libcxx/include/__memory/shared_ptr.h +++ b/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) { diff --git a/libcxx/include/array b/libcxx/include/array --- a/libcxx/include/array +++ b/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;} diff --git a/libcxx/src/iostream.cpp b/libcxx/src/iostream.cpp --- a/libcxx/src/iostream.cpp +++ b/libcxx/src/iostream.cpp @@ -17,68 +17,68 @@ _LIBCPP_BEGIN_NAMESPACE_STD -_ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)] +_ALIGNAS (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif ; -_ALIGNAS_TYPE (__stdinbuf ) static char __cin[sizeof(__stdinbuf )]; +_ALIGNAS (__stdinbuf ) static char __cin[sizeof(__stdinbuf )]; static mbstate_t mb_cin; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)] +_ALIGNAS (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif ; -_ALIGNAS_TYPE (__stdinbuf ) static char __wcin[sizeof(__stdinbuf )]; +_ALIGNAS (__stdinbuf ) static char __wcin[sizeof(__stdinbuf )]; static mbstate_t mb_wcin; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)] +_ALIGNAS (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif ; -_ALIGNAS_TYPE (__stdoutbuf) static char __cout[sizeof(__stdoutbuf)]; +_ALIGNAS (__stdoutbuf) static char __cout[sizeof(__stdoutbuf)]; static mbstate_t mb_cout; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)] +_ALIGNAS (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif ; -_ALIGNAS_TYPE (__stdoutbuf) static char __wcout[sizeof(__stdoutbuf)]; +_ALIGNAS (__stdoutbuf) static char __wcout[sizeof(__stdoutbuf)]; static mbstate_t mb_wcout; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)] +_ALIGNAS (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?cerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif ; -_ALIGNAS_TYPE (__stdoutbuf) static char __cerr[sizeof(__stdoutbuf)]; +_ALIGNAS (__stdoutbuf) static char __cerr[sizeof(__stdoutbuf)]; static mbstate_t mb_cerr; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)] +_ALIGNAS (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wcerr@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif ; -_ALIGNAS_TYPE (__stdoutbuf) static char __wcerr[sizeof(__stdoutbuf)]; +_ALIGNAS (__stdoutbuf) static char __wcerr[sizeof(__stdoutbuf)]; static mbstate_t mb_wcerr; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)] +_ALIGNAS (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?clog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif ; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)] +_ALIGNAS (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)] #if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__) __asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_traits@_W@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A") #endif diff --git a/libcxx/test/std/atomics/atomics.flag/default.pass.cpp b/libcxx/test/std/atomics/atomics.flag/default.pass.cpp --- a/libcxx/test/std/atomics/atomics.flag/default.pass.cpp +++ b/libcxx/test/std/atomics/atomics.flag/default.pass.cpp @@ -25,7 +25,7 @@ assert(f.test_and_set() == 0); { typedef std::atomic_flag A; - TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; + TEST_ALIGNAS(A) char storage[sizeof(A)] = {1}; A& zero = *new (storage) A(); assert(!zero.test_and_set()); zero.~A(); diff --git a/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp --- a/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.generic/address.pass.cpp @@ -115,7 +115,7 @@ assert(obj == T(2*sizeof(X))); { - TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; + TEST_ALIGNAS(A) char storage[sizeof(A)] = {23}; A& zero = *new (storage) A(); assert(zero == T(0)); zero.~A(); diff --git a/libcxx/test/std/atomics/atomics.types.generic/bool.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/bool.pass.cpp --- a/libcxx/test/std/atomics/atomics.types.generic/bool.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.generic/bool.pass.cpp @@ -213,7 +213,7 @@ } { typedef std::atomic A; - TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; + TEST_ALIGNAS(A) char storage[sizeof(A)] = {1}; A& zero = *new (storage) A(); assert(zero == false); zero.~A(); diff --git a/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp b/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp --- a/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp +++ b/libcxx/test/std/atomics/atomics.types.generic/integral.pass.cpp @@ -146,7 +146,7 @@ assert(obj == T(8)); { - TEST_ALIGNAS_TYPE(A) char storage[sizeof(A)] = {23}; + TEST_ALIGNAS(A) char storage[sizeof(A)] = {23}; A& zero = *new (storage) A(); assert(zero == 0); zero.~A(); diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h --- a/libcxx/test/support/test_macros.h +++ b/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 @@ -166,8 +166,6 @@ # define TEST_CONSTEXPR_CXX20 #endif -#define TEST_ALIGNAS_TYPE(...) TEST_ALIGNAS(TEST_ALIGNOF(__VA_ARGS__)) - #if !TEST_HAS_FEATURE(cxx_rtti) && !defined(__cpp_rtti) \ && !defined(__GXX_RTTI) #define TEST_HAS_NO_RTTI