Skip to content

Commit b58e4f9

Browse files
authored
Marks the next_layer() functions as deprecated (#256)
CI builds now use BOOST_ALLOW_DEPRECATED to prevent warnings
1 parent e8b13bd commit b58e4f9

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

include/boost/redis/connection.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <boost/asio/steady_timer.hpp>
4343
#include <boost/asio/write.hpp>
4444
#include <boost/assert.hpp>
45+
#include <boost/config.hpp>
4546
#include <boost/core/ignore_unused.hpp>
4647

4748
#include <array>
@@ -745,9 +746,15 @@ class basic_connection {
745746
}
746747

747748
/// Returns a reference to the next layer.
749+
BOOST_DEPRECATED(
750+
"Accessing the underlying stream is deprecated and will be removed in the next release. Use "
751+
"the other member functions to interact with the connection.")
748752
auto& next_layer() noexcept { return *stream_; }
749753

750754
/// Returns a const reference to the next layer.
755+
BOOST_DEPRECATED(
756+
"Accessing the underlying stream is deprecated and will be removed in the next release. Use "
757+
"the other member functions to interact with the connection.")
751758
auto const& next_layer() const noexcept { return *stream_; }
752759

753760
/// Sets the response object of `async_receive` operations.
@@ -915,9 +922,15 @@ class connection {
915922
bool will_reconnect() const noexcept { return impl_.will_reconnect(); }
916923

917924
/// Calls `boost::redis::basic_connection::next_layer`.
925+
BOOST_DEPRECATED(
926+
"Accessing the underlying stream is deprecated and will be removed in the next release. Use "
927+
"the other member functions to interact with the connection.")
918928
auto& next_layer() noexcept { return impl_.next_layer(); }
919929

920930
/// Calls `boost::redis::basic_connection::next_layer`.
931+
BOOST_DEPRECATED(
932+
"Accessing the underlying stream is deprecated and will be removed in the next release. Use "
933+
"the other member functions to interact with the connection.")
921934
auto const& next_layer() const noexcept { return impl_.next_layer(); }
922935

923936
/// Calls `boost::redis::basic_connection::reset_stream`.

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ if (MSVC)
99
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
1010
target_compile_options(boost_redis_project_options INTERFACE -Wall -Wextra -Werror)
1111
endif()
12+
target_compile_definitions(boost_redis_project_options INTERFACE BOOST_ALLOW_DEPRECATED=1) # we need to still test deprecated fns
1213

1314
add_library(boost_redis_src STATIC boost_redis.cpp)
1415
target_compile_features(boost_redis_src PRIVATE cxx_std_17)

test/Jamfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ local requirements =
1414
<define>BOOST_ASIO_DISABLE_BOOST_BIND=1
1515
<define>BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1
1616
<define>BOOST_ASIO_DISABLE_BOOST_REGEX=1
17+
<define>BOOST_ALLOW_DEPRECATED=1 # we need to test deprecated fns
1718
<toolset>msvc:<cxxflags>"/bigobj"
1819
<target-os>windows:<define>_WIN32_WINNT=0x0601
1920
[ requires

0 commit comments

Comments
 (0)