Skip to content

Commit 8006ffb

Browse files
committed
Merge branch 'develop' into feature/sansio-exec
2 parents 98c2450 + e8b13bd commit 8006ffb

File tree

8 files changed

+49
-40
lines changed

8 files changed

+49
-40
lines changed

benchmarks/cpp/asio/echo_server_client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ auto example(boost::asio::ip::tcp::endpoint ep, std::string msg, int n) -> net::
2727
auto dbuffer = net::dynamic_buffer(buffer);
2828
for (int i = 0; i < n; ++i) {
2929
co_await net::async_write(socket, net::buffer(msg));
30-
auto n = co_await net::async_read_until(socket, dbuffer, "\n");
30+
auto bytes_read = co_await net::async_read_until(socket, dbuffer, "\n");
3131
//std::printf("> %s", buffer.data());
32-
dbuffer.consume(n);
32+
dbuffer.consume(bytes_read);
3333
}
3434

3535
//std::printf("Ok: %s", msg.data());

include/boost/redis/adapter/detail/adapters.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct converter<T, true> {
6666
template <>
6767
struct converter<bool, false> {
6868
template <class String>
69-
static void apply(bool& t, resp3::basic_node<String> const& node, system::error_code& ec)
69+
static void apply(bool& t, resp3::basic_node<String> const& node, system::error_code&)
7070
{
7171
t = *node.value.data() == 't';
7272
}

include/boost/redis/connection.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class run_op {
326326
system::error_code ec1 = {},
327327
system::error_code ec2 = {},
328328
system::error_code ec3 = {},
329-
system::error_code ec4 = {})
329+
system::error_code = {})
330330
{
331331
BOOST_ASIO_CORO_REENTER(coro_) for (;;)
332332
{

include/boost/redis/resp3/impl/parser.ipp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <boost/assert.hpp>
1111

1212
#include <charconv>
13+
#include <cstddef>
1314
#include <limits>
1415

1516
namespace boost::redis::resp3 {
@@ -177,7 +178,7 @@ auto parser::consume_impl(type t, std::string_view elem, system::error_code& ec)
177178
case type::attribute:
178179
case type::map:
179180
{
180-
std::size_t l = -1;
181+
std::size_t l = static_cast<std::size_t>(-1);
181182
to_int(l, elem, ec);
182183
if (ec)
183184
return {};

test/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
add_library(boost_redis_project_options INTERFACE)
44
target_link_libraries(boost_redis_project_options INTERFACE boost_redis)
55
if (MSVC)
6-
target_compile_options(boost_redis_project_options INTERFACE /bigobj)
6+
# C4459: name hides outer scope variable is issued by Asio
7+
target_compile_options(boost_redis_project_options INTERFACE /bigobj /W4 /WX /wd4459)
78
target_compile_definitions(boost_redis_project_options INTERFACE _WIN32_WINNT=0x0601)
89
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
910
target_compile_options(boost_redis_project_options INTERFACE -Wall -Wextra -Werror)

test/Jamfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ local requirements =
3131
]
3232
[ ac.check-library /openssl//ssl : <library>/openssl//ssl/<link>shared : <build>no ]
3333
[ ac.check-library /openssl//crypto : <library>/openssl//crypto/<link>shared : <build>no ]
34-
<library>/boost/test//boost_unit_test_framework
34+
<library>/boost/test//boost_unit_test_framework/<warnings-as-errors>off
3535
;
3636

3737

test/test_low_level.cpp

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,24 @@
44
* accompanying file LICENSE.txt)
55
*/
66

7-
#include <boost/redis/request.hpp>
8-
#include <boost/redis/response.hpp>
97
#include <boost/redis/adapter/adapt.hpp>
8+
#include <boost/redis/request.hpp>
109
#include <boost/redis/resp3/parser.hpp>
10+
#include <boost/redis/response.hpp>
1111

12-
#define BOOST_TEST_MODULE low level
12+
#define BOOST_TEST_MODULE low_level
1313
#include <boost/test/included/unit_test.hpp>
1414

1515
#include <map>
16-
#include <iostream>
1716
#include <optional>
1817
#include <sstream>
1918

2019
// TODO: Test with empty strings.
2120

22-
namespace std
23-
{
24-
auto operator==(boost::redis::ignore_t, boost::redis::ignore_t) noexcept {return true;}
25-
auto operator!=(boost::redis::ignore_t, boost::redis::ignore_t) noexcept {return false;}
26-
}
21+
namespace std {
22+
auto operator==(boost::redis::ignore_t, boost::redis::ignore_t) noexcept { return true; }
23+
auto operator!=(boost::redis::ignore_t, boost::redis::ignore_t) noexcept { return false; }
24+
} // namespace std
2725

2826
namespace redis = boost::redis;
2927
namespace resp3 = boost::redis::resp3;
@@ -56,12 +54,20 @@ using array_type = result<std::array<int, 3>>;
5654
using array_type2 = result<std::array<int, 1>>;
5755

5856
// Map
59-
using map_type = result<std::map<std::string, std::string>>;
60-
using mmap_type = result<std::multimap<std::string, std::string>>;
61-
using umap_type = result<std::unordered_map<std::string, std::string>>;
62-
using mumap_type = result<std::unordered_multimap<std::string, std::string>>;
57+
using map_type = result<std::map<std::string, std::string>>;
58+
using mmap_type = result<std::multimap<std::string, std::string>>;
59+
using umap_type = result<std::unordered_map<std::string, std::string>>;
60+
using mumap_type = result<std::unordered_multimap<std::string, std::string>>;
6361
using op_map_type = result<std::optional<std::map<std::string, std::string>>>;
64-
using tuple8_type = result<response<std::string, std::string, std::string, std::string, std::string, std::string, std::string, std::string>>;
62+
using tuple8_type = result<response<
63+
std::string,
64+
std::string,
65+
std::string,
66+
std::string,
67+
std::string,
68+
std::string,
69+
std::string,
70+
std::string>>;
6571

6672
// Null
6773
using op_type_01 = result<std::optional<bool>>;
@@ -85,7 +91,11 @@ struct expect {
8591
};
8692

8793
template <class Result>
88-
auto make_expected(std::string in, Result expected, error_code ec = {}, resp3::type error_type = resp3::type::invalid)
94+
auto make_expected(
95+
std::string in,
96+
Result expected,
97+
error_code ec = {},
98+
resp3::type error_type = resp3::type::invalid)
8999
{
90100
return expect<Result>{in, expected, ec, error_type};
91101
}
@@ -99,7 +109,7 @@ void test_sync(expect<Result> e)
99109
error_code ec;
100110
auto const res = parse(p, e.in, adapter, ec);
101111

102-
BOOST_TEST(res); // None of these tests need more data.
112+
BOOST_TEST(res); // None of these tests need more data.
103113

104114
if (ec) {
105115
BOOST_CHECK_EQUAL(ec, e.ec);
@@ -123,7 +133,7 @@ void test_sync2(expect<Result> e)
123133
error_code ec;
124134
auto const res = parse(p, e.in, adapter, ec);
125135

126-
BOOST_TEST(res); // None of these tests need more data.
136+
BOOST_TEST(res); // None of these tests need more data.
127137
BOOST_CHECK_EQUAL(ec, e.ec);
128138
}
129139

@@ -133,8 +143,6 @@ auto make_blob()
133143
str[1000] = '\r';
134144
str[1001] = '\n';
135145
return str;
136-
137-
return str;
138146
}
139147

140148
auto const blob = make_blob();
@@ -154,6 +162,8 @@ auto make_blob_string(std::string const& b)
154162
result<std::optional<int>> op_int_ok = 11;
155163
result<std::optional<bool>> op_bool_ok = true;
156164

165+
// clang-format off
166+
157167
// TODO: Test a streamed string that is not finished with a string of
158168
// size 0 but other command comes in.
159169
generic_response streamed_string_e1
@@ -461,12 +471,11 @@ generic_response const attr_e1b
461471
test(make_expected(S10b, node_type{{resp3::type::simple_error, 1UL, 0UL, {""}}}, {}, resp3::type::simple_error)); \
462472
test(make_expected(S12a, node_type{{resp3::type::blob_error, 1UL, 0UL, {"SYNTAX invalid syntax"}}}, {}, resp3::type::blob_error));\
463473
test(make_expected(S12b, node_type{{resp3::type::blob_error, 1UL, 0UL, {}}}, {}, resp3::type::blob_error));\
464-
test(make_expected(S12c, result<ignore_t>{}, boost::redis::error::resp3_blob_error));\
474+
test(make_expected(S12c, result<ignore_t>{}, boost::redis::error::resp3_blob_error));
465475

466-
BOOST_AUTO_TEST_CASE(sansio)
467-
{
468-
NUMBER_TEST_CONDITIONS(test_sync)
469-
}
476+
// clang-format on
477+
478+
BOOST_AUTO_TEST_CASE(sansio){NUMBER_TEST_CONDITIONS(test_sync)}
470479

471480
BOOST_AUTO_TEST_CASE(ignore_adapter_simple_error)
472481
{
@@ -478,10 +487,7 @@ BOOST_AUTO_TEST_CASE(ignore_adapter_blob_error)
478487
test_sync2(make_expected(S12a, ignore, boost::redis::error::resp3_blob_error));
479488
}
480489

481-
BOOST_AUTO_TEST_CASE(ignore_adapter_no_error)
482-
{
483-
test_sync2(make_expected(S05b, ignore));
484-
}
490+
BOOST_AUTO_TEST_CASE(ignore_adapter_no_error) { test_sync2(make_expected(S05b, ignore)); }
485491

486492
//-----------------------------------------------------------------------------------
487493
void check_error(char const* name, boost::redis::error ev)
@@ -492,10 +498,9 @@ void check_error(char const* name, boost::redis::error ev)
492498
BOOST_TEST(!ec.message().empty());
493499
BOOST_TEST(cat.equivalent(
494500
static_cast<std::underlying_type<boost::redis::error>::type>(ev),
495-
ec.category().default_error_condition(
496-
static_cast<std::underlying_type<boost::redis::error>::type>(ev))));
497-
BOOST_TEST(cat.equivalent(ec,
498-
static_cast<std::underlying_type<boost::redis::error>::type>(ev)));
501+
ec.category().default_error_condition(
502+
static_cast<std::underlying_type<boost::redis::error>::type>(ev))));
503+
BOOST_TEST(cat.equivalent(ec, static_cast<std::underlying_type<boost::redis::error>::type>(ev)));
499504
}
500505

501506
BOOST_AUTO_TEST_CASE(cover_error)
@@ -606,7 +611,7 @@ BOOST_AUTO_TEST_CASE(adapter_as)
606611
result<std::set<std::string>> set;
607612
auto adapter = adapt2(set);
608613

609-
for (auto const& e: set_expected1a.value()) {
614+
for (auto const& e : set_expected1a.value()) {
610615
error_code ec;
611616
adapter(e, ec);
612617
}

tools/ci.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ def _run_b2_tests(
295295
'toolset={}'.format(toolset),
296296
'cxxstd={}'.format(cxxstd),
297297
'variant={}'.format(variant),
298+
'warnings=extra',
299+
'warnings-as-errors=on',
298300
'-j4',
299301
'libs/redis/test'
300302
])

0 commit comments

Comments
 (0)