Skip to content

Commit 0ba823e

Browse files
committed
fixed more compiler warnings
1 parent a38953d commit 0ba823e

File tree

12 files changed

+135
-122
lines changed

12 files changed

+135
-122
lines changed

examples/allocator.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace {
1212
template <std::size_t Size>
1313
struct inline_resource : std::pmr::memory_resource {
1414
const char* name;
15-
explicit inline_resource(const char* name) : name(name) {}
15+
explicit inline_resource(const char* n) : name(n) {}
1616
std::byte buffer[Size]{}; // NOLINT(hicpp-avoid-c-arrays)
1717
std::byte* next{+this->buffer}; // NOLINT(hicpp-no-array-decay)
1818

@@ -39,13 +39,13 @@ struct allocator_aware_fun {
3939

4040
template <typename F>
4141
requires std::same_as<std::remove_cvref_t<F>, std::remove_cvref_t<Fun>>
42-
explicit allocator_aware_fun(F&& fun) : fun(std::forward<F>(fun)) {}
43-
allocator_aware_fun(const allocator_aware_fun& other, allocator_type allocator = {})
44-
: fun(other.fun), allocator(allocator) {}
42+
explicit allocator_aware_fun(F&& f) : fun(std::forward<F>(f)) {}
43+
allocator_aware_fun(const allocator_aware_fun& other, allocator_type alloc = {})
44+
: fun(other.fun), allocator(alloc) {}
4545
allocator_aware_fun(allocator_aware_fun&& other) noexcept
4646
: fun(std::move(other.fun)), allocator(other.allocator) {}
47-
allocator_aware_fun(allocator_aware_fun&& other, allocator_type allocator)
48-
: fun(std::move(other.fun)), allocator(allocator) {}
47+
allocator_aware_fun(allocator_aware_fun&& other, allocator_type alloc)
48+
: fun(std::move(other.fun)), allocator(alloc) {}
4949

5050
template <typename... Args>
5151
auto operator()(Args&&... args) noexcept {

examples/doc-just_error.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
#include <cassert>
77
namespace ex = beman::execution26;
88

9+
namespace {
10+
void use(auto&&...) {}
11+
} // namespace
12+
913
int main() {
1014
bool had_error{false};
1115
auto result = ex::sync_wait(ex::just_error(std::error_code(17, std::system_category())) |
1216
ex::upon_error([&](std::error_code ec) {
17+
use(ec);
1318
assert(ec.value() == 17);
1419
had_error = true;
1520
}));
21+
use(result, had_error);
1622
assert(result);
1723
assert(had_error);
1824
}

examples/doc-just_stopped.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
#include <iostream> //-dk:TODO remove
88
namespace ex = beman::execution26;
99

10+
namespace {
11+
void use(auto&&...) {}
12+
} // namespace
13+
1014
int main() {
1115
bool stopped{false};
1216

1317
auto result = ex::sync_wait(ex::just_stopped() | ex::upon_stopped([&] { stopped = true; }));
18+
use(result, stopped);
1419
assert(result);
1520
assert(stopped);
1621
}

examples/sender-demo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ struct just_op_state {
1414
std::pmr::string value;
1515

1616
template <typename R>
17-
just_op_state(R&& r, std::pmr::string&& value)
18-
: rec(std::forward<R>(r)), value(std::move(value), ex::get_allocator(ex::get_env(rec))) {}
17+
just_op_state(R&& r, std::pmr::string&& val)
18+
: rec(std::forward<R>(r)), value(std::move(val), ex::get_allocator(ex::get_env(rec))) {}
1919

2020
void start() & noexcept { ex::set_value(std::move(rec), std::move(value)); }
2121
};

examples/stopping.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace {
2222
struct env {
2323
ex::inplace_stop_token token;
2424

25-
env(ex::inplace_stop_token token) : token(token) {} // NOLINT(hicpp-explicit-conversions)
25+
explicit env(ex::inplace_stop_token t) : token(t) {} // NOLINT(hicpp-explicit-conversions)
2626

2727
auto query(const ex::get_stop_token_t&) const noexcept { return this->token; }
2828
};
@@ -38,7 +38,7 @@ struct inject_cancel_sender {
3838
std::remove_cvref_t<Receiver> inner_receiver;
3939
ex::inplace_stop_token token{};
4040

41-
auto get_env() const noexcept -> env { return {this->token}; }
41+
auto get_env() const noexcept -> env { return env(this->token); }
4242

4343
template <typename... T>
4444
auto set_value(T&&... t) noexcept -> void {

tests/beman/execution26/exec-let.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ namespace ex = test_std;
9191
struct fun {
9292
std::pmr::polymorphic_allocator<> allocator{};
9393
fun() {}
94-
explicit fun(std::pmr::polymorphic_allocator<> allocator) : allocator(allocator) {}
94+
explicit fun(std::pmr::polymorphic_allocator<> alloc) : allocator(alloc) {}
9595
auto operator()(std::span<int> s) noexcept {
9696
return ex::just(std::pmr::vector<int>(s.begin(), s.end(), this->allocator));
9797
}

0 commit comments

Comments
 (0)