Skip to content

Commit

Permalink
Merge pull request #2781 from STEllAR-GROUP/deprecated_attribute
Browse files Browse the repository at this point in the history
Check for and optionally use [[deprecated]] attribute
  • Loading branch information
hkaiser committed Jul 25, 2017
2 parents 0f46913 + 5523f87 commit ad57059
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 23 deletions.
7 changes: 7 additions & 0 deletions cmake/HPX_AddConfigTest.cmake
Expand Up @@ -560,6 +560,13 @@ macro(hpx_check_for_cxx14_variable_templates)
CMAKECXXFEATURE cxx_variable_templates)
endmacro()

###############################################################################
macro(hpx_check_for_cxx14_deprecated_attribute)
add_hpx_config_test(HPX_WITH_CXX14_DEPRECATED_ATTRIBUTE
SOURCE cmake/tests/cxx14_deprecated_attribute.cpp
FILE ${ARGN})
endmacro()

###############################################################################
macro(hpx_check_for_libfun_std_experimental_optional)
add_hpx_config_test(HPX_WITH_LIBFUN_EXPERIMENTAL_OPTIONAL
Expand Down
3 changes: 3 additions & 0 deletions cmake/HPX_PerformCxxFeatureTests.cmake
Expand Up @@ -160,6 +160,9 @@ macro(hpx_perform_cxx_feature_tests)
hpx_check_for_cxx14_variable_templates(
DEFINITIONS HPX_HAVE_CXX14_VARIABLE_TEMPLATES)

hpx_check_for_cxx14_deprecated_attribute(
DEFINITIONS HPX_HAVE_CXX14_DEPRECATED_ATTRIBUTE)

# check for experimental facilities

# check for Library Fundamentals TS v2's experimental/optional
Expand Down
19 changes: 19 additions & 0 deletions cmake/tests/cxx14_deprecated_attribute.cpp
@@ -0,0 +1,19 @@
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017 Hartmut Kaiser
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
////////////////////////////////////////////////////////////////////////////////

#if !defined(__has_cpp_attribute)
# error "__has_cpp_attribute not supported, assume [[deprecated]] is not supported"
#else
# if !__has_cpp_attribute(deprecated)
# error "__has_cpp_attribute(deprecated) not supported"
# endif
#endif

int main()
{
return 0;
}
21 changes: 0 additions & 21 deletions hpx/config.hpp
Expand Up @@ -539,25 +539,4 @@
#define HPX_AGAS_LOCALITY_NS_MSB 0x0000000100000001ULL
#define HPX_AGAS_LOCALITY_NS_LSB 0x0000000000000004ULL

#if defined(HPX_HAVE_SODIUM)
# define HPX_ROOT_CERTIFICATE_AUTHORITY_MSB 0x0000000100000001ULL
# define HPX_ROOT_CERTIFICATE_AUTHORITY_LSB 0x0000000000000005ULL
# define HPX_SUBORDINATE_CERTIFICATE_AUTHORITY_MSB 0x0000000000000001ULL
// this is made locality specific
# define HPX_SUBORDINATE_CERTIFICATE_AUTHORITY_LSB 0x0000000000000006ULL
#endif

#if !defined(HPX_NO_DEPRECATED)
# define HPX_DEPRECATED_MSG \
"This function is deprecated and will be removed in the future."
# if defined(HPX_MSVC)
# define HPX_DEPRECATED(x) __declspec(deprecated(x))
# elif defined(__GNUC__)
# define HPX_DEPRECATED(x) __attribute__((__deprecated__(x)))
# endif
# if !defined(HPX_DEPRECATED)
# define HPX_DEPRECATED(x) /**/
# endif
#endif

#endif
17 changes: 17 additions & 0 deletions hpx/config/attributes.hpp
Expand Up @@ -8,10 +8,27 @@

#include <hpx/config/defines.hpp>

// handle [[fallthrough]]
#if defined(HPX_HAVE_CXX17_FALLTHROUGH_ATTRIBUTE)
# define HPX_FALLTHROUGH [[fallthrough]]
#else
# define HPX_FALLTHROUGH
#endif

// handle [[deprecated]]
#if !defined(HPX_NO_DEPRECATED)
# define HPX_DEPRECATED_MSG \
"This function is deprecated and will be removed in the future."
# if defined(HPX_HAVE_CXX14_DEPRECATED_ATTRIBUTE)
# define HPX_DEPRECATED(x) [[deprecated(x)]]
# elif defined(HPX_MSVC)
# define HPX_DEPRECATED(x) __declspec(deprecated(x))
# elif defined(__GNUC__)
# define HPX_DEPRECATED(x) __attribute__((__deprecated__(x)))
# endif
# if !defined(HPX_DEPRECATED)
# define HPX_DEPRECATED(x) /**/
# endif
#endif

#endif
2 changes: 1 addition & 1 deletion hpx/lcos/dataflow.hpp
Expand Up @@ -309,7 +309,7 @@ namespace hpx { namespace lcos { namespace detail
#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
// handle executors through their executor_traits
template <typename Executor>
HPX_FORCEINLINE
HPX_DEPRECATED(HPX_DEPRECATED_MSG) HPX_FORCEINLINE
typename std::enable_if<
traits::is_executor<Executor>::value
>::type
Expand Down
1 change: 1 addition & 0 deletions hpx/lcos/detail/promise_base.hpp
Expand Up @@ -256,6 +256,7 @@ namespace lcos {
}

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type get_gid(error_code& ec = throws) const
{
return get_id(ec);
Expand Down
2 changes: 2 additions & 0 deletions hpx/lcos/future.hpp
Expand Up @@ -623,6 +623,7 @@ namespace hpx { namespace lcos { namespace detail

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
template <typename Executor, typename F>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::lazy_enable_if<
hpx::traits::is_executor<Executor>::value
, hpx::traits::future_then_result<Derived, F>
Expand Down Expand Up @@ -988,6 +989,7 @@ namespace hpx { namespace lcos

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
template <typename Executor, typename F>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::lazy_enable_if<
hpx::traits::is_executor<Executor>::value
, hpx::traits::future_then_result<future, F>
Expand Down
2 changes: 1 addition & 1 deletion hpx/lcos/local/dataflow.hpp
Expand Up @@ -216,7 +216,7 @@ namespace hpx
namespace lcos { namespace local
{
template <typename F, typename ...Ts>
HPX_FORCEINLINE
HPX_DEPRECATED(HPX_DEPRECATED_MSG) HPX_FORCEINLINE
auto dataflow(F && f, Ts &&... ts)
-> decltype(lcos::detail::dataflow_dispatch<
typename std::decay<F>::type>::call(
Expand Down
4 changes: 4 additions & 0 deletions hpx/lcos/local/packaged_continuation.hpp
Expand Up @@ -359,6 +359,7 @@ namespace hpx { namespace lcos { namespace detail

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
template <typename Executor>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
void async_exec_v1(
typename traits::detail::shared_state_ptr_for<
Future
Expand Down Expand Up @@ -438,6 +439,7 @@ namespace hpx { namespace lcos { namespace detail

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
template <typename Executor>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
void async_exec_v1(
typename traits::detail::shared_state_ptr_for<
Future
Expand Down Expand Up @@ -562,6 +564,7 @@ namespace hpx { namespace lcos { namespace detail

#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
template <typename Executor>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
void attach_exec_v1(Future const& future, Executor& exec)
{
typedef
Expand Down Expand Up @@ -664,6 +667,7 @@ namespace hpx { namespace lcos { namespace detail
#if defined(HPX_HAVE_EXECUTOR_COMPATIBILITY)
template <typename ContResult, typename Future, typename Executor,
typename F>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
inline typename traits::detail::shared_state_ptr<
typename continuation_result<ContResult>::type
>::type
Expand Down
4 changes: 4 additions & 0 deletions hpx/lcos/queue.hpp
Expand Up @@ -111,21 +111,25 @@ namespace hpx { namespace lcos
}

#if defined(HPX_HAVE_ASYNC_FUNCTION_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
ValueType get_value_sync()
{
return get_value(launch::sync);
}

HPX_DEPRECATED(HPX_DEPRECATED_MSG)
void set_value_sync(RemoteType const& val)
{
set_value(launch::sync, val);
}

HPX_DEPRECATED(HPX_DEPRECATED_MSG)
void set_value_sync(RemoteType && val) //-V659
{
set_value(launch::sync, std::move(val));
}

HPX_DEPRECATED(HPX_DEPRECATED_MSG)
void abort_pending_sync()
{
abort_pending(launch::sync);
Expand Down
2 changes: 2 additions & 0 deletions hpx/parallel/algorithms/inclusive_scan.hpp
Expand Up @@ -337,6 +337,7 @@ namespace hpx { namespace parallel { inline namespace v1
typename std::iterator_traits<FwdIter1>::value_type,
typename std::iterator_traits<FwdIter1>::value_type
>::value)>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::detail::algorithm_result<ExPolicy, FwdIter2>::type
inclusive_scan(ExPolicy&& policy, FwdIter1 first, FwdIter1 last, FwdIter2 dest,
T init, Op && op)
Expand Down Expand Up @@ -435,6 +436,7 @@ namespace hpx { namespace parallel { inline namespace v1
typename std::iterator_traits<FwdIter1>::value_type,
typename std::iterator_traits<FwdIter1>::value_type
>::value)>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::detail::algorithm_result<ExPolicy, FwdIter2>::type
inclusive_scan(ExPolicy&& policy, FwdIter1 first, FwdIter1 last, FwdIter2 dest,
T init)
Expand Down
1 change: 1 addition & 0 deletions hpx/parallel/algorithms/transform_exclusive_scan.hpp
Expand Up @@ -360,6 +360,7 @@ namespace hpx { namespace parallel { inline namespace v1
typename std::iterator_traits<FwdIter1>::value_type
>::type
>::value)>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::detail::algorithm_result<ExPolicy, FwdIter2>::type
transform_exclusive_scan(ExPolicy && policy, FwdIter1 first, FwdIter1 last,
FwdIter2 dest, Conv && conv, T init, Op && op)
Expand Down
2 changes: 2 additions & 0 deletions hpx/parallel/algorithms/transform_inclusive_scan.hpp
Expand Up @@ -362,6 +362,7 @@ namespace hpx { namespace parallel { inline namespace v1
typename std::iterator_traits<FwdIter1>::value_type
>::type
>::value)>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::detail::algorithm_result<ExPolicy, FwdIter2>::type
transform_inclusive_scan(ExPolicy && policy, FwdIter1 first, FwdIter1 last,
FwdIter2 dest, T init, Op && op, Conv && conv)
Expand Down Expand Up @@ -548,6 +549,7 @@ namespace hpx { namespace parallel { inline namespace v1
typename std::iterator_traits<FwdIter1>::value_type
>::type
>::value)>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::detail::algorithm_result<ExPolicy, FwdIter2>::type
transform_inclusive_scan(ExPolicy&& policy, FwdIter1 first, FwdIter1 last,
FwdIter2 dest, Conv && conv, Op && op)
Expand Down
1 change: 1 addition & 0 deletions hpx/parallel/algorithms/transform_reduce.hpp
Expand Up @@ -295,6 +295,7 @@ namespace hpx { namespace parallel { inline namespace v1
typename std::iterator_traits<FwdIter>::value_type
>::type
>::value)>
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
typename util::detail::algorithm_result<ExPolicy, T>::type
transform_reduce(ExPolicy && policy, FwdIter first, FwdIter last,
T init, Convert && conv_op, Reduce && red_op)
Expand Down
1 change: 1 addition & 0 deletions hpx/runtime/actions/continuation.hpp
Expand Up @@ -65,6 +65,7 @@ namespace hpx { namespace actions
void serialize(hpx::serialization::output_archive& ar, unsigned);

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type const& get_gid() const
{
return gid_;
Expand Down
1 change: 1 addition & 0 deletions hpx/runtime/components/client_base.hpp
Expand Up @@ -370,6 +370,7 @@ namespace hpx { namespace components

///////////////////////////////////////////////////////////////////////
#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
id_type const& get_gid() const
{
return get_id();
Expand Down
1 change: 1 addition & 0 deletions hpx/runtime/components/runtime_support.hpp
Expand Up @@ -164,6 +164,7 @@ namespace hpx { namespace components

///////////////////////////////////////////////////////////////////////
#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type const& get_gid() const
{
return gid_;
Expand Down
1 change: 1 addition & 0 deletions hpx/runtime/components/server/fixed_component_base.hpp
Expand Up @@ -153,6 +153,7 @@ class fixed_component_base : public traits::detail::fixed_component_tag
}

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type get_gid() const
{
return get_unmanaged_id();
Expand Down
2 changes: 2 additions & 0 deletions hpx/runtime/components/server/managed_component_base.hpp
Expand Up @@ -237,6 +237,7 @@ namespace hpx { namespace components
naming::id_type get_id() const;

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type get_gid() const
{
return get_unmanaged_id();
Expand Down Expand Up @@ -604,6 +605,7 @@ namespace hpx { namespace components
}

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type get_gid() const
{
return get_unmanaged_id();
Expand Down
2 changes: 2 additions & 0 deletions hpx/runtime/components/server/memory_block.hpp
Expand Up @@ -133,6 +133,7 @@ namespace hpx { namespace components { namespace server { namespace detail
naming::id_type get_unmanaged_id() const;

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type get_gid() const //-V659
{
return get_unmanaged_id();
Expand Down Expand Up @@ -662,6 +663,7 @@ namespace hpx { namespace components { namespace server
}

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type get_gid() const
{
return get_checked()->get_gid();
Expand Down
1 change: 1 addition & 0 deletions hpx/runtime/components/server/simple_component_base.hpp
Expand Up @@ -227,6 +227,7 @@ namespace hpx { namespace components
}

#if defined(HPX_HAVE_COMPONENT_GET_GID_COMPATIBILITY)
HPX_DEPRECATED(HPX_DEPRECATED_MSG)
naming::id_type get_gid() const
{
return get_id();
Expand Down

0 comments on commit ad57059

Please sign in to comment.