diff --git a/docs/repo.toml b/docs/repo.toml index 9ce0bbd0c2..af7b42c6f5 100644 --- a/docs/repo.toml +++ b/docs/repo.toml @@ -247,7 +247,6 @@ doxygen_predefined = [ "THRUST_NAMESPACE_END=}", "THRUST_INLINE_CONSTANT", "THRUST_PREVENT_MACRO_SUBSTITUTION", - "THRUST_TRAILING_RETURN(x)= -> x", "THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(x,y)=", "THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(x, y)=", "THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION(x, y)=", diff --git a/thrust/thrust/detail/config/compiler.h b/thrust/thrust/detail/config/compiler.h index f69680a284..6723f21c02 100644 --- a/thrust/thrust/detail/config/compiler.h +++ b/thrust/thrust/detail/config/compiler.h @@ -45,7 +45,6 @@ #define THRUST_DEVICE_COMPILER_NVCC 4 // figure out which host compiler we're using -// XXX we should move the definition of THRUST_DEPRECATED out of this logic #if defined(_CCCL_COMPILER_MSVC) # define THRUST_HOST_COMPILER THRUST_HOST_COMPILER_MSVC # define THRUST_MSVC_VERSION _MSC_VER diff --git a/thrust/thrust/detail/config/compiler_fence.h b/thrust/thrust/detail/config/compiler_fence.h index 6099f404b4..63ac1bd0ac 100644 --- a/thrust/thrust/detail/config/compiler_fence.h +++ b/thrust/thrust/detail/config/compiler_fence.h @@ -28,14 +28,12 @@ #include -// TODO: Enable this or remove this file once nvGRAPH/CUSP migrates off of it. -// #if defined(_CCCL_COMPILER_MSVC) -// #pragma message("warning: The functionality in this header is unsafe, deprecated, and will soon be removed. Use -// C++11 or C11 atomics instead.") -// #else -// #warning The functionality in this header is unsafe, deprecated, and will soon be removed. Use C++11 or C11 atomics -// instead. -// #endif +#if defined(_CCCL_COMPILER_MSVC) +# pragma message( \ + "warning: The functionality in this header is unsafe, deprecated, and will soon be removed. Use C++11 atomics instead.") +#else +#warning The functionality in this header is unsafe, deprecated, and will soon be removed. Use C++11 or C11 atomics instead. +#endif // msvc case #if defined(_CCCL_COMPILER_MSVC) diff --git a/thrust/thrust/detail/config/config.h b/thrust/thrust/detail/config/config.h index 80b858b08d..f45561486e 100644 --- a/thrust/thrust/detail/config/config.h +++ b/thrust/thrust/detail/config/config.h @@ -38,11 +38,9 @@ #include #include #include -// host_system.h & device_system.h must be #included as early as possible -// because other config headers depend on it +// host_system.h & device_system.h must be #included as early as possible because other config headers depend on it #include -#include #include #include #include diff --git a/thrust/thrust/detail/config/cpp_compatibility.h b/thrust/thrust/detail/config/cpp_compatibility.h index dc9383ccad..eaff148540 100644 --- a/thrust/thrust/detail/config/cpp_compatibility.h +++ b/thrust/thrust/detail/config/cpp_compatibility.h @@ -34,14 +34,6 @@ # define __has_cpp_attribute(X) 0 #endif -// Trailing return types seem to confuse Doxygen, and cause it to interpret -// parts of the function's body as new function signatures. -#if defined(THRUST_DOXYGEN) -# define THRUST_TRAILING_RETURN(...) -#else -# define THRUST_TRAILING_RETURN(...) ->__VA_ARGS__ -#endif - #define THRUST_NODISCARD _CCCL_NODISCARD // FIXME: Combine THRUST_INLINE_CONSTANT and diff --git a/thrust/thrust/detail/config/debug.h b/thrust/thrust/detail/config/debug.h deleted file mode 100644 index 6f4f3a9159..0000000000 --- a/thrust/thrust/detail/config/debug.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2008-2013 NVIDIA Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -// Internal config header that is only included through thrust/detail/config/config.h - -#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) -# pragma GCC system_header -#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) -# pragma clang system_header -#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) -# pragma system_header -#endif // no system header - -#ifndef THRUST_DEBUG -# ifndef NDEBUG -# if defined(DEBUG) || defined(_DEBUG) -# define THRUST_DEBUG 1 -# endif // (DEBUG || _DEBUG) -# endif // NDEBUG -#endif // THRUST_DEBUG - -#if THRUST_DEBUG -# ifndef __THRUST_SYNCHRONOUS -# define __THRUST_SYNCHRONOUS 1 -# endif // __THRUST_SYNCHRONOUS -#endif // THRUST_DEBUG diff --git a/thrust/thrust/detail/functional/operators/arithmetic_operators.h b/thrust/thrust/detail/functional/operators/arithmetic_operators.h index 7e9b8aea27..6306cc4409 100644 --- a/thrust/thrust/detail/functional/operators/arithmetic_operators.h +++ b/thrust/thrust/detail/functional/operators/arithmetic_operators.h @@ -51,7 +51,7 @@ struct unary_plus _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(+THRUST_FWD(t1))) - THRUST_TRAILING_RETURN(decltype(+THRUST_FWD(t1))) + -> decltype(+THRUST_FWD(t1)) { return +THRUST_FWD(t1); } @@ -182,7 +182,7 @@ struct prefix_increment _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(++THRUST_FWD(t1))) - THRUST_TRAILING_RETURN(decltype(++THRUST_FWD(t1))) + -> decltype(++THRUST_FWD(t1)) { return ++THRUST_FWD(t1); } @@ -203,7 +203,7 @@ struct postfix_increment _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(THRUST_FWD(t1)++)) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1)++)) + -> decltype(THRUST_FWD(t1)++) { return THRUST_FWD(t1)++; } @@ -224,7 +224,7 @@ struct prefix_decrement _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(--THRUST_FWD(t1))) - THRUST_TRAILING_RETURN(decltype(--THRUST_FWD(t1))) + -> decltype(--THRUST_FWD(t1)) { return --THRUST_FWD(t1); } @@ -245,7 +245,7 @@ struct postfix_decrement _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(THRUST_FWD(t1)--)) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1)--)) + -> decltype(THRUST_FWD(t1)--) { return THRUST_FWD(t1)--; } diff --git a/thrust/thrust/detail/functional/operators/assignment_operator.h b/thrust/thrust/detail/functional/operators/assignment_operator.h index 323e8303d6..990bc601b7 100644 --- a/thrust/thrust/detail/functional/operators/assignment_operator.h +++ b/thrust/thrust/detail/functional/operators/assignment_operator.h @@ -53,8 +53,7 @@ struct assign _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) = THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) = THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) = THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) = THRUST_FWD(t2)) { return THRUST_FWD(t1) = THRUST_FWD(t2); } diff --git a/thrust/thrust/detail/functional/operators/bitwise_operators.h b/thrust/thrust/detail/functional/operators/bitwise_operators.h index 5fcccfde8a..19ed9efb8e 100644 --- a/thrust/thrust/detail/functional/operators/bitwise_operators.h +++ b/thrust/thrust/detail/functional/operators/bitwise_operators.h @@ -107,7 +107,7 @@ struct bit_not _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1) const noexcept(noexcept(~THRUST_FWD(t1))) - THRUST_TRAILING_RETURN(decltype(~THRUST_FWD(t1))) + -> decltype(~THRUST_FWD(t1)) { return ~THRUST_FWD(t1); } @@ -128,8 +128,7 @@ struct bit_lshift _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) << THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) << THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) << THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) << THRUST_FWD(t2)) { return THRUST_FWD(t1) << THRUST_FWD(t2); } @@ -164,8 +163,7 @@ struct bit_rshift _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) >> THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) >> THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) >> THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) >> THRUST_FWD(t2)) { return THRUST_FWD(t1) >> THRUST_FWD(t2); } diff --git a/thrust/thrust/detail/functional/operators/compound_assignment_operators.h b/thrust/thrust/detail/functional/operators/compound_assignment_operators.h index 49572ef446..5163ba5cc9 100644 --- a/thrust/thrust/detail/functional/operators/compound_assignment_operators.h +++ b/thrust/thrust/detail/functional/operators/compound_assignment_operators.h @@ -43,8 +43,7 @@ struct plus_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) += THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) += THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) += THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) += THRUST_FWD(t2)) { return THRUST_FWD(t1) += THRUST_FWD(t2); } @@ -72,8 +71,7 @@ struct minus_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) -= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) -= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) -= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) -= THRUST_FWD(t2)) { return THRUST_FWD(t1) -= THRUST_FWD(t2); } @@ -101,8 +99,7 @@ struct multiplies_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) *= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) *= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) *= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) *= THRUST_FWD(t2)) { return THRUST_FWD(t1) *= THRUST_FWD(t2); } @@ -130,8 +127,7 @@ struct divides_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) /= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) /= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) /= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) /= THRUST_FWD(t2)) { return THRUST_FWD(t1) /= THRUST_FWD(t2); } @@ -159,8 +155,7 @@ struct modulus_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) %= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) %= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) %= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) %= THRUST_FWD(t2)) { return THRUST_FWD(t1) %= THRUST_FWD(t2); } @@ -188,8 +183,7 @@ struct bit_and_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) &= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) &= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) &= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) &= THRUST_FWD(t2)) { return THRUST_FWD(t1) &= THRUST_FWD(t2); } @@ -217,8 +211,7 @@ struct bit_or_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) |= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) |= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) |= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) |= THRUST_FWD(t2)) { return THRUST_FWD(t1) |= THRUST_FWD(t2); } @@ -246,8 +239,7 @@ struct bit_xor_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) ^= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) ^= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) ^= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) ^= THRUST_FWD(t2)) { return THRUST_FWD(t1) ^= THRUST_FWD(t2); } @@ -275,8 +267,7 @@ struct bit_lshift_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) <<= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) <<= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) <<= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) <<= THRUST_FWD(t2)) { return THRUST_FWD(t1) <<= THRUST_FWD(t2); } @@ -303,8 +294,7 @@ struct bit_rshift_equal _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const - noexcept(noexcept(THRUST_FWD(t1) >>= THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1) >>= THRUST_FWD(t2))) + noexcept(noexcept(THRUST_FWD(t1) >>= THRUST_FWD(t2))) -> decltype(THRUST_FWD(t1) >>= THRUST_FWD(t2)) { return THRUST_FWD(t1) >>= THRUST_FWD(t2); } diff --git a/thrust/thrust/device_make_unique.h b/thrust/thrust/device_make_unique.h index 7712e2a569..133552d46d 100644 --- a/thrust/thrust/device_make_unique.h +++ b/thrust/thrust/device_make_unique.h @@ -41,7 +41,7 @@ THRUST_NAMESPACE_BEGIN template _CCCL_HOST auto device_make_unique(Args&&... args) - THRUST_TRAILING_RETURN(decltype(uninitialized_allocate_unique(::cuda::std::declval>()))) + -> decltype(uninitialized_allocate_unique(::cuda::std::declval>())) { // FIXME: This is crude - we construct an unnecessary T on the host for // `device_new`. We need a proper dispatched `construct` algorithm to diff --git a/thrust/thrust/functional.h b/thrust/thrust/functional.h index e860c52768..ca6b051d2a 100644 --- a/thrust/thrust/functional.h +++ b/thrust/thrust/functional.h @@ -144,32 +144,30 @@ struct binary_function * \{ */ -#define THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(func, impl) \ - template <> \ - struct func \ - { \ - using is_transparent = void; \ - _CCCL_EXEC_CHECK_DISABLE \ - template \ - _CCCL_HOST_DEVICE constexpr auto operator()(T&& x) const noexcept(noexcept(impl)) \ - THRUST_TRAILING_RETURN(decltype(impl)) \ - { \ - return impl; \ - } \ +#define THRUST_UNARY_FUNCTOR_VOID_SPECIALIZATION(func, impl) \ + template <> \ + struct func \ + { \ + using is_transparent = void; \ + _CCCL_EXEC_CHECK_DISABLE \ + template \ + _CCCL_HOST_DEVICE constexpr auto operator()(T&& x) const noexcept(noexcept(impl)) -> decltype(impl) \ + { \ + return impl; \ + } \ } -#define THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION(func, impl) \ - template <> \ - struct func \ - { \ - using is_transparent = void; \ - _CCCL_EXEC_CHECK_DISABLE \ - template \ - _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const noexcept(noexcept(impl)) \ - THRUST_TRAILING_RETURN(decltype(impl)) \ - { \ - return impl; \ - } \ +#define THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION(func, impl) \ + template <> \ + struct func \ + { \ + using is_transparent = void; \ + _CCCL_EXEC_CHECK_DISABLE \ + template \ + _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&& t2) const noexcept(noexcept(impl)) -> decltype(impl) \ + { \ + return impl; \ + } \ } #define THRUST_BINARY_FUNCTOR_VOID_SPECIALIZATION_OP(func, op) \ @@ -1400,7 +1398,7 @@ struct project1st _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&& t1, T2&&) const noexcept(noexcept(THRUST_FWD(t1))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t1))) + -> decltype(THRUST_FWD(t1)) { return THRUST_FWD(t1); } @@ -1457,7 +1455,7 @@ struct project2nd _CCCL_EXEC_CHECK_DISABLE template _CCCL_HOST_DEVICE constexpr auto operator()(T1&&, T2&& t2) const noexcept(noexcept(THRUST_FWD(t2))) - THRUST_TRAILING_RETURN(decltype(THRUST_FWD(t2))) + -> decltype(THRUST_FWD(t2)) { return THRUST_FWD(t2); } diff --git a/thrust/thrust/optional.h b/thrust/thrust/optional.h index 34ed630a41..ff2d3a7ac9 100644 --- a/thrust/thrust/optional.h +++ b/thrust/thrust/optional.h @@ -154,7 +154,7 @@ template < int = 0> _CCCL_HOST_DEVICE constexpr auto invoke(Fn&& f, Args&&... args) noexcept(noexcept(std::mem_fn(f)(std::forward(args)...))) - THRUST_TRAILING_RETURN(decltype(std::mem_fn(f)(std::forward(args)...))) + -> decltype(std::mem_fn(f)(std::forward(args)...)) { return std::mem_fn(f)(std::forward(args)...); } @@ -163,7 +163,7 @@ _CCCL_EXEC_CHECK_DISABLE template >::value>> _CCCL_HOST_DEVICE constexpr auto invoke(Fn&& f, Args&&... args) noexcept(noexcept(std::forward(f)(std::forward(args)...))) - THRUST_TRAILING_RETURN(decltype(std::forward(f)(std::forward(args)...))) + -> decltype(std::forward(f)(std::forward(args)...)) { return std::forward(f)(std::forward(args)...); } diff --git a/thrust/thrust/zip_function.h b/thrust/thrust/zip_function.h index 3d407d098f..5bcdd79d8e 100644 --- a/thrust/thrust/zip_function.h +++ b/thrust/thrust/zip_function.h @@ -162,7 +162,7 @@ class zip_function template _CCCL_HOST_DEVICE auto operator()(Tuple&& args) const noexcept(noexcept(detail::zip_detail::apply(std::declval(), THRUST_FWD(args)))) - THRUST_TRAILING_RETURN(decltype(detail::zip_detail::apply(std::declval(), THRUST_FWD(args)))) + -> decltype(detail::zip_detail::apply(std::declval(), THRUST_FWD(args))) { return detail::zip_detail::apply(func, THRUST_FWD(args)); }