From b3547916f847d27f423cdbe776f4ec9c7124d46f Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Mon, 22 Jan 2024 09:57:36 -0800 Subject: [PATCH] Properly test internal headers (#1258) (#1299) * Add tests for internal headers, so that we know that they do not rely on transitive includes * Add tests for fallback definitions of traits, to ensure hat all fallbacks are functional * Add tests that all public headers can be included * Add tests that all public headers can be included by just a host compiler Co-authored-by: Wesley Maxey --- CMakePresets.json | 7 +- libcudacxx/include/cuda/annotated_ptr | 2 + .../include/cuda/std/detail/__annotated_ptr | 8 +- .../cuda/std/detail/libcxx/include/__assert | 12 +-- .../std/detail/libcxx/include/__cccl_config | 24 +++++- .../cuda/std/detail/libcxx/include/__config | 39 +++------ .../detail/libcxx/include/__cuda/barrier.h | 9 ++ .../include/__expected/bad_expected_access.h | 12 +-- .../include/__functional/binary_function.h | 6 +- .../libcxx/include/__functional/binder1st.h | 4 + .../libcxx/include/__functional/binder2nd.h | 4 + .../libcxx/include/__functional/mem_fun_ref.h | 4 + .../__functional/pointer_to_binary_function.h | 6 +- .../__functional/pointer_to_unary_function.h | 4 + .../include/__functional/unary_function.h | 8 +- .../include/__functional/unary_negate.h | 4 + .../include/__iterator/incrementable_traits.h | 2 + .../include/__iterator/istream_iterator.h | 1 + .../include/__iterator/readable_traits.h | 2 + .../libcxx/include/__type_traits/is_base_of.h | 15 ++-- .../libcxx/include/__type_traits/is_class.h | 4 +- .../libcxx/include/__type_traits/is_empty.h | 3 +- .../include/__type_traits/is_literal_type.h | 1 + .../__type_traits/is_nothrow_destructible.h | 13 +-- .../include/__type_traits/is_polymorphic.h | 9 +- .../__type_traits/is_standard_layout.h | 2 + .../is_trivially_constructible.h | 3 + .../__type_traits/is_trivially_copyable.h | 2 +- .../__type_traits/is_trivially_destructible.h | 8 +- .../include/__utility/integer_sequence.h | 1 + .../cuda/std/detail/libcxx/include/algorithm | 84 +++++++++---------- .../cuda/std/detail/libcxx/include/chrono | 11 ++- .../cuda/std/detail/libcxx/include/complex | 9 ++ .../cuda/std/detail/libcxx/include/exception | 48 ++++++----- .../cuda/std/detail/libcxx/include/span | 18 ++-- .../cuda/std/detail/libcxx/include/variant | 8 +- .../runtime/exception_pointer_msvc.ipp | 2 +- libcudacxx/test/CMakeLists.txt | 36 +++++++- .../test/internal_headers/CMakeLists.txt | 72 ++++++++++++++++ .../test/internal_headers/header_test.cpp.in | 22 +++++ libcudacxx/test/libcudacxx/CMakeLists.txt | 8 +- .../meta.rel/is_base_of_fallback.pass.cpp | 79 +++++++++++++++++ libcudacxx/test/public_headers/CMakeLists.txt | 58 +++++++++++++ .../test/public_headers/header_test.cpp.in | 27 ++++++ .../public_headers_host_only/CMakeLists.txt | 37 ++++++++ .../header_test.cpp.in | 27 ++++++ libcudacxx/test/smoke/CMakeLists.txt | 62 -------------- libcudacxx/test/smoke/detect_dialect.cpp | 7 -- libcudacxx/test/smoke/header_test.cpp.in | 17 ---- 49 files changed, 604 insertions(+), 247 deletions(-) create mode 100644 libcudacxx/test/internal_headers/CMakeLists.txt create mode 100644 libcudacxx/test/internal_headers/header_test.cpp.in create mode 100644 libcudacxx/test/libcudacxx/std/utilities/meta/meta.rel/is_base_of_fallback.pass.cpp create mode 100644 libcudacxx/test/public_headers/CMakeLists.txt create mode 100644 libcudacxx/test/public_headers/header_test.cpp.in create mode 100644 libcudacxx/test/public_headers_host_only/CMakeLists.txt create mode 100644 libcudacxx/test/public_headers_host_only/header_test.cpp.in delete mode 100644 libcudacxx/test/smoke/CMakeLists.txt delete mode 100644 libcudacxx/test/smoke/detect_dialect.cpp delete mode 100644 libcudacxx/test/smoke/header_test.cpp.in diff --git a/CMakePresets.json b/CMakePresets.json index 9d50b61ad6..aa14196652 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -273,7 +273,12 @@ { "name": "libcudacxx-base", "hidden": true, - "targets": ["libcudacxx.test.lit.precompile"] + "targets": [ + "libcudacxx.test.internal_headers", + "libcudacxx.test.public_headers", + "libcudacxx.test.public_headers_host_only", + "libcudacxx.test.lit.precompile" + ] }, { "name": "libcudacxx-nvrtc-cpp11", diff --git a/libcudacxx/include/cuda/annotated_ptr b/libcudacxx/include/cuda/annotated_ptr index e20b6f58ba..10e8fe1e76 100644 --- a/libcudacxx/include/cuda/annotated_ptr +++ b/libcudacxx/include/cuda/annotated_ptr @@ -188,6 +188,8 @@ void discard_memory(volatile void* __ptr, std::size_t __nbytes) noexcept { asm volatile ("discard.global.L2 [%0], 128;" ::"l"(__p + (__i * _LINE_SIZE)) :); } )) + (void)__ptr; + (void)__nbytes; } template diff --git a/libcudacxx/include/cuda/std/detail/__annotated_ptr b/libcudacxx/include/cuda/std/detail/__annotated_ptr index e52c17f6de..1356baa2ed 100644 --- a/libcudacxx/include/cuda/std/detail/__annotated_ptr +++ b/libcudacxx/include/cuda/std/detail/__annotated_ptr @@ -63,7 +63,9 @@ namespace __detail_ap { _LIBCUDACXX_ASSERT(__b, ""); #if !defined(_LIBCUDACXX_CUDACC_BELOW_11_2) __builtin_assume(__b); -#endif // !defined(_LIBCUDACXX_CUDACC_BELOW_11_2) +#else // ^^^ !_LIBCUDACXX_CUDACC_BELOW_11_2 ^^^ / vvv _LIBCUDACXX_CUDACC_BELOW_11_2 vvv + (void)__b; +#endif // _LIBCUDACXX_CUDACC_BELOW_11_2 } else if (std::is_same<_Property, access_property::global>::value == true || std::is_same<_Property, access_property::normal>::value == true || std::is_same<_Property, access_property::persisting>::value == true || @@ -73,7 +75,9 @@ namespace __detail_ap { _LIBCUDACXX_ASSERT(__b, ""); #if !defined(_LIBCUDACXX_CUDACC_BELOW_11_2) __builtin_assume(__b); -#endif // !defined(_LIBCUDACXX_CUDACC_BELOW_11_2) +#else // ^^^ !_LIBCUDACXX_CUDACC_BELOW_11_2 ^^^ / vvv _LIBCUDACXX_CUDACC_BELOW_11_2 vvv + (void)__b; +#endif // _LIBCUDACXX_CUDACC_BELOW_11_2 } return __ptr; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__assert b/libcudacxx/include/cuda/std/detail/libcxx/include/__assert index 3a1e0e4fe5..2e378d0912 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__assert +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__assert @@ -51,18 +51,18 @@ #if _LIBCUDACXX_ENABLE_ASSERTIONS # define _LIBCUDACXX_ASSERT(expression, message) \ - (_LIBCUDACXX_DIAGNOSTIC_PUSH \ - _LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ + (_CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_CLANG("-Wassume") \ __builtin_expect(static_cast(expression), 1) ? \ (void)0 : \ ::_CUDA_VSTD::__libcpp_verbose_abort("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message) - _LIBCUDACXX_DIAGNOSTIC_POP) + _CCCL_DIAG_POP) #elif 0 // !defined(_LIBCUDACXX_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume) # define _LIBCUDACXX_ASSERT(expression, message) \ - (_LIBCUDACXX_DIAGNOSTIC_PUSH \ - _LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ + (_CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_CLANG("-Wassume") \ __builtin_assume(static_cast(expression)) \ - _LIBCUDACXX_DIAGNOSTIC_POP) + _CCCL_DIAG_POP) #else # define _LIBCUDACXX_ASSERT(expression, message) ((void)0) #endif diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__cccl_config b/libcudacxx/include/cuda/std/detail/libcxx/include/__cccl_config index 06e8aada87..afdabbbb11 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__cccl_config +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__cccl_config @@ -50,6 +50,12 @@ # define _CCCL_CUDA_COMPILER_CLANG #endif +// Shorthand to check whether there is a cuda compiler available +#if defined(_CCCL_CUDA_COMPILER_NVCC) || defined(_CCCL_CUDA_COMPILER_NVHPC) || defined(_CCCL_CUDA_COMPILER_CLANG) \ + || defined(_CCCL_COMPILER_NVRTC) +# define _CCCL_CUDA_COMPILER +#endif // cuda compiler available + // Enforce that cccl headers are treated as system headers #if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_NVHPC) || defined(_CCCL_COMPILER_ICC) \ || defined(_CCCL_COMPILER_ICC_LLVM) @@ -92,24 +98,35 @@ # define _CCCL_DIAG_SUPPRESS_CLANG(str) _Pragma(_CCCL_TOSTRING(clang diagnostic ignored str)) # define _CCCL_DIAG_SUPPRESS_GCC(str) # define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) #elif defined(_CCCL_COMPILER_GCC) # define _CCCL_DIAG_PUSH _Pragma("GCC diagnostic push") # define _CCCL_DIAG_POP _Pragma("GCC diagnostic pop") # define _CCCL_DIAG_SUPPRESS_CLANG(str) # define _CCCL_DIAG_SUPPRESS_GCC(str) _Pragma(_CCCL_TOSTRING(GCC diagnostic ignored str)) # define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) #elif defined(_CCCL_COMPILER_NVHPC) # define _CCCL_DIAG_PUSH _Pragma("diagnostic push") # define _CCCL_DIAG_POP _Pragma("diagnostic pop") # define _CCCL_DIAG_SUPPRESS_CLANG(str) # define _CCCL_DIAG_SUPPRESS_GCC(str) -# define _CCCL_DIAG_SUPPRESS_NVHPC(str) _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress str)) +# define _CCCL_DIAG_SUPPRESS_NVHPC(str) _Pragma(_CCCL_TOSTRING(diag_suppress str)) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) +#elif defined(_CCCL_COMPILER_MSVC) +# define _CCCL_DIAG_PUSH __pragma(warning(push)) +# define _CCCL_DIAG_POP __pragma(warning(pop)) +# define _CCCL_DIAG_SUPPRESS_CLANG(str) +# define _CCCL_DIAG_SUPPRESS_GCC(str) +# define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) __pragma(warning(disable : str)) #else # define _CCCL_DIAG_PUSH # define _CCCL_DIAG_POP # define _CCCL_DIAG_SUPPRESS_CLANG(str) # define _CCCL_DIAG_SUPPRESS_GCC(str) # define _CCCL_DIAG_SUPPRESS_NVHPC(str) +# define _CCCL_DIAG_SUPPRESS_MSVC(str) #endif // Convenient shortcuts to silence common warnings @@ -125,6 +142,11 @@ _CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated") \ _CCCL_DIAG_SUPPRESS_GCC("-Wdeprecated-declarations") # define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP +#elif defined(_CCCL_COMPILER_MSVC) +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH \ + _CCCL_DIAG_PUSH \ + _CCCL_DIAG_SUPPRESS_MSVC(4996) +# define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP _CCCL_DIAG_POP #else // !_CCCL_COMPILER_CLANG && !_CCCL_COMPILER_GCC # define _CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH # define _CCCL_DIAG_SUPPRESS_DEPRECATED_POP diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__config b/libcudacxx/include/cuda/std/detail/libcxx/include/__config index 9a190ac9a9..7c04dc13ee 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__config +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__config @@ -415,7 +415,7 @@ extern "C++" { # define _LIBCUDACXX_NO_CFI #endif -#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L +#if (defined(__ISO_C_VISIBLE) && __ISO_C_VISIBLE >= 2011) || __cplusplus >= 201103L # if defined(__FreeBSD__) # define _LIBCUDACXX_HAS_QUICK_EXIT # define _LIBCUDACXX_HAS_C11_FEATURES @@ -598,9 +598,11 @@ extern "C++" { // TODO: Clang incorrectly reports that __is_array is true for T[0]. // Re-enable the branch once https://llvm.org/PR54705 is fixed. +#ifndef _LIBCUDACXX_USE_IS_ARRAY_FALLBACK #if defined(_LIBCUDACXX_COMPILER_CLANG) #define _LIBCUDACXX_USE_IS_ARRAY_FALLBACK #endif // _LIBCUDACXX_COMPILER_CLANG +#endif // !_LIBCUDACXX_USE_IS_ARRAY_FALLBACK #if __check_builtin(is_assignable) \ || defined(_LIBCUDACXX_COMPILER_MSVC) @@ -676,9 +678,11 @@ extern "C++" { #define _LIBCUDACXX_IS_LVALUE_REFERENCE(...) __is_lvalue_reference(__VA_ARGS__) #endif // __check_builtin(is_lvalue_reference) +#ifndef _LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK #if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) #define _LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK #endif // nvcc < 11.3 +#endif // !_LIBCUDACXX_USE_IS_LVALUE_REFERENCE_FALLBACK #if __check_builtin(is_nothrow_assignable) \ || defined(_LIBCUDACXX_COMPILER_MSVC) \ @@ -702,9 +706,11 @@ extern "C++" { #define _LIBCUDACXX_IS_OBJECT(...) __is_object(__VA_ARGS__) #endif // __check_builtin(is_object) +#ifndef _LIBCUDACXX_USE_IS_OBJECT_FALLBACK #if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) #define _LIBCUDACXX_USE_IS_OBJECT_FALLBACK #endif // nvcc < 11.3 +#endif // !_LIBCUDACXX_USE_IS_OBJECT_FALLBACK #if __check_builtin(is_pod) \ || (defined(_LIBCUDACXX_COMPILER_GCC) && _GNUC_VER >= 403) \ @@ -804,9 +810,11 @@ extern "C++" { #define _LIBCUDACXX_IS_UNSIGNED(...) __is_unsigned(__VA_ARGS__) #endif // __check_builtin(is_unsigned) +#ifndef _LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK #if defined(_LIBCUDACXX_CUDACC_BELOW_11_3) #define _LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK #endif // nvcc < 11.3 +#endif // !_LIBCUDACXX_USE_IS_UNSIGNED_FALLBACK // libstdc++ defines this as a function, breaking functionality #if 0 // __check_builtin(is_void) @@ -980,11 +988,12 @@ typedef __char32_t char32_t; #elif defined(_LIBCUDACXX_COMPILER_GCC) +#ifndef _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK // FIXME: GCC 8.0 supports this trait, but it has a bug. // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91592 // https://godbolt.org/z/IljfIw #define _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK - +#endif // _LIBCUDACXX_USE_IS_ASSIGNABLE_FALLBACK // Determine if GCC supports relaxed constexpr #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L @@ -1762,32 +1771,6 @@ typedef unsigned int char32_t; # define _LIBCUDACXX_NODISCARD_FRIEND _LIBCUDACXX_NODISCARD_ATTRIBUTE friend #endif // !_LIBCUDACXX_CUDACC_BELOW_11_3 && !_LIBCUDACXX_COMPILER_CLANG -# ifdef _LIBCUDACXX_COMPILER_CLANG -# define _LIBCUDACXX_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") -# define _LIBCUDACXX_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") -# define _LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCUDACXX_TOSTRING(clang diagnostic ignored str)) -# define _LIBCUDACXX_GCC_DIAGNOSTIC_IGNORED(str) -# define _LIBCUDACXX_NVHPC_DIAGNOSTIC_IGNORED(str) -# elif defined(_LIBCUDACXX_COMPILER_GCC) -# define _LIBCUDACXX_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") -# define _LIBCUDACXX_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") -# define _LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED(str) -# define _LIBCUDACXX_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCUDACXX_TOSTRING(GCC diagnostic ignored str)) -# define _LIBCUDACXX_NVHPC_DIAGNOSTIC_IGNORED(str) -# elif defined(_LIBCUDACXX_COMPILER_NVHPC) -# define _LIBCUDACXX_DIAGNOSTIC_PUSH _Pragma("diagnostic push") -# define _LIBCUDACXX_DIAGNOSTIC_POP _Pragma("diagnostic pop") -# define _LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED(str) -# define _LIBCUDACXX_GCC_DIAGNOSTIC_IGNORED(str) -# define _LIBCUDACXX_NVHPC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCUDACXX_TOSTRING(diag_suppress str)) -# else -# define _LIBCUDACXX_DIAGNOSTIC_PUSH -# define _LIBCUDACXX_DIAGNOSTIC_POP -# define _LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED(str) -# define _LIBCUDACXX_GCC_DIAGNOSTIC_IGNORED(str) -# define _LIBCUDACXX_NVHPC_DIAGNOSTIC_IGNORED(str) -# endif - // _LIBCUDACXX_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not // specified as such as an extension. #if defined(_LIBCUDACXX_ENABLE_NODISCARD) && !defined(_LIBCUDACXX_DISABLE_NODISCARD_EXT) diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__cuda/barrier.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__cuda/barrier.h index 7563ef6a7f..d73d1c2dbb 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__cuda/barrier.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__cuda/barrier.h @@ -29,7 +29,10 @@ #include "../cstdlib" // _LIBCUDACXX_UNREACHABLE #include "../__type_traits/void_t.h" // _CUDA_VSTD::__void_t + +#if defined(_CCCL_CUDA_COMPILER) #include "../__cuda/ptx.h" // cuda::ptx::* +#endif // _CCCL_CUDA_COMPILER #if defined(_LIBCUDACXX_COMPILER_NVRTC) #define _LIBCUDACXX_OFFSET_IS_ZERO(type, member) !(&(((type *)0)->member)) @@ -567,6 +570,7 @@ inline _CUDA_VSTD::uint64_t * barrier_native_handle(barrier return reinterpret_cast<_CUDA_VSTD::uint64_t *>(&b.__barrier); } +#if defined(_CCCL_CUDA_COMPILER) // Hide arrive_tx when CUDA architecture is insufficient. Note the // (!defined(__CUDA_MINIMUM_ARCH__)). This is required to make sure the function @@ -686,9 +690,12 @@ void barrier_expect_tx( : "memory"); } #endif // __CUDA_MINIMUM_ARCH__ +#endif // _CCCL_CUDA_COMPILER _LIBCUDACXX_END_NAMESPACE_CUDA_DEVICE +#if defined(_CCCL_CUDA_COMPILER) + _LIBCUDACXX_BEGIN_NAMESPACE_CUDA template<> @@ -1218,4 +1225,6 @@ async_contract_fulfillment memcpy_async(void * __destination, void const * __sou _LIBCUDACXX_END_NAMESPACE_CUDA +#endif // _CCCL_CUDA_COMPILER + #endif // _LIBCUDACXX___CUDA_BARRIER_H diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/bad_expected_access.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/bad_expected_access.h index 7bc5276aa6..d77b56c135 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/bad_expected_access.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__expected/bad_expected_access.h @@ -13,9 +13,6 @@ #include <__config> #endif // __cuda_std__ -#include "../__utility/move.h" -#include "../exception" - #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) @@ -24,7 +21,10 @@ # pragma system_header #endif // no system header -#if _LIBCUDACXX_STD_VER > 11 +#include "../__utility/move.h" +#include "../exception" + +#if _LIBCUDACXX_STD_VER > 11 _LIBCUDACXX_BEGIN_NAMESPACE_STD @@ -39,7 +39,7 @@ class bad_expected_access : public exception { bad_expected_access(bad_expected_access&&) = default; bad_expected_access& operator=(const bad_expected_access&) = default; bad_expected_access& operator=(bad_expected_access&&) = default; - ~bad_expected_access() override = default; + ~bad_expected_access() noexcept override = default; public: // The way this has been designed (by using a class template below) means that we'll already @@ -47,7 +47,7 @@ class bad_expected_access : public exception { // of work to do. So it is not worth hiding the specialization in the dylib, given that // it adds deployment target restrictions. _LIBCUDACXX_INLINE_VISIBILITY - const char* what() const noexcept override { return "bad access to _CUDA_VSTD::expected"; } + const char* what() const noexcept override { return "bad access to std::expected"; } }; template diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binary_function.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binary_function.h index 961c21a88b..22bd6068fa 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binary_function.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binary_function.h @@ -45,12 +45,10 @@ template struct __binary_function_keep }; #if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) -_LIBCUDACXX_DIAGNOSTIC_PUSH -_LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") -_LIBCUDACXX_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH template using __binary_function = binary_function<_Arg1, _Arg2, _Result>; -_LIBCUDACXX_DIAGNOSTIC_POP +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP #else template using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder1st.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder1st.h index efc9515561..501157bcfb 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder1st.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder1st.h @@ -29,6 +29,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD #if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH + template class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX11 binder1st : public __unary_function @@ -56,6 +58,8 @@ binder1st<__Operation> bind1st(const __Operation& __op, const _Tp& __x) {return binder1st<__Operation>(__op, __x);} +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP + #endif // _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder2nd.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder2nd.h index 999e905183..535ff2d3ac 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder2nd.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/binder2nd.h @@ -29,6 +29,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD #if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH + template class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX11 binder2nd : public __unary_function @@ -56,6 +58,8 @@ binder2nd<__Operation> bind2nd(const __Operation& __op, const _Tp& __x) {return binder2nd<__Operation>(__op, __x);} +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP + #endif // _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/mem_fun_ref.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/mem_fun_ref.h index 0ccf76d93f..216b3b7a90 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/mem_fun_ref.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/mem_fun_ref.h @@ -30,6 +30,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD #if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH + template class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX11 mem_fun_t : public __unary_function<_Tp*, _Sp> @@ -174,6 +176,8 @@ const_mem_fun1_ref_t<_Sp,_Tp,_Ap> mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const) {return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);} +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP + #endif // _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_binary_function.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_binary_function.h index bbcfb96396..784fda73fe 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_binary_function.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_binary_function.h @@ -29,6 +29,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD #if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH + template class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX11 pointer_to_binary_function : public __binary_function<_Arg1, _Arg2, _Result> @@ -47,7 +49,9 @@ pointer_to_binary_function<_Arg1,_Arg2,_Result> ptr_fun(_Result (*__f)(_Arg1,_Arg2)) {return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);} -#endif +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP + +#endif // _LIBCUDACXX_STD_VER <= 14 || _LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_unary_function.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_unary_function.h index f5f8b25247..523665e940 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_unary_function.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/pointer_to_unary_function.h @@ -29,6 +29,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD #if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH + template class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX11 pointer_to_unary_function : public __unary_function<_Arg, _Result> @@ -47,6 +49,8 @@ pointer_to_unary_function<_Arg,_Result> ptr_fun(_Result (*__f)(_Arg)) {return pointer_to_unary_function<_Arg,_Result>(__f);} +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP + #endif // _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS) _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_function.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_function.h index d06fc3d75b..90bcfe3842 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_function.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_function.h @@ -42,12 +42,12 @@ template struct __unary_function_keep_layout_base { }; #if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) -_LIBCUDACXX_DIAGNOSTIC_PUSH -_LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") -_LIBCUDACXX_GCC_DIAGNOSTIC_IGNORED("-Wdeprecated-declarations") + +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH template using __unary_function = unary_function<_Arg, _Result>; -_LIBCUDACXX_DIAGNOSTIC_POP +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP + #else template using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_negate.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_negate.h index 97448758b2..c0f833d8d0 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_negate.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__functional/unary_negate.h @@ -29,6 +29,8 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD #if _LIBCUDACXX_STD_VER <= 17 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_NEGATORS) +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH + template class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX17 unary_negate : public __unary_function @@ -49,6 +51,8 @@ _LIBCUDACXX_DEPRECATED_IN_CXX17 inline _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUD unary_negate<_Predicate> not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);} +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP + #endif // _LIBCUDACXX_STD_VER <= 17 || defined(_LIBCUDACXX_ENABLE_CXX20_REMOVED_NEGATORS) _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/incrementable_traits.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/incrementable_traits.h index 655ac8fd22..02fe765213 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/incrementable_traits.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/incrementable_traits.h @@ -16,9 +16,11 @@ #endif // __cuda_std__ #include "../__concepts/arithmetic.h" +#include "../__concepts/same_as.h" #include "../__type_traits/conditional.h" #include "../__type_traits/enable_if.h" #include "../__type_traits/is_const.h" +#include "../__type_traits/is_object.h" #include "../__type_traits/is_pointer.h" #include "../__type_traits/is_primary_template.h" #include "../__type_traits/make_signed.h" diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/istream_iterator.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/istream_iterator.h index adf07bcc0a..b7646fc17e 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/istream_iterator.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/istream_iterator.h @@ -15,6 +15,7 @@ #include <__config> #endif // __cuda_std__ +#include "../__iterator/iterator_traits.h" #include "../__iterator/iterator.h" #include "../__memory/addressof.h" #include "../cstddef" diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/readable_traits.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/readable_traits.h index 17c029c3a1..c80f927473 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/readable_traits.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__iterator/readable_traits.h @@ -15,6 +15,8 @@ #include <__config> #endif // __cuda_std__ +#include "../__concepts/same_as.h" +#include "../__iterator/incrementable_traits.h" #include "../__type_traits/is_primary_template.h" #include "../__type_traits/conditional.h" #include "../__type_traits/enable_if.h" diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_base_of.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_base_of.h index 04bbf1aac1..6b730675c7 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_base_of.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_base_of.h @@ -14,7 +14,11 @@ #include <__config> #endif // __cuda_std__ +#include "../__type_traits/enable_if.h" #include "../__type_traits/integral_constant.h" +#include "../__type_traits/is_class.h" +#include "../__utility/declval.h" +#include "../cstddef" #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header @@ -44,17 +48,18 @@ namespace __is_base_of_imp template struct _Dst { - _Dst(const volatile _Tp &); + _LIBCUDACXX_INLINE_VISIBILITY _Dst(const volatile _Tp &); }; template struct _Src { - operator const volatile _Tp &(); - template operator const _Dst<_Up> &(); + _LIBCUDACXX_INLINE_VISIBILITY operator const volatile _Tp &(); + template + _LIBCUDACXX_INLINE_VISIBILITY operator const _Dst<_Up> &(); }; template struct __one { typedef char type; }; -template typename __one(declval<_Src<_Dp> >()))>::type __test(int); -template __two __test(...); +template _LIBCUDACXX_HOST_DEVICE typename __one(_CUDA_VSTD::declval<_Src<_Dp> >()))>::type __test(int); +template _LIBCUDACXX_HOST_DEVICE __two __test(...); } template diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_class.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_class.h index a789283432..13dc62b3ca 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_class.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_class.h @@ -43,8 +43,8 @@ _LIBCUDACXX_INLINE_VAR constexpr bool is_class_v = _LIBCUDACXX_IS_CLASS(_Tp); namespace __is_class_imp { -template char __test(int _Tp::*); -template __two __test(...); +template _LIBCUDACXX_HOST_DEVICE char __test(int _Tp::*); +template _LIBCUDACXX_HOST_DEVICE __two __test(...); } template struct _LIBCUDACXX_TEMPLATE_VIS is_class diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_empty.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_empty.h index 325c20367a..d6bc168d03 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_empty.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_empty.h @@ -15,6 +15,7 @@ #endif // __cuda_std__ #include "../__type_traits/integral_constant.h" +#include "../__type_traits/is_class.h" #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header @@ -51,7 +52,7 @@ struct __is_empty2 double __lx; }; -template ::value> +template struct __libcpp_empty : public integral_constant) == sizeof(__is_empty2)> {}; template struct __libcpp_empty<_Tp, false> : public false_type {}; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_literal_type.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_literal_type.h index 6bac98a226..7fb8477c43 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_literal_type.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_literal_type.h @@ -44,6 +44,7 @@ _LIBCUDACXX_DEPRECATED_IN_CXX17 _LIBCUDACXX_INLINE_VAR constexpr bool is_literal template struct _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX17 is_literal_type : public integral_constant>::value || is_reference<__remove_all_extents_t<_Tp>>::value> +{}; #if _LIBCUDACXX_STD_VER > 11 && !defined(_LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES) template diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_nothrow_destructible.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_nothrow_destructible.h index 3e969f8dc0..b3e54b0b09 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_nothrow_destructible.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_nothrow_destructible.h @@ -42,23 +42,18 @@ struct is_nothrow_destructible #elif !defined(_LIBCUDACXX_HAS_NO_NOEXCEPT) -template struct __libcpp_is_nothrow_destructible; +template ::value> +struct __libcpp_is_nothrow_destructible : false_type {}; template -struct __libcpp_is_nothrow_destructible - : public false_type -{ -}; - -template -struct __libcpp_is_nothrow_destructible +struct __libcpp_is_nothrow_destructible<_Tp, true> : public integral_constant().~_Tp()) > { }; template struct _LIBCUDACXX_TEMPLATE_VIS is_nothrow_destructible - : public __libcpp_is_nothrow_destructible::value, _Tp> + : public __libcpp_is_nothrow_destructible<_Tp> { }; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_polymorphic.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_polymorphic.h index 203afbc9c2..a7ea25386b 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_polymorphic.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_polymorphic.h @@ -16,6 +16,8 @@ #include "../__type_traits/enable_if.h" #include "../__type_traits/integral_constant.h" +#include "../__type_traits/is_class.h" // __two +#include "../__utility/declval.h" #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header @@ -40,9 +42,10 @@ _LIBCUDACXX_INLINE_VAR constexpr bool is_polymorphic_v = _LIBCUDACXX_IS_POLYMORP #else -template char &__is_polymorphic_impl( - __enable_if_t(_CUDA_VSTD::declval<_Tp*>())) != 0, int>); -template __two &__is_polymorphic_impl(...); +template +_LIBCUDACXX_HOST_DEVICE char &__is_polymorphic_impl(__enable_if_t(_CUDA_VSTD::declval<_Tp*>())) != 0, int>); +template +_LIBCUDACXX_HOST_DEVICE __two &__is_polymorphic_impl(...); template struct _LIBCUDACXX_TEMPLATE_VIS is_polymorphic : public integral_constant(0)) == 1> {}; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_standard_layout.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_standard_layout.h index d503bc58c4..41fac48840 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_standard_layout.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_standard_layout.h @@ -16,6 +16,8 @@ #endif // __cuda_std__ #include "../__type_traits/integral_constant.h" +#include "../__type_traits/is_scalar.h" +#include "../__type_traits/remove_all_extents.h" #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_constructible.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_constructible.h index 1b221e5c4d..7718bf7fa3 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_constructible.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_constructible.h @@ -47,6 +47,8 @@ struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_constructible : false_type { }; + +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH template struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_constructible<_Tp> #if defined(_LIBCUDACXX_HAS_TRIVIAL_CONSTRUCTOR) && !defined(_LIBCUDACXX_USE_HAS_TRIVIAL_CONSTRUCTOR_FALLBACK) @@ -56,6 +58,7 @@ struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_constructible<_Tp> #endif // defined(_LIBCUDACXX_HAS_TRIVIAL_CONSTRUCTOR) && !defined(_LIBCUDACXX_USE_HAS_TRIVIAL_CONSTRUCTOR_FALLBACK) { }; +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP template struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_constructible<_Tp, _Tp&&> diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_copyable.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_copyable.h index 6442d34793..36b440e20a 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_copyable.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_copyable.h @@ -42,7 +42,7 @@ _LIBCUDACXX_INLINE_VAR constexpr bool is_trivially_copyable_v = _LIBCUDACXX_IS_T #else template struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_copyable - : integral_constant::type>::value> + : integral_constant>::value> {}; #if _LIBCUDACXX_STD_VER > 11 && !defined(_LIBCUDACXX_HAS_NO_VARIABLE_TEMPLATES) diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_destructible.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_destructible.h index 8fe4344549..109d437a92 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_destructible.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__type_traits/is_trivially_destructible.h @@ -37,8 +37,12 @@ template struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_destructible #elif defined(_LIBCUDACXX_HAS_TRIVIAL_DESTRUCTOR) && !defined(_LIBCUDACXX_USE_HAS_TRIVIAL_DESTRUCTOR_FALLBACK) -template struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_destructible - : public integral_constant::value && _LIBCUDACXX_HAS_TRIVIAL_DESTRUCTOR(_Tp)> {}; +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH +template +struct _LIBCUDACXX_TEMPLATE_VIS is_trivially_destructible + : public integral_constant::value && _LIBCUDACXX_HAS_TRIVIAL_DESTRUCTOR(_Tp)> +{}; +_CCCL_DIAG_SUPPRESS_DEPRECATED_POP #else diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/integer_sequence.h b/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/integer_sequence.h index a99b4be8b6..cc5fb31911 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/integer_sequence.h +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__utility/integer_sequence.h @@ -15,6 +15,7 @@ #endif // __cuda_std__ #include "../__type_traits/is_integral.h" +#include "../cstddef" #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/algorithm b/libcudacxx/include/cuda/std/detail/libcxx/include/algorithm index 219c134b5c..b9e86d1e45 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/algorithm +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/algorithm @@ -4159,7 +4159,7 @@ inline _LIBCUDACXX_INLINE_VISIBILITY void sort(_Tp** __first, _Tp** __last) { - _CUDA_VSTD::sort((size_t*)__first, (size_t*)__last, __less()); + _CUDA_VSTD::sort((size_t*)__first, (size_t*)__last, __less{}); } template @@ -4179,39 +4179,39 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp) _CUDA_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp); } -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, char*>(char*, char*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, signed char*>(signed char*, signed char*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, short*>(short*, short*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, int*>(int*, int*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned*>(unsigned*, unsigned*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long*>(long*, long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long long*>(long long*, long long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, float*>(float*, float*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, double*>(double*, double*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long double*>(long double*, long double*, __less&)) - -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, char*>(char*, char*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, signed char*>(signed char*, signed char*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, short*>(short*, short*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, int*>(int*, int*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned*>(unsigned*, unsigned*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long*>(long*, long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long long*>(long long*, long long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, float*>(float*, float*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, double*>(double*, double*, __less&)) -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long double*>(long double*, long double*, __less&)) - -_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS unsigned __sort5<__less&, long double*>(long double*, long double*, long double*, long double*, long double*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, char*>(char*, char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, signed*>(signed*, signed*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, short*>(short*, short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, int*>(int*, int*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned*>(unsigned*, unsigned*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long*>(long*, long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long long*>(long long*, long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, float*>(float*, float*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, double*>(double*, double*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS void __sort<__less&, long double*>(long double*, long double*, __less&)) + +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, char*>(char*, char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, wchar_t*>(wchar_t*, wchar_t*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, signed char*>(signed char*, signed char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned char*>(unsigned char*, unsigned char*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, short*>(short*, short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned short*>(unsigned short*, unsigned short*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, int*>(int*, int*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned*>(unsigned*, unsigned*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long*>(long*, long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned long*>(unsigned long*, unsigned long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long long*>(long long*, long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, unsigned long long*>(unsigned long long*, unsigned long long*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, float*>(float*, float*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, double*>(double*, double*, __less&)) +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS bool __insertion_sort_incomplete<__less&, long double*>(long double*, long double*, __less&)) + +_LIBCUDACXX_EXTERN_TEMPLATE(_LIBCUDACXX_FUNC_VIS unsigned __sort5<__less&, long double*>(long double*, long double*, long double*, long double*, long double*, __less&)) // lower_bound @@ -4255,7 +4255,7 @@ _ForwardIterator lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return _CUDA_VSTD::lower_bound(__first, __last, __value_, - __less::value_type, _Tp>()); + __less{}); } // upper_bound @@ -4300,7 +4300,7 @@ _ForwardIterator upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return _CUDA_VSTD::upper_bound(__first, __last, __value_, - __less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>()); + __less{}); } // equal_range @@ -4357,7 +4357,7 @@ pair<_ForwardIterator, _ForwardIterator> equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return _CUDA_VSTD::equal_range(__first, __last, __value_, - __less::value_type, _Tp>()); + __less{}); } // binary_search @@ -4388,7 +4388,7 @@ bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) { return _CUDA_VSTD::binary_search(__first, __last, __value_, - __less::value_type, _Tp>()); + __less{}); } // merge @@ -4435,7 +4435,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last1, { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; - return _CUDA_VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>()); + return _CUDA_VSTD::merge(__first1, __last1, __first2, __last2, __result, __less{}); } // inplace_merge @@ -4613,7 +4613,7 @@ void inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last) { _CUDA_VSTD::inplace_merge(__first, __middle, __last, - __less::value_type>()); + __less{}); } // stable_sort @@ -5701,7 +5701,7 @@ bool next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) { return _CUDA_VSTD::next_permutation(__first, __last, - __less::value_type>()); + __less{}); } // prev_permutation @@ -5749,7 +5749,7 @@ bool prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last) { return _CUDA_VSTD::prev_permutation(__first, __last, - __less::value_type>()); + __less{}); } #endif diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/chrono b/libcudacxx/include/cuda/std/detail/libcxx/include/chrono index 3bc3a42cc8..71f47b9fe7 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/chrono +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/chrono @@ -823,6 +823,7 @@ constexpr chrono::year operator ""y(unsigned lo } // std */ +#include "__cccl_config" #ifndef __cuda_std__ #include <__config> #else @@ -3207,9 +3208,10 @@ constexpr hours make24(const hours& __h, bool __is_pm) noexcept #pragma GCC system_header #endif -_LIBCUDACXX_DIAGNOSTIC_PUSH -_LIBCUDACXX_GCC_DIAGNOSTIC_IGNORED("-Wliteral-suffix") -_LIBCUDACXX_CLANG_DIAGNOSTIC_IGNORED("-Wuser-defined-literals") +_CCCL_DIAG_PUSH +_CCCL_DIAG_SUPPRESS_GCC("-Wliteral-suffix") +_CCCL_DIAG_SUPPRESS_CLANG("-Wuser-defined-literals") +_CCCL_DIAG_SUPPRESS_MSVC(4455) // Suffixes for duration literals [time.duration.literals] inline namespace literals { @@ -3302,7 +3304,8 @@ inline namespace literals } #endif //_LIBCUDACXX_STD_VER > 17 && !defined(_LIBCUDACXX_HAS_NO_CXX20_CHRONO_LITERALS) }} -_LIBCUDACXX_DIAGNOSTIC_POP + +_CCCL_DIAG_POP namespace chrono { // hoist the literals into namespace std::chrono using namespace literals::chrono_literals; diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/complex b/libcudacxx/include/cuda/std/detail/libcxx/include/complex index 19bd33c22a..96c857a1da 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/complex +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/complex @@ -1833,6 +1833,12 @@ operator>>(::std::basic_istream& is, complex& z) #if _LIBCUDACXX_STD_VER > 11 && defined(_LIBCUDACXX_HAS_STL_LITERALS) // Literal suffix for complex number literals [complex.literals] + +_CCCL_DIAG_PUSH +_CCCL_DIAG_SUPPRESS_GCC("-Wliteral-suffix") +_CCCL_DIAG_SUPPRESS_CLANG("-Wuser-defined-literals") +_CCCL_DIAG_SUPPRESS_MSVC(4455) + inline namespace literals { inline namespace complex_literals @@ -1901,6 +1907,9 @@ inline namespace literals #endif } // namespace complex_literals } // namespace literals + +_CCCL_DIAG_POP + #endif _LIBCUDACXX_END_NAMESPACE_STD diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/exception b/libcudacxx/include/cuda/std/detail/libcxx/include/exception index 3406e3a022..78cba41b9c 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/exception +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/exception @@ -80,15 +80,6 @@ template void rethrow_if_nested(const E& e); #include <__config> #endif //__cuda_std__ -#include "cstddef" -#include "cstdlib" -#include "type_traits" -#include "version" - -#if defined(_LIBCUDACXX_ABI_VCRUNTIME) -#include -#endif - #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) @@ -97,9 +88,17 @@ template void rethrow_if_nested(const E& e); # pragma system_header #endif // no system header +#include "cstddef" +#include "cstdlib" +#include "type_traits" +#include "version" + +#if defined(_LIBCUDACXX_ABI_VCRUNTIME) +#include +#endif _LIBCUDACXX_BEGIN_NAMESPACE_STD_NOVERSION // purposefully not using versioning namespace -#if !defined(_LIBCUDACXX_ABI_VCRUNTIME) +#if !defined(_LIBCUDACXX_ABI_VCRUNTIME) || defined(__cuda_std__) class _LIBCUDACXX_EXCEPTION_ABI exception { public: @@ -116,6 +115,9 @@ public: _LIBCUDACXX_HOST_DEVICE virtual ~bad_exception() noexcept; _LIBCUDACXX_HOST_DEVICE virtual const char* what() const noexcept; }; +#else // ^^^ !_LIBCUDACXX_ABI_VCRUNTIME || __cuda_std__^^^ / vvv _LIBCUDACXX_ABI_VCRUNTIME vvv +// pull in the exception definition from vcruntime, which lives in namespace std +using ::std::exception; #endif // !_LIBCUDACXX_ABI_VCRUNTIME #if _LIBCUDACXX_STD_VER <= 14 \ @@ -149,9 +151,9 @@ public: _LIBCUDACXX_INLINE_VISIBILITY exception_ptr() noexcept : __ptr_() {} _LIBCUDACXX_INLINE_VISIBILITY exception_ptr(nullptr_t) noexcept : __ptr_() {} - exception_ptr(const exception_ptr&) noexcept; - exception_ptr& operator=(const exception_ptr&) noexcept; - ~exception_ptr() noexcept; + _LIBCUDACXX_HOST_DEVICE exception_ptr(const exception_ptr&) noexcept; + _LIBCUDACXX_HOST_DEVICE exception_ptr& operator=(const exception_ptr&) noexcept; + _LIBCUDACXX_HOST_DEVICE ~exception_ptr() noexcept; _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_EXPLICIT operator bool() const noexcept {return __ptr_ != nullptr;} @@ -189,7 +191,7 @@ make_exception_ptr(_Ep __e) noexcept #else // _LIBCUDACXX_ABI_MICROSOFT -class _LIBCUDACXX_TYPE_VIS exception_ptr +class _LIBCUDACXX_EXCEPTION_ABI exception_ptr { #if defined(_LIBCUDACXX_COMPILER_CLANG) #pragma clang diagnostic push @@ -219,7 +221,7 @@ bool operator!=(const exception_ptr& __x, const exception_ptr& __y) noexcept _LIBCUDACXX_FUNC_VIS void swap(exception_ptr&, exception_ptr&) noexcept; -_LIBCUDACXX_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except, const void* __ptr); +_LIBCUDACXX_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except_, const void* __ptr); _LIBCUDACXX_FUNC_VIS exception_ptr current_exception() noexcept; _LIBCUDACXX_NORETURN _LIBCUDACXX_FUNC_VIS void rethrow_exception(exception_ptr p); @@ -241,13 +243,13 @@ class _LIBCUDACXX_EXCEPTION_ABI nested_exception { exception_ptr __ptr_; public: - nested_exception() noexcept; + _LIBCUDACXX_HOST_DEVICE nested_exception() noexcept; // nested_exception(const nested_exception&) noexcept = default; // nested_exception& operator=(const nested_exception&) noexcept = default; - virtual ~nested_exception() noexcept; + _LIBCUDACXX_HOST_DEVICE virtual ~nested_exception() noexcept; // access functions - _LIBCUDACXX_NORETURN void rethrow_nested() const; + _LIBCUDACXX_NORETURN _LIBCUDACXX_HOST_DEVICE void rethrow_nested() const; _LIBCUDACXX_INLINE_VISIBILITY exception_ptr nested_ptr() const noexcept {return __ptr_;} }; @@ -283,7 +285,7 @@ struct __throw_with_nested<_Tp, _Up, false> { #endif template -_LIBCUDACXX_NORETURN +_LIBCUDACXX_NORETURN inline _LIBCUDACXX_INLINE_VISIBILITY void throw_with_nested(_Tp&& __t) { @@ -302,10 +304,12 @@ throw_with_nested(_Tp&& __t) } template -struct __can_dynamic_cast : public _LIBCUDACXX_BOOL_CONSTANT( +struct __can_dynamic_cast : public + _LIBCUDACXX_BOOL_CONSTANT( is_polymorphic<_From>::value && (!is_base_of<_To, _From>::value || - is_convertible::value)) {}; + is_convertible::value)) +{}; template inline _LIBCUDACXX_INLINE_VISIBILITY @@ -313,9 +317,11 @@ void rethrow_if_nested(const _Ep& __e, typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0) { +#if !defined(_LIBCUDACXX_COMPILER_MSVC) const nested_exception* __nep = dynamic_cast(_CUDA_VSTD::addressof(__e)); if (__nep) __nep->rethrow_nested(); +#endif // _LIBCUDACXX_COMPILER_MSVC } template diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/span b/libcudacxx/include/cuda/std/detail/libcxx/include/span index 71c65b86d9..fba76e27ad 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/span +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/span @@ -315,19 +315,18 @@ public: return {data() + size() - __count, __count}; } + template + using __subspan_t = span; + template _LIBCUDACXX_INLINE_VISIBILITY - constexpr auto subspan() const noexcept - -> span + constexpr __subspan_t<_Offset, _Count> subspan() const noexcept { static_assert(_Offset <= _Extent, "span::subspan(): Offset out of range"); static_assert(_Count == dynamic_extent || _Count <= _Extent - _Offset, "span::subspan(): Offset + Count out of range"); - - using _ReturnType = span; - return _ReturnType{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; + return __subspan_t<_Offset, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; } - _LIBCUDACXX_INLINE_VISIBILITY _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 span subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept @@ -476,13 +475,16 @@ public: return {data() + size() - __count, __count}; } + template + using __subspan_t = span; + template _LIBCUDACXX_INLINE_VISIBILITY - _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 span subspan() const noexcept + _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 __subspan_t<_Offset, _Count> subspan() const noexcept { _LIBCUDACXX_ASSERT(_Offset <= size(), "span::subspan(): Offset out of range"); _LIBCUDACXX_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset, "span::subspan(): Offset + Count out of range"); - return span{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; + return __subspan_t<_Offset, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; } _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 span diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/variant b/libcudacxx/include/cuda/std/detail/libcxx/include/variant index aec00c9fcb..8b9324988c 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/variant +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/variant @@ -226,7 +226,11 @@ public: virtual const char* what() const noexcept; }; -} // namespace std +_LIBCUDACXX_END_NAMESPACE_STD_NOVERSION + +#endif // __cuda_std__ + +#if _LIBCUDACXX_STD_VER >= 14 && !defined(_LIBCUDACXX_COMPILER_MSVC_2017) _LIBCUDACXX_BEGIN_NAMESPACE_STD @@ -1666,6 +1670,6 @@ struct _LIBCUDACXX_TEMPLATE_VIS hash { _LIBCUDACXX_END_NAMESPACE_STD -_LIBCUDACXX_POP_MACROS +#endif // _LIBCUDACXX_STD_VER >= 14 && !_LIBCUDACXX_COMPILER_MSVC_2017 #endif // _LIBCUDACXX_VARIANT diff --git a/libcudacxx/libcxx/src/support/runtime/exception_pointer_msvc.ipp b/libcudacxx/libcxx/src/support/runtime/exception_pointer_msvc.ipp index c4fd890bdf..8195e49508 100644 --- a/libcudacxx/libcxx/src/support/runtime/exception_pointer_msvc.ipp +++ b/libcudacxx/libcxx/src/support/runtime/exception_pointer_msvc.ipp @@ -56,7 +56,7 @@ void swap(exception_ptr& lhs, exception_ptr& rhs) noexcept { __ExceptionPtrSwap(&rhs, &lhs); } -exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) { +exception_ptr __copy_exception_ptr(void* __except_, const void* __ptr) { exception_ptr __ret = nullptr; if (__ptr) __ExceptionPtrCopyException(&__ret, __except, __ptr); diff --git a/libcudacxx/test/CMakeLists.txt b/libcudacxx/test/CMakeLists.txt index 41dfeb8ecb..b6515b26a0 100644 --- a/libcudacxx/test/CMakeLists.txt +++ b/libcudacxx/test/CMakeLists.txt @@ -1,8 +1,40 @@ # Libcudacxx's main lit tests add_subdirectory(libcudacxx) -# Libcudacxx auto-generated include/smoke tests -add_subdirectory(smoke) +# Set appropriate warning levels for MSVC/sane +if("${CMAKE_CUDA_COMPILER_ID}" STREQUAL "NVIDIA") + # CUDA 11.5 and down do not support '-use-local-env' + if(MSVC) + set(headertest_warning_levels_device -Xcompiler=/W4 -Xcompiler=/WX) + if ("${CMAKE_CUDA_COMPILER_VERSION}" GREATER_EQUAL "11.6.0") + list(APPEND headertest_warning_levels_device --use-local-env) + endif() + else() + set(headertest_warning_levels_device -Wall -Werror all-warnings) + endif() +# Set warnings for Clang as device compiler +elseif("${CMAKE_CUDA_COMPILER_ID}" STREQUAL "Clang") + set(headertest_warning_levels_device -Wall -Werror -Wno-unknown-cuda-version -Xclang=-fcuda-allow-variadic-functions) +# If the CMAKE_CUDA_COMPILER is unknown, try to use gcc style warnings +else() + set(headertest_warning_levels_device -Wall -Werror) +endif() + +# Set raw host/device warnings +if(MSVC) + set(headertest_warning_levels_host /W4 /WX) +else() + set(headertest_warning_levels_host -Wall -Werror) +endif() + +# Libcudacxx auto-generated internal header tests +add_subdirectory(internal_headers) + +# Libcudacxx auto-generated public header tests +add_subdirectory(public_headers) + +# Libcudacxx auto-generated public header as std tests +add_subdirectory(public_headers_host_only) # Enable building the nvrtcc project if NVRTC is enabled if (LIBCUDACXX_TEST_WITH_NVRTC) diff --git a/libcudacxx/test/internal_headers/CMakeLists.txt b/libcudacxx/test/internal_headers/CMakeLists.txt new file mode 100644 index 0000000000..f51454926f --- /dev/null +++ b/libcudacxx/test/internal_headers/CMakeLists.txt @@ -0,0 +1,72 @@ +# For every private internal header build a TU that directly includes it +# without anything else to verify whether its properly modular. +# We also want to check whether all potential fallbacks are actually valid, +# even if we never exercise them in the current support matrix +add_custom_target(libcudacxx.test.internal_headers) + +# Grep all internal headers +file(GLOB_RECURSE internal_headers + RELATIVE "${libcudacxx_SOURCE_DIR}/include/cuda/std/detail/libcxx/include" + CONFIGURE_DEPENDS + ${libcudacxx_SOURCE_DIR}/include/cuda/std/detail/libcxx/include/__*/*.h +) + +# headers in `__cuda` are meant to come after the related "cuda" headers so they do not compile on their own +list(FILTER internal_headers EXCLUDE REGEX "__cuda/*") + +# mdspan is currently not supported on msvc outside of C++20 +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_STANDARD}" MATCHES "20") + list(FILTER internal_headers EXCLUDE REGEX "mdspan") +endif() + +function(libcudacxx_create_internal_header_test header_name, headertest_src, fallback) + if(fallback) + set(header_name "${header_name}_fallback") + endif() + + set(headertest_${header_name} verify_${header_name}) + add_library(headertest_${header_name} SHARED "${headertest_src}.cu" "${headertest_src}.cpp") + target_include_directories(headertest_${header_name} PRIVATE "${libcudacxx_SOURCE_DIR}/include") + target_compile_options(headertest_${header_name} + PRIVATE + $<$:${headertest_warning_levels_device}> + $<$:${headertest_warning_levels_host}>) + + if(fallback) + target_compile_definitions(headertest_${header_name} PRIVATE "-D${fallback}") + endif() + add_dependencies(libcudacxx.test.internal_headers headertest_${header_name}) +endfunction() + +function(libcudacxx_add_internal_header_test header) + # ${header} contains the "/" from the subfolder, replace by "_" for actual names + string(REPLACE "/" "_" header_name "${header}") + + # Create the source file for the header target from the template and add the file to the global project + set(headertest_src "headers/${header_name}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/header_test.cpp.in" "${headertest_src}.cu") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/header_test.cpp.in" "${headertest_src}.cpp") + + # Create the default target for that file + libcudacxx_create_internal_header_test(${header_name}, ${headertest_src}, "") + + # MSVC cannot handle some of the fallbacks + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + if("${header}" MATCHES "is_base_of" OR + "${header}" MATCHES "is_nothrow_destructible" OR + "${header}" MATCHES "is_polymorphic") + return() + endif() + endif() + + # Seach the file for a fallback definition + file(READ ${libcudacxx_SOURCE_DIR}/include/cuda/std/detail/libcxx/include/${header} header_file) + string(REGEX MATCH "_LIBCUDACXX_[A-Z_]*_FALLBACK" fallback "${header_file}") + if(fallback) + libcudacxx_create_internal_header_test(${header_name}, ${headertest_src}, ${fallback}) + endif() +endfunction() + +foreach(header IN LISTS internal_headers) + libcudacxx_add_internal_header_test(${header}) +endforeach() diff --git a/libcudacxx/test/internal_headers/header_test.cpp.in b/libcudacxx/test/internal_headers/header_test.cpp.in new file mode 100644 index 0000000000..e7dfa98033 --- /dev/null +++ b/libcudacxx/test/internal_headers/header_test.cpp.in @@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// 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 +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#if defined(_MSC_VER) +# define NOMINMAX +#endif + +// We need to include at least some header so that __cuda_std__ is defined +#include + +// ignore deprecation warnings +_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH + +// This file tests that the respective header is includable on its own with a cuda compiler +#include diff --git a/libcudacxx/test/libcudacxx/CMakeLists.txt b/libcudacxx/test/libcudacxx/CMakeLists.txt index 3f160c6faa..d049e7df02 100644 --- a/libcudacxx/test/libcudacxx/CMakeLists.txt +++ b/libcudacxx/test/libcudacxx/CMakeLists.txt @@ -123,11 +123,9 @@ if (NOT LIBCUDACXX_TEST_WITH_NVRTC) # Build but don't run the tests. Used by CI to pre-seed sccache for the test machines. # Only executed if explicitly requested. add_custom_target(libcudacxx.test.lit.precompile - "${CMAKE_COMMAND}" -E env - "LIBCUDACXX_SITE_CONFIG=${lit_site_cfg_path}" - "${libcudacxx_LIT}" -vv --no-progress-bar --time-tests - "-Dexecutor=\"NoopExecutor()\"" # Don't run the compiled tests. - "${libcudacxx_SOURCE_DIR}/test/libcudacxx" + DEPENDS libcudacxx.test.public_headers libcudacxx.test.internal_headers libcudacxx.test.public_headers_host_only + COMMAND "${CMAKE_COMMAND}" -E env "LIBCUDACXX_SITE_CONFIG=${lit_site_cfg_path}" + "${libcudacxx_LIT}" -vv --no-progress-bar ${libcudacxx_LIT_FLAGS} "-Dexecutor=\"NoopExecutor()\"" "${libcudacxx_SOURCE_DIR}/test/libcudacxx" ) endif() diff --git a/libcudacxx/test/libcudacxx/std/utilities/meta/meta.rel/is_base_of_fallback.pass.cpp b/libcudacxx/test/libcudacxx/std/utilities/meta/meta.rel/is_base_of_fallback.pass.cpp new file mode 100644 index 0000000000..8eff5f4299 --- /dev/null +++ b/libcudacxx/test/libcudacxx/std/utilities/meta/meta.rel/is_base_of_fallback.pass.cpp @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: msvc + +// type_traits + +// is_base_of + +#define _LIBCUDACXX_USE_IS_BASE_OF_FALLBACK + +#include + +#include "test_macros.h" + +template +__host__ __device__ +void test_is_base_of() +{ + static_assert((cuda::std::is_base_of::value), ""); + static_assert((cuda::std::is_base_of::value), ""); + static_assert((cuda::std::is_base_of::value), ""); + static_assert((cuda::std::is_base_of::value), ""); +#if TEST_STD_VER > 2011 + static_assert((cuda::std::is_base_of_v), ""); + static_assert((cuda::std::is_base_of_v), ""); + static_assert((cuda::std::is_base_of_v), ""); + static_assert((cuda::std::is_base_of_v), ""); +#endif +} + +template +__host__ __device__ +void test_is_not_base_of() +{ + static_assert((!cuda::std::is_base_of::value), ""); +} + +struct B {}; +struct B1 : B {}; +struct B2 : B {}; +struct D : private B1, private B2 {}; +struct I0; // incomplete + +int main(int, char**) +{ + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + test_is_base_of(); + + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + +// A scalar is never the base class of anything (including incomplete types) + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + +// A scalar never has base classes (including incomplete types) + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + test_is_not_base_of(); + + return 0; +} diff --git a/libcudacxx/test/public_headers/CMakeLists.txt b/libcudacxx/test/public_headers/CMakeLists.txt new file mode 100644 index 0000000000..838b11171a --- /dev/null +++ b/libcudacxx/test/public_headers/CMakeLists.txt @@ -0,0 +1,58 @@ +# For every public header build a TU that directly includes it +# without anything else to verify whether its properly modular +add_custom_target(libcudacxx.test.public_headers) + +# Grep all public headers +file(GLOB public_headers + LIST_DIRECTORIES false + RELATIVE "${libcudacxx_SOURCE_DIR}/include" + CONFIGURE_DEPENDS + "${libcudacxx_SOURCE_DIR}/include/cuda/*" + "${libcudacxx_SOURCE_DIR}/include/cuda/std/*" +) + +# annotated_ptr does not work with nvcc 11.1 or clang cuda due to __nv_associate_access_property +if ("${CMAKE_CUDA_COMPILER_VERSION}" MATCHES "11\.*\.*" OR + "${CMAKE_CUDA_COMPILER_ID}" MATCHES "Clang") + list(FILTER public_headers EXCLUDE REGEX "annotated_ptr") +endif() + +# mdspan is currently not supported on msvc outside of C++20 +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_STANDARD}" MATCHES "20") + list(FILTER public_headers EXCLUDE REGEX "mdspan") +endif() + +# We need to handle atomic headers differently as they do not compile on architectures below sm70 +set(architectures_at_least_sm70) +foreach(item IN LISTS CMAKE_CUDA_ARCHITECTURES) + if(item GREATER_EQUAL 70) + list(APPEND architectures_at_least_sm70 ${item}) + endif() +endforeach() + +function(libcudacxx_add_public_header_test header) + # ${header} contains the "/" from the subfolder, replace by "_" for actual names + string(REPLACE "/" "_" header_name "${header}") + + # Create the source file for the header target from the template and add the file to the global project + set(headertest_src "headers/${header_name}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/header_test.cpp.in" "${headertest_src}.cu") + + # Create the default target for that file + set(headertest_${header_name} verify_${header_name}) + add_library(headertest_${header_name} SHARED "${headertest_src}.cu") + target_include_directories(headertest_${header_name} PRIVATE "${libcudacxx_SOURCE_DIR}/include") + target_compile_options(headertest_${header_name} PRIVATE ${headertest_warning_levels_device}) + + # Ensure that if this is an atomic header, we only include the right architectures + string(REGEX MATCH "atomic|barrier|latch|semaphore|annotated_ptr|pipeline" match "${header}") + if(match) + set_target_properties(headertest_${header_name} PROPERTIES CUDA_ARCHITECTURES "${architectures_at_least_sm70}") + endif() + + add_dependencies(libcudacxx.test.public_headers headertest_${header_name}) +endfunction() + +foreach(header IN LISTS public_headers) + libcudacxx_add_public_header_test(${header}) +endforeach() diff --git a/libcudacxx/test/public_headers/header_test.cpp.in b/libcudacxx/test/public_headers/header_test.cpp.in new file mode 100644 index 0000000000..ab46aa5e5d --- /dev/null +++ b/libcudacxx/test/public_headers/header_test.cpp.in @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// 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 +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#if defined(_MSC_VER) +# define NOMINMAX +#endif + +// ignore deprecation warnings +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wdeprecated" +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +#elif defined(_MSC_VER) +# pragma warning (disable: 4996) +#else +# pragma GCC diagnostic ignored "-Wdeprecated" +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +// This file tests that the respective header is includable on its own with a cuda compiler +#include <${header}> diff --git a/libcudacxx/test/public_headers_host_only/CMakeLists.txt b/libcudacxx/test/public_headers_host_only/CMakeLists.txt new file mode 100644 index 0000000000..8b41cd681c --- /dev/null +++ b/libcudacxx/test/public_headers_host_only/CMakeLists.txt @@ -0,0 +1,37 @@ +# For every public header build a TU that directly includes it +# without anything else but also pretents to be a std header +add_custom_target(libcudacxx.test.public_headers_host_only) + +# Grep all public headers +file(GLOB public_headers_host_only + LIST_DIRECTORIES false + RELATIVE "${libcudacxx_SOURCE_DIR}/include/" + CONFIGURE_DEPENDS + "${libcudacxx_SOURCE_DIR}/include/cuda/std/*" +) + +# mdspan is currently not supported on msvc outside of C++20 +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_CXX_STANDARD}" MATCHES "20") + list(FILTER public_headers_host_only EXCLUDE REGEX "mdspan") +endif() + +function(libcudacxx_add_std_header_test header) + # ${header} contains the "/" from the subfolder, replace by "_" for actual names + string(REPLACE "/" "_" header_name "${header}") + + # Create the source file for the header target from the template and add the file to the global project + set(headertest_src "headers/${header_name}") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/header_test.cpp.in" "${headertest_src}.cpp") + + # Create the default target for that file + set(headertest_std_${header_name} verify_${header_name}) + add_library(headertest_std_${header_name} SHARED "${headertest_src}.cpp") + target_include_directories(headertest_std_${header_name} PRIVATE "${libcudacxx_SOURCE_DIR}/include") + target_compile_options(headertest_std_${header_name} PRIVATE ${headertest_warning_levels_host}) + + add_dependencies(libcudacxx.test.public_headers_host_only headertest_std_${header_name}) +endfunction() + +foreach(header IN LISTS public_headers_host_only) + libcudacxx_add_std_header_test(${header}) +endforeach() diff --git a/libcudacxx/test/public_headers_host_only/header_test.cpp.in b/libcudacxx/test/public_headers_host_only/header_test.cpp.in new file mode 100644 index 0000000000..9590469781 --- /dev/null +++ b/libcudacxx/test/public_headers_host_only/header_test.cpp.in @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// Part of libcu++, the C++ Standard Library for your entire system, +// 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 +// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. +// +//===----------------------------------------------------------------------===// + +#if defined(_MSC_VER) +# define NOMINMAX +#endif + +// ignore deprecation warnings +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wdeprecated" +# pragma clang diagnostic ignored "-Wdeprecated-declarations" +#elif defined(_MSC_VER) +# pragma warning (disable: 4996) +#else +# pragma GCC diagnostic ignored "-Wdeprecated" +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +// This file tests that the respective header is includable on its own and be compiled with a host compiler +#include <${header}> diff --git a/libcudacxx/test/smoke/CMakeLists.txt b/libcudacxx/test/smoke/CMakeLists.txt deleted file mode 100644 index 5b82c67679..0000000000 --- a/libcudacxx/test/smoke/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -add_custom_target(libcudacxx.test.smoke) - -set(cpp_std_versions 11 14 17 20) - -set(cpp_11_exclusions "cuda/annotated_ptr" "cuda/std/mdspan") -set(cpp_14_exclusions "cuda/annotated_ptr" "cuda/std/mdspan") -set(cpp_17_exclusions "cuda/annotated_ptr" "cuda/std/mdspan") -set(cpp_20_exclusions "cuda/annotated_ptr") - -function(libcudacxx_add_standalone_header_test test_file_output_var header_under_test version) - # ex: build/.../header_tests/cuda/std/version.cpp - set(test_cpp "${CMAKE_CURRENT_BINARY_DIR}/header_tests/${header_under_test}.cpp") - - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/header_test.cpp.in" - "${test_cpp}" - ) - - set(${test_file_output_var} ${test_cpp} PARENT_SCOPE) - # ex: cuda/std/version -> cuda_std_version - - string(REPLACE "/" "_" executable_name "${header_under_test}-${version}") - list(FIND cpp_${version}_exclusions ${header_under_test} header_excluded) - - if ("${header_excluded}" EQUAL "-1") - add_library(${executable_name} OBJECT ${test_cpp}) - target_include_directories(${executable_name} PRIVATE "${libcudacxx_SOURCE_DIR}/include") - target_compile_options(${executable_name} PRIVATE - $<$,$,$>: - -Wall -Werror> - $<$: - /W4 /WX>) - set_target_properties(${executable_name} PROPERTIES CXX_STANDARD ${version}) - set_target_properties(${executable_name} PROPERTIES CXX_STANDARD_REQUIRED ON) - set_target_properties(${executable_name} PROPERTIES CXX_EXTENSIONS OFF) - add_dependencies(libcudacxx.test.smoke ${executable_name}) - endif() - -endfunction() - -file(GLOB cuda_headers LIST_DIRECTORIES false RELATIVE "${libcudacxx_SOURCE_DIR}/include" "${libcudacxx_SOURCE_DIR}/include/cuda/*") -file(GLOB cuda_std_headers LIST_DIRECTORIES false RELATIVE "${libcudacxx_SOURCE_DIR}/include" "${libcudacxx_SOURCE_DIR}/include/cuda/std/*") - -foreach(version IN LISTS cpp_std_versions) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(cxx_version "/std:c++${version}") - else() - set(cxx_version "-std=c++${version}") - endif() - - try_compile( - dialect_supported - ${CMAKE_BINARY_DIR}/dialect_check_${version} "${CMAKE_CURRENT_SOURCE_DIR}/detect_dialect.cpp" - COMPILE_DEFINITIONS ${cxx_version} - ) - - if (dialect_supported) - foreach(header IN LISTS cuda_headers cuda_std_headers) - libcudacxx_add_standalone_header_test(test_file ${header} ${version}) - endforeach() - endif() -endforeach() diff --git a/libcudacxx/test/smoke/detect_dialect.cpp b/libcudacxx/test/smoke/detect_dialect.cpp deleted file mode 100644 index cef4fc92f7..0000000000 --- a/libcudacxx/test/smoke/detect_dialect.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include -#include - -int main() { - return 0; -} diff --git a/libcudacxx/test/smoke/header_test.cpp.in b/libcudacxx/test/smoke/header_test.cpp.in deleted file mode 100644 index d274a1ceda..0000000000 --- a/libcudacxx/test/smoke/header_test.cpp.in +++ /dev/null @@ -1,17 +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 -// -//===----------------------------------------------------------------------===// - -#if defined(_MSC_VER) -# define NOMINMAX -#endif - -#include <@header_under_test@> - -int main() { - return 0; -}