Skip to content

Commit

Permalink
Avoid pragmas inside noexcept clause
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Jan 14, 2025
1 parent 373816c commit e47d220
Show file tree
Hide file tree
Showing 7 changed files with 230 additions and 227 deletions.
51 changes: 25 additions & 26 deletions thrust/thrust/async/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,46 +72,45 @@ using thrust::async::unimplemented::async_copy;
struct copy_fn final
{
template <typename FromPolicy, typename ToPolicy, typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH static auto
call(thrust::detail::execution_policy_base<FromPolicy> const& from_exec,
thrust::detail::execution_policy_base<ToPolicy> const& to_exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_copy(
THRUST_RETURNS(async_copy(
thrust::detail::derived_cast(thrust::detail::strip_const(from_exec)),
thrust::detail::derived_cast(thrust::detail::strip_const(to_exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output)))

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output)
THRUST_RETURNS(copy_fn::call(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
// Synthesize a suitable new execution policy, because we don't want to
// try and extract twice from the one we were passed.
,
typename remove_cvref_t<decltype(thrust::detail::derived_cast(thrust::detail::strip_const(exec)))>::tag_type{},
THRUST_FWD(output))) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output)
THRUST_RETURNS(copy_fn::call(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
// Synthesize a suitable new execution policy, because we don't want to
// try and extract twice from the one we were passed.
,
typename remove_cvref_t<decltype(thrust::detail::derived_cast(thrust::detail::strip_const(exec)))>::tag_type{},
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output)))

template <typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output) THRUST_RETURNS(copy_fn::call(
thrust::detail::select_system(typename thrust::iterator_system<remove_cvref_t<ForwardIt>>::type{}),
thrust::detail::select_system(typename thrust::iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output)))

template <typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output)
THRUST_RETURNS(copy_fn::call(
thrust::detail::select_system(typename thrust::iterator_system<remove_cvref_t<ForwardIt>>::type{}),
thrust::detail::select_system(typename thrust::iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output)))

template <typename... Args>
CCCL_DEPRECATED _CCCL_NODISCARD _CCCL_HOST auto operator()(Args&&... args) const
template <typename... Args>
CCCL_DEPRECATED _CCCL_NODISCARD _CCCL_HOST auto operator()(Args&&... args) const
THRUST_RETURNS(call(THRUST_FWD(args)...))
};

Expand Down
24 changes: 11 additions & 13 deletions thrust/thrust/async/for_each.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,26 @@ using thrust::async::unimplemented::async_for_each;
struct for_each_fn final
{
template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename UnaryFunction>
_CCCL_HOST static auto
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH static auto
call(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
UnaryFunction&& f)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_for_each(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_RETURNS(async_for_each(thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(f))) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename ForwardIt, typename Sentinel, typename UnaryFunction>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, UnaryFunction&& f) THRUST_RETURNS(for_each_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(f)))

template <typename ForwardIt, typename Sentinel, typename UnaryFunction>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, UnaryFunction&& f)
THRUST_RETURNS(for_each_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(f)))

template <typename... Args>
CCCL_DEPRECATED _CCCL_NODISCARD _CCCL_HOST auto operator()(Args&&... args) const
template <typename... Args>
CCCL_DEPRECATED _CCCL_NODISCARD _CCCL_HOST auto operator()(Args&&... args) const
THRUST_RETURNS(call(THRUST_FWD(args)...))
};

Expand Down
194 changes: 98 additions & 96 deletions thrust/thrust/async/reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,65 +70,67 @@ using thrust::async::unimplemented::async_reduce;
struct reduce_fn final
{
template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename T, typename BinaryOp>
_CCCL_HOST static auto
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH static auto
call(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
T&& init,
BinaryOp&& op)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce(
THRUST_RETURNS(async_reduce(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
THRUST_FWD(op)))

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename T>
_CCCL_HOST static auto call4(
thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
T&& init,
thrust::true_type)
THRUST_FWD(op))) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename T>
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH
static auto call4(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
T&& init,
thrust::true_type)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce(
THRUST_RETURNS(async_reduce(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
thrust::plus<remove_cvref_t<T>>{}))

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel>
_CCCL_HOST static auto call3(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
thrust::true_type)
thrust::plus<remove_cvref_t<T>>{})) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel>
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH
static auto call3(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
thrust::true_type)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce(
THRUST_RETURNS(async_reduce(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<remove_cvref_t<typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type>>{}))

template <typename ForwardIt, typename Sentinel, typename T, typename BinaryOp>
_CCCL_HOST static auto call4(ForwardIt&& first, Sentinel&& last, T&& init, BinaryOp&& op, thrust::false_type)
THRUST_RETURNS(reduce_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
THRUST_FWD(op)))

