Skip to content

Commit

Permalink
More suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Jan 13, 2025
1 parent 0de4b6b commit 0a03003
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 50 deletions.
49 changes: 25 additions & 24 deletions thrust/thrust/async/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,40 @@ struct copy_fn final
Sentinel&& last,
OutputIt&& output)
// ADL dispatch.
_CCCL_SUPPRESS_DEPRECATED_PUSH //
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
9 changes: 5 additions & 4 deletions thrust/thrust/async/for_each.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ struct for_each_fn final
Sentinel&& last,
UnaryFunction&& f)
// ADL dispatch.
THRUST_RETURNS(async_for_each(thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
THRUST_FWD(f)))
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_for_each(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
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)
Expand Down
12 changes: 6 additions & 6 deletions thrust/thrust/async/reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct reduce_fn final
T&& init,
BinaryOp&& op)
// ADL dispatch.
THRUST_RETURNS(async_reduce(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -92,7 +92,7 @@ struct reduce_fn final
T&& init,
thrust::true_type)
// ADL dispatch.
THRUST_RETURNS(async_reduce(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -105,7 +105,7 @@ struct reduce_fn final
Sentinel&& last,
thrust::true_type)
// ADL dispatch.
THRUST_RETURNS(async_reduce(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand Down Expand Up @@ -197,7 +197,7 @@ struct reduce_into_fn final
T&& init,
BinaryOp&& op)
// ADL dispatch.
THRUST_RETURNS(async_reduce_into(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce_into(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -214,7 +214,7 @@ struct reduce_into_fn final
T&& init,
thrust::true_type)
// ADL dispatch.
THRUST_RETURNS(async_reduce_into(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce_into(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -230,7 +230,7 @@ struct reduce_into_fn final
OutputIt&& output,
thrust::true_type)
// ADL dispatch.
THRUST_RETURNS(async_reduce_into(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_reduce_into(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand Down
24 changes: 12 additions & 12 deletions thrust/thrust/async/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct inclusive_scan_fn final
OutputIt&& out,
BinaryOp&& op) const
// ADL dispatch.
THRUST_RETURNS(async_inclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_inclusive_scan(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -106,7 +106,7 @@ struct inclusive_scan_fn final
Sentinel&& last,
OutputIt&& out) const
// ADL dispatch.
THRUST_RETURNS(async_inclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_inclusive_scan(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -127,7 +127,7 @@ struct inclusive_scan_fn final
InitialValueType&& init,
BinaryOp&& op) const
// ADL dispatch.
THRUST_RETURNS(async_inclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_inclusive_scan(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -142,7 +142,7 @@ struct inclusive_scan_fn final
typename = std::enable_if_t<!is_execution_policy_v<remove_cvref_t<ForwardIt>>>>
CCCL_DEPRECATED auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, BinaryOp&& op) const
// ADL dispatch.
THRUST_RETURNS(async_inclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_inclusive_scan(
thrust::detail::select_system(iterator_system_t<remove_cvref_t<ForwardIt>>{},
iterator_system_t<remove_cvref_t<OutputIt>>{}),
THRUST_FWD(first),
Expand All @@ -153,7 +153,7 @@ struct inclusive_scan_fn final
template <typename ForwardIt, typename Sentinel, typename OutputIt>
CCCL_DEPRECATED auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out) const
// ADL dispatch.
THRUST_RETURNS(async_inclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_inclusive_scan(
thrust::detail::select_system(iterator_system_t<remove_cvref_t<ForwardIt>>{},
iterator_system_t<remove_cvref_t<OutputIt>>{}),
THRUST_FWD(first),
Expand All @@ -170,7 +170,7 @@ struct inclusive_scan_fn final
CCCL_DEPRECATED
auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, InitialValueType&& init, BinaryOp&& op) const
// ADL dispatch.
THRUST_RETURNS(async_inclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_inclusive_scan(
thrust::detail::select_system(iterator_system_t<remove_cvref_t<ForwardIt>>{},
iterator_system_t<remove_cvref_t<OutputIt>>{}),
THRUST_FWD(first),
Expand Down Expand Up @@ -210,7 +210,7 @@ struct exclusive_scan_fn final
InitialValueType&& init,
BinaryOp&& op) const
// ADL dispatch.
THRUST_RETURNS(async_exclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_exclusive_scan(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -226,7 +226,7 @@ struct exclusive_scan_fn final
OutputIt&& out,
InitialValueType&& init) const
// ADL dispatch.
THRUST_RETURNS(async_exclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_exclusive_scan(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -241,7 +241,7 @@ struct exclusive_scan_fn final
Sentinel&& last,
OutputIt&& out) const
// ADL dispatch.
THRUST_RETURNS(async_exclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_exclusive_scan(
thrust::detail::derived_cast(thrust::detail::strip_const(exec)),
THRUST_FWD(first),
THRUST_FWD(last),
Expand All @@ -258,7 +258,7 @@ struct exclusive_scan_fn final
CCCL_DEPRECATED
auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, InitialValueType&& init, BinaryOp&& op) const
// ADL dispatch.
THRUST_RETURNS(async_exclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_exclusive_scan(
thrust::detail::select_system(iterator_system_t<remove_cvref_t<ForwardIt>>{},
iterator_system_t<remove_cvref_t<OutputIt>>{}),
THRUST_FWD(first),
Expand All @@ -274,7 +274,7 @@ struct exclusive_scan_fn final
typename = std::enable_if_t<!is_execution_policy_v<remove_cvref_t<ForwardIt>>>>
CCCL_DEPRECATED auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out, InitialValueType&& init) const
// ADL dispatch.
THRUST_RETURNS(async_exclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_exclusive_scan(
thrust::detail::select_system(iterator_system_t<remove_cvref_t<ForwardIt>>{},
iterator_system_t<remove_cvref_t<OutputIt>>{}),
THRUST_FWD(first),
Expand All @@ -286,7 +286,7 @@ struct exclusive_scan_fn final
template <typename ForwardIt, typename Sentinel, typename OutputIt>
CCCL_DEPRECATED auto operator()(ForwardIt&& first, Sentinel&& last, OutputIt&& out) const
// ADL dispatch.
THRUST_RETURNS(async_exclusive_scan(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(async_exclusive_scan(
thrust::detail::select_system(iterator_system_t<remove_cvref_t<ForwardIt>>{},
iterator_system_t<remove_cvref_t<OutputIt>>{}),
THRUST_FWD(first),
Expand Down
6 changes: 3 additions & 3 deletions thrust/thrust/async/sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct stable_sort_fn final
, StrictWeakOrdering&& comp
)
// ADL dispatch.
THRUST_RETURNS(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(
async_stable_sort(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
, THRUST_FWD(first), THRUST_FWD(last)
Expand All @@ -99,7 +99,7 @@ struct stable_sort_fn final
, ForwardIt&& first, Sentinel&& last
)
// ADL dispatch.
THRUST_RETURNS(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(
async_stable_sort(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
, THRUST_FWD(first), THRUST_FWD(last)
Expand Down Expand Up @@ -181,7 +181,7 @@ struct sort_fn final
, StrictWeakOrdering&& comp
)
// ADL dispatch.
THRUST_RETURNS(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(
async_sort(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
, THRUST_FWD(first), THRUST_FWD(last)
Expand Down
2 changes: 1 addition & 1 deletion thrust/thrust/async/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct transform_fn final
, UnaryOperation&& op
)
// ADL dispatch.
THRUST_RETURNS(
_THRUST_RETURNS_SUPPRESS_DEPRECATIONS(
async_transform(
thrust::detail::derived_cast(thrust::detail::strip_const(exec))
, THRUST_FWD(first), THRUST_FWD(last)
Expand Down
8 changes: 8 additions & 0 deletions thrust/thrust/detail/type_deduction.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@
} \
/**/

#define _THRUST_RETURNS_SUPPRESS_DEPRECATIONS(...) \
noexcept(noexcept(__VA_ARGS__)) \
{ \
_CCCL_SUPPRESS_DEPRECATED_PUSH \
return (__VA_ARGS__); \
_CCCL_SUPPRESS_DEPRECATED_POP \
}

/// \def THRUST_DECLTYPE_RETURNS(...)
/// \brief Expands to a function definition, including a trailing returning
/// type, that returns the expression \c __VA_ARGS__.
Expand Down

0 comments on commit 0a03003

Please sign in to comment.