From a34cda5d46246b7779c9a56e81b86b3c2cab0ee7 Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Thu, 4 Jan 2024 09:50:51 +0100 Subject: [PATCH] Remove non_trivial_copyable base --- .../cuda/std/detail/libcxx/include/__config | 10 -- .../detail/libcxx/include/__utility/pair.h | 13 -- .../non_trivial_copy_move_ABI.pass.cpp | 162 ------------------ .../pairs.pair/trivial_copy_move_ABI.pass.cpp | 4 - .../pairs.pair/trivial_copy_move.pass.cpp | 6 - .../pairs.pair/trivial_copy_move.pass.cpp | 6 - 6 files changed, 201 deletions(-) delete mode 100644 libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__config b/libcudacxx/include/cuda/std/detail/libcxx/include/__config index e26e354237f..24da7330fe0 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__config +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__config @@ -184,16 +184,6 @@ extern "C++" { // conflict with the dllexport-emitted copy, so we disable it. # define _LIBCUDACXX_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS # endif -// Feature macros for disabling pre ABI v1 features. All of these options -// are deprecated. -# if defined(__FreeBSD__) -# define _LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR -# endif -#endif - -#ifdef _LIBCUDACXX_TRIVIAL_PAIR_COPY_CTOR -#error "_LIBCUDACXX_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \ - use _LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead #endif #ifndef __has_attribute diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/pair.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/pair.h index e4d8abd80c7..ec110ef2857 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/pair.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/pair.h @@ -69,21 +69,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD -#if defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -template -struct __non_trivially_copyable_base { - _LIBCUDACXX_INLINE_VISIBILITY constexpr - __non_trivially_copyable_base() noexcept {} - _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY - __non_trivially_copyable_base(__non_trivially_copyable_base const&) noexcept {} -}; -#endif - template struct _LIBCUDACXX_TEMPLATE_VIS pair -#if defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -: private __non_trivially_copyable_base<_T1, _T2> -#endif { typedef _T1 first_type; typedef _T2 second_type; diff --git a/libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp b/libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp deleted file mode 100644 index 2c9e2ec2cf5..00000000000 --- a/libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp +++ /dev/null @@ -1,162 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// The test suite needs to define the ABI macros on the command line when -// modules are enabled. -// UNSUPPORTED: -fmodules - -// - -// template struct pair - -// Test that we properly provide the trivial copy operations by default. - -// FreeBSD provides the old ABI. This test checks the new ABI so we need -// to manually turn it on. -#undef _LIBCUDACXX_ABI_UNSTABLE -#undef _LIBCUDACXX_ABI_VERSION -#define _LIBCUDACXX_ABI_VERSION 1 -#define _LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR - -#include -#include -#include -#include -#include - -#include "test_macros.h" - -#if !defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -#error trivial ctor ABI macro defined -#endif - -template -struct HasNonTrivialABI : std::integral_constant::value - || (std::is_copy_constructible::value && !std::is_trivially_copy_constructible::value) -#if TEST_STD_VER >= 2011 - || (std::is_move_constructible::value && !std::is_trivially_move_constructible::value) -#endif -> {}; - -#if TEST_STD_VER >= 2011 -struct NonTrivialDtor { - NonTrivialDtor(NonTrivialDtor const&) = default; - ~NonTrivialDtor(); -}; -NonTrivialDtor::~NonTrivialDtor() {} -static_assert(HasNonTrivialABI::value, ""); - -struct NonTrivialCopy { - NonTrivialCopy(NonTrivialCopy const&); -}; -NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {} -static_assert(HasNonTrivialABI::value, ""); - -struct NonTrivialMove { - NonTrivialMove(NonTrivialMove const&) = default; - NonTrivialMove(NonTrivialMove&&); -}; -NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {} -static_assert(HasNonTrivialABI::value, ""); - -struct DeletedCopy { - DeletedCopy(DeletedCopy const&) = delete; - DeletedCopy(DeletedCopy&&) = default; -}; -static_assert(!HasNonTrivialABI::value, ""); - -struct TrivialMove { - TrivialMove(TrivialMove &&) = default; -}; -static_assert(!HasNonTrivialABI::value, ""); - -struct Trivial { - Trivial(Trivial const&) = default; -}; -static_assert(!HasNonTrivialABI::value, ""); -#endif - - -void test_trivial() -{ - { - typedef std::pair P; - static_assert(std::is_copy_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } -#if TEST_STD_VER >= 2011 - { - typedef std::pair P; - static_assert(std::is_move_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } - { - using P = std::pair; - static_assert(!std::is_trivially_destructible

::value, ""); - static_assert(std::is_copy_constructible

::value, ""); - static_assert(!std::is_trivially_copy_constructible

::value, ""); - static_assert(std::is_move_constructible

::value, ""); - static_assert(!std::is_trivially_move_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } - { - using P = std::pair; - static_assert(std::is_copy_constructible

::value, ""); - static_assert(!std::is_trivially_copy_constructible

::value, ""); - static_assert(std::is_move_constructible

::value, ""); - static_assert(!std::is_trivially_move_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } - { - using P = std::pair; - static_assert(std::is_copy_constructible

::value, ""); - static_assert(!std::is_trivially_copy_constructible

::value, ""); - static_assert(std::is_move_constructible

::value, ""); - static_assert(!std::is_trivially_move_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } - { - using P = std::pair; - static_assert(!std::is_copy_constructible

::value, ""); - static_assert(!std::is_trivially_copy_constructible

::value, ""); - static_assert(std::is_move_constructible

::value, ""); - static_assert(!std::is_trivially_move_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } - { - using P = std::pair; - static_assert(std::is_copy_constructible

::value, ""); - static_assert(!std::is_trivially_copy_constructible

::value, ""); - static_assert(std::is_move_constructible

::value, ""); - static_assert(!std::is_trivially_move_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } - { - using P = std::pair; - static_assert(!std::is_copy_constructible

::value, ""); - static_assert(!std::is_trivially_copy_constructible

::value, ""); - static_assert(std::is_move_constructible

::value, ""); - static_assert(!std::is_trivially_move_constructible

::value, ""); - static_assert(HasNonTrivialABI

::value, ""); - } -#endif -} - -void test_layout() { - typedef std::pair, char> PairT; - static_assert(sizeof(PairT) == 3, ""); - static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), ""); - static_assert(offsetof(PairT, first) == 0, ""); -} - -int main(int, char**) { - test_trivial(); - test_layout(); - return 0; -} diff --git a/libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp b/libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp index 55b6d92adf4..3b9558aa928 100644 --- a/libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp +++ b/libcudacxx/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/trivial_copy_move_ABI.pass.cpp @@ -26,10 +26,6 @@ #include "test_macros.h" -#if defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) -#error Non-trivial ctor ABI macro defined -#endif - template struct HasTrivialABI : std::integral_constant::value diff --git a/libcudacxx/libcxx/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp b/libcudacxx/libcxx/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp index c5824165ca7..b221254afa1 100644 --- a/libcudacxx/libcxx/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp +++ b/libcudacxx/libcxx/test/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp @@ -28,25 +28,19 @@ int main(int, char**) typedef std::pair P; { static_assert(std::is_copy_constructible

::value, ""); -#if !defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(std::is_trivially_copy_constructible

::value, ""); -#endif } #if TEST_STD_VER >= 2011 { static_assert(std::is_move_constructible

::value, ""); -#if !defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(std::is_trivially_move_constructible

::value, ""); -#endif } { using P1 = std::pair; static_assert(!std::is_copy_constructible::value, ""); static_assert(!std::is_trivially_copy_constructible::value, ""); static_assert(std::is_move_constructible::value, ""); -#if !defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(std::is_trivially_move_constructible::value, ""); -#endif } #endif diff --git a/libcudacxx/test/libcudacxx/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp index b1cb0ff34ba..0033be65707 100644 --- a/libcudacxx/test/libcudacxx/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp +++ b/libcudacxx/test/libcudacxx/std/utilities/utility/pairs/pairs.pair/trivial_copy_move.pass.cpp @@ -30,24 +30,18 @@ int main(int, char**) typedef cuda::std::pair P; { static_assert(cuda::std::is_copy_constructible

::value, ""); -#if !defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(cuda::std::is_trivially_copy_constructible

::value, ""); -#endif } { static_assert(cuda::std::is_move_constructible

::value, ""); -#if !defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(cuda::std::is_trivially_move_constructible

::value, ""); -#endif } { using P1 = cuda::std::pair; static_assert(!cuda::std::is_copy_constructible::value, ""); static_assert(!cuda::std::is_trivially_copy_constructible::value, ""); static_assert(cuda::std::is_move_constructible::value, ""); -#if !defined(_LIBCUDACXX_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) static_assert(cuda::std::is_trivially_move_constructible::value, ""); -#endif } return 0;