From b58e4f94de7e495a3195ff8a986e790f42060448 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anarthal=20=28Rub=C3=A9n=20P=C3=A9rez=29?= <34971811+anarthal@users.noreply.github.com> Date: Sun, 25 May 2025 11:05:07 +0200 Subject: [PATCH] Marks the next_layer() functions as deprecated (#256) CI builds now use BOOST_ALLOW_DEPRECATED to prevent warnings --- include/boost/redis/connection.hpp | 13 +++++++++++++ test/CMakeLists.txt | 1 + test/Jamfile | 1 + 3 files changed, 15 insertions(+) diff --git a/include/boost/redis/connection.hpp b/include/boost/redis/connection.hpp index e366ff5a..c7e5ecca 100644 --- a/include/boost/redis/connection.hpp +++ b/include/boost/redis/connection.hpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -745,9 +746,15 @@ public: } /// Returns a reference to the next layer. + BOOST_DEPRECATED( + "Accessing the underlying stream is deprecated and will be removed in the next release. Use " + "the other member functions to interact with the connection.") auto& next_layer() noexcept { return *stream_; } /// Returns a const reference to the next layer. + BOOST_DEPRECATED( + "Accessing the underlying stream is deprecated and will be removed in the next release. Use " + "the other member functions to interact with the connection.") auto const& next_layer() const noexcept { return *stream_; } /// Sets the response object of `async_receive` operations. @@ -915,9 +922,15 @@ public: bool will_reconnect() const noexcept { return impl_.will_reconnect(); } /// Calls `boost::redis::basic_connection::next_layer`. + BOOST_DEPRECATED( + "Accessing the underlying stream is deprecated and will be removed in the next release. Use " + "the other member functions to interact with the connection.") auto& next_layer() noexcept { return impl_.next_layer(); } /// Calls `boost::redis::basic_connection::next_layer`. + BOOST_DEPRECATED( + "Accessing the underlying stream is deprecated and will be removed in the next release. Use " + "the other member functions to interact with the connection.") auto const& next_layer() const noexcept { return impl_.next_layer(); } /// Calls `boost::redis::basic_connection::reset_stream`. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3cc38128..b6b22b2a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,6 +9,7 @@ if (MSVC) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(boost_redis_project_options INTERFACE -Wall -Wextra -Werror) endif() +target_compile_definitions(boost_redis_project_options INTERFACE BOOST_ALLOW_DEPRECATED=1) # we need to still test deprecated fns add_library(boost_redis_src STATIC boost_redis.cpp) target_compile_features(boost_redis_src PRIVATE cxx_std_17) diff --git a/test/Jamfile b/test/Jamfile index 9f526133..c0435408 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -14,6 +14,7 @@ local requirements = BOOST_ASIO_DISABLE_BOOST_BIND=1 BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1 BOOST_ASIO_DISABLE_BOOST_REGEX=1 + BOOST_ALLOW_DEPRECATED=1 # we need to test deprecated fns msvc:"/bigobj" windows:_WIN32_WINNT=0x0601 [ requires