diff options
Diffstat (limited to '3rdparty/asio/include/asio/detail/handler_invoke_helpers.hpp')
-rw-r--r-- | 3rdparty/asio/include/asio/detail/handler_invoke_helpers.hpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/3rdparty/asio/include/asio/detail/handler_invoke_helpers.hpp b/3rdparty/asio/include/asio/detail/handler_invoke_helpers.hpp index 91325ee9e98..86b8bf2b4b3 100644 --- a/3rdparty/asio/include/asio/detail/handler_invoke_helpers.hpp +++ b/3rdparty/asio/include/asio/detail/handler_invoke_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_invoke_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) @@ -26,12 +26,29 @@ // namespace is defined here for that purpose. namespace asio_handler_invoke_helpers { +#if defined(ASIO_NO_DEPRECATED) +template <typename Function, typename Context> +inline void error_if_hook_is_defined(Function& function, Context& context) +{ + using asio::asio_handler_invoke; + // If you get an error here it is because some of your handlers still + // overload asio_handler_invoke, but this hook is no longer used. + (void)static_cast<asio::asio_handler_invoke_is_no_longer_used>( + asio_handler_invoke(function, asio::detail::addressof(context))); +} +#endif // defined(ASIO_NO_DEPRECATED) + template <typename Function, typename Context> inline void invoke(Function& function, Context& context) { #if !defined(ASIO_HAS_HANDLER_HOOKS) Function tmp(function); tmp(); +#elif defined(ASIO_NO_DEPRECATED) + // The asio_handler_invoke hook is no longer used to invoke the function. + (void)&error_if_hook_is_defined<Function, Context>; + (void)context; + function(); #else using asio::asio_handler_invoke; asio_handler_invoke(function, asio::detail::addressof(context)); @@ -44,6 +61,12 @@ inline void invoke(const Function& function, Context& context) #if !defined(ASIO_HAS_HANDLER_HOOKS) Function tmp(function); tmp(); +#elif defined(ASIO_NO_DEPRECATED) + // The asio_handler_invoke hook is no longer used to invoke the function. + (void)&error_if_hook_is_defined<const Function, Context>; + (void)context; + Function tmp(function); + tmp(); #else using asio::asio_handler_invoke; asio_handler_invoke(function, asio::detail::addressof(context)); |