From 6df9ef29ff029299d7eb3fd912abcddb80bb7c76 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 21 May 2025 13:04:05 +0200 Subject: [PATCH 1/2] Marks the next_layer() functions as deprecated --- 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 @@ class basic_connection { } /// 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 @@ class connection { 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..0fdc19ec 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -13,6 +13,7 @@ endif() add_library(boost_redis_src STATIC boost_redis.cpp) target_compile_features(boost_redis_src PRIVATE cxx_std_17) target_link_libraries(boost_redis_src PRIVATE boost_redis_project_options) +target_compile_definitions(boost_redis_src PUBLIC BOOST_ALLOW_DEPRECATED) # we need to still test deprecated fns # Test utils add_library(boost_redis_tests_common STATIC common.cpp) 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 From 5075f384c9ef0d5d2d862c4630ebf1da8f7f1bb2 Mon Sep 17 00:00:00 2001 From: Ruben Perez Date: Wed, 21 May 2025 14:24:08 +0200 Subject: [PATCH 2/2] move BOOST_ALLOW_DEPRECATED def in cmake --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0fdc19ec..b6b22b2a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,11 +9,11 @@ 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) target_link_libraries(boost_redis_src PRIVATE boost_redis_project_options) -target_compile_definitions(boost_redis_src PUBLIC BOOST_ALLOW_DEPRECATED) # we need to still test deprecated fns # Test utils add_library(boost_redis_tests_common STATIC common.cpp)