Skip to content

Commit

Permalink
Deprecate hpx::util::unwrapped
Browse files Browse the repository at this point in the history
* Use hpx::util::unwrap and hpx::util::unwrapping instead,
  that clearify which underlying implementation should
  be used (the immediate or the deferred one).
  The automatic implementation selection was broken since
  unwrapped allowed to pass non future arguments through.
* Closes STEllAR-GROUP#1400
* Closes STEllAR-GROUP#1404
* Closes STEllAR-GROUP#2456
* Ref STEllAR-GROUP#1126
* Ref STEllAR-GROUP#1132
  • Loading branch information
Naios committed Jul 25, 2017
1 parent b255c4b commit 790392c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 13 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -948,6 +948,14 @@ if(HPX_WITH_ALGORITHM_INPUT_ITERATOR_SUPPORT)
hpx_add_config_define(HPX_HAVE_ALGORITHM_INPUT_ITERATOR_SUPPORT)
endif()

# HPX_WITH_UNWRAPPED_COMPATIBILITY: introduced in V1.1.0
hpx_option(HPX_WITH_UNWRAPPED_COMPATIBILITY BOOL
"Enable the deprecated unwrapped function (default: ON)"
ON ADVANCED)
if(HPX_WITH_UNWRAPPED_COMPATIBILITY)
hpx_add_config_define(HPX_HAVE_UNWRAPPED_COMPATIBILITY)
endif()

################################################################################
# Set basic search paths for HPX
################################################################################
Expand Down
6 changes: 6 additions & 0 deletions docs/whats_new.qbk
Expand Up @@ -55,6 +55,12 @@ particular order):
minimal Visual Studio version we now test on is Visual Studio 2015.5.
* We have dropped support for the Boost V1.51-V1.54. The minimal version of
Boost we now test is Boost V1.55.
* We have dropped support for the `hpx::util::unwrapped` API.
`hpx::util::unwrapped` will stay functional to some degree,
until it finally gets removed in a later version of HPX.
The functional usage of `hpx::util::unwrapped` should be
changed to the new `hpx::util::unwrapping` function whereas
the immediate usage should be replaced to `hpx::util::unwrap`.

[heading Bug Fixes (Closed Tickets)]

Expand Down
30 changes: 17 additions & 13 deletions hpx/util/unwrapped.hpp
Expand Up @@ -9,6 +9,11 @@
#define HPX_UTIL_UNWRAPPED_HPP

#include <hpx/config.hpp>

// hpx::util::unwrapped was deprecated in V1.1.0 and thus will be
// removed in a later version of HPX.
#if defined(HPX_HAVE_UNWRAPPED_COMPATIBILITY)

#include <hpx/traits/is_future.hpp>
#include <hpx/traits/is_future_range.hpp>
#include <hpx/traits/is_future_tuple.hpp>
Expand Down Expand Up @@ -127,12 +132,11 @@ namespace util {
/// as soon as we allowed to route non future types through.
///
template <typename... Args>
// This will be enabled once the old implementation is deprecated:
// #if !defined(HPX_NO_DEPRECATE_UNWRAPPED)
// HPX_DEPRECATED("hpx::util::unwrapped was replaced by "
// "hpx::util::unwrap and hpx::util::unwrapping "
// "and might be removed in a later version of HPX!")
// #endif // HPX_NO_DEPRECATE_UNWRAPPED
#if !defined(HPX_NO_DEPRECATE_UNWRAPPED)
HPX_DEPRECATED("hpx::util::unwrapped was replaced by "
"hpx::util::unwrap and hpx::util::unwrapping "
"and might be removed in a later version of HPX!")
#endif // HPX_NO_DEPRECATE_UNWRAPPED
auto unwrapped(Args&&... args) -> decltype(detail::proxy_new_unwrapped<
detail::is_functional_unwrap<Args...>::value,
1U>::proxy(std::forward<Args>(args)...))
Expand All @@ -152,12 +156,11 @@ namespace util {
/// See hpx::util::unwrapped() for details.
///
template <typename... Args>
// This will be enabled once the old implementation is deprecated:
// #if !defined(HPX_NO_DEPRECATE_UNWRAPPED)
// HPX_DEPRECATED("hpx::util::unwrapped2 was replaced by "
// "hpx::util::unwrap_n<2> and hpx::util::unwrapping_n<2> "
// "and might be removed in a later version of HPX!")
// #endif // HPX_NO_DEPRECATE_UNWRAPPED
#if !defined(HPX_NO_DEPRECATE_UNWRAPPED)
HPX_DEPRECATED("hpx::util::unwrapped2 was replaced by "
"hpx::util::unwrap_n<2> and hpx::util::unwrapping_n<2> "
"and might be removed in a later version of HPX!")
#endif // HPX_NO_DEPRECATE_UNWRAPPED
auto unwrapped2(Args&&... args) -> decltype(detail::proxy_new_unwrapped<
detail::is_functional_unwrap<Args...>::value,
2U>::proxy(std::forward<Args>(args)...))
Expand All @@ -169,4 +172,5 @@ namespace util {
} // end namespace util
} // end namespace hpx

#endif
#endif // HPX_HAVE_UNWRAPPED_COMPATIBILITY
#endif // HPX_UTIL_UNWRAPPED_HPP
11 changes: 11 additions & 0 deletions tests/unit/util/unwrapped.cpp
Expand Up @@ -6,6 +6,9 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////

#include <hpx/config.hpp>

#if defined(HPX_HAVE_UNWRAPPED_COMPATIBILITY)
#define HPX_NO_DEPRECATE_UNWRAPPED

#include <hpx/hpx_init.hpp>
Expand Down Expand Up @@ -293,3 +296,11 @@ int main(
return report_errors();
}

#else // HPX_HAVE_UNWRAPPED_COMPATIBILITY

int main(int, char**)
{
return 0;
}

#endif // HPX_HAVE_UNWRAPPED_COMPATIBILITY

0 comments on commit 790392c

Please sign in to comment.