template <typename ForwardIt, typename Sentinel, typename T>
_CCCL_HOST static auto call3(ForwardIt&& first, Sentinel&& last, T&& init, thrust::false_type)
THRUST_RETURNS(reduce_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
thrust::plus<remove_cvref_t<T>>{}))
_CCCL_SUPPRESS_DEPRECATED_POP

template <typename ForwardIt, typename Sentinel, typename T, typename BinaryOp>
_CCCL_HOST static auto call4(ForwardIt&& first, Sentinel&& last, T&& init, BinaryOp&& op, thrust::false_type)
THRUST_RETURNS(reduce_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
THRUST_FWD(op)))

template <typename ForwardIt, typename Sentinel, typename T>
_CCCL_HOST static auto call3(ForwardIt&& first, Sentinel&& last, T&& init, thrust::false_type)
THRUST_RETURNS(reduce_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(init),
thrust::plus<remove_cvref_t<T>>{}))

// MSVC WAR: MSVC gets angsty and eats all available RAM when we try to detect
// if T1 is an execution_policy by using SFINAE. Switching to a static
Expand Down Expand Up @@ -189,89 +191,89 @@ using thrust::async::unimplemented::async_reduce_into;
struct reduce_into_fn final
{
template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt, typename T, typename BinaryOp>
_CCCL_HOST static auto
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH static auto
call(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output,
T&& init,
BinaryOp&& op)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce_into(
THRUST_RETURNS(async_reduce_into(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
THRUST_FWD(op)))

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt, typename T>
_CCCL_HOST static auto call5(
thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output,
T&& init,
thrust::true_type)
THRUST_FWD(op))) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt, typename T>
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH static auto call5(
thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output,
T&& init,
thrust::true_type)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce_into(
THRUST_RETURNS(async_reduce_into(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
thrust::plus<remove_cvref_t<T>>{}))

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call4(
thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output,
thrust::true_type)
thrust::plus<remove_cvref_t<T>>{})) _CCCL_SUPPRESS_DEPRECATED_POP

template <typename DerivedPolicy, typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST _CCCL_SUPPRESS_DEPRECATED_PUSH
static auto call4(thrust::detail::execution_policy_base<DerivedPolicy> const& exec,
ForwardIt&& first,
Sentinel&& last,
OutputIt&& output,
thrust::true_type)
// ADL dispatch.
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce_into(
THRUST_RETURNS(async_reduce_into(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<remove_cvref_t<typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type>>{}))

template <typename ForwardIt, typename Sentinel, typename OutputIt, typename T, typename BinaryOp>
_CCCL_HOST static auto call5(
ForwardIt&& first, Sentinel&& last, OutputIt&& output, T&& init, BinaryOp&& op, thrust::false_type)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
THRUST_FWD(op)))

template <typename ForwardIt, typename Sentinel, typename OutputIt, typename T>
_CCCL_HOST static auto call4(
ForwardIt&& first, Sentinel&& last, OutputIt&& output, T&& init, thrust::false_type)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
thrust::plus<remove_cvref_t<T>>{}))

template <typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<remove_cvref_t<typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type>>{}))
_CCCL_SUPPRESS_DEPRECATED_POP

template <typename ForwardIt, typename Sentinel, typename OutputIt, typename T, typename BinaryOp>
_CCCL_HOST static auto call5(
ForwardIt&& first, Sentinel&& last, OutputIt&& output, T&& init, BinaryOp&& op, thrust::false_type)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
THRUST_FWD(op)))

template <typename ForwardIt, typename Sentinel, typename OutputIt, typename T>
_CCCL_HOST static auto call4(ForwardIt&& first, Sentinel&& last, OutputIt&& output, T&& init, thrust::false_type)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
THRUST_FWD(init),
thrust::plus<remove_cvref_t<T>>{}))

template <typename ForwardIt, typename Sentinel, typename OutputIt>
_CCCL_HOST static auto call(ForwardIt&& first, Sentinel&& last, OutputIt&& output)
THRUST_RETURNS(reduce_into_fn::call(
thrust::detail::select_system(typename iterator_system<remove_cvref_t<ForwardIt>>::type{},
typename iterator_system<remove_cvref_t<OutputIt>>::type{}),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(output),
typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type{},
thrust::plus<remove_cvref_t<typename iterator_traits<remove_cvref_t<ForwardIt>>::value_type>>{}))

// MSVC WAR: MSVC gets angsty and eats all available RAM when we try to detect
// if T1 is an execution_policy by using SFINAE. Switching to a static
Expand Down
Loading

0 comments on commit e47d220

Please sign in to comment.