From ab3a2049decd0d7e2d1a4df350dc1f57c361d3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 22 Dec 2024 00:45:49 +0100 Subject: [PATCH] fixed a number of gcc warnings (and hopefully an error) --- .../beman/execution26/detail/basic_sender.hpp | 2 +- .../beman/execution26/detail/basic_state.hpp | 4 +-- include/beman/execution26/detail/fwd_env.hpp | 2 +- .../detail/get_completion_signatures.hpp | 9 ++++--- .../detail/inplace_stop_source.hpp | 2 +- include/beman/execution26/detail/join_env.hpp | 2 +- include/beman/execution26/detail/make_env.hpp | 2 +- include/beman/execution26/detail/notify.hpp | 4 +-- .../detail/operation_state_task.hpp | 4 +-- include/beman/execution26/detail/run_loop.hpp | 2 +- .../beman/execution26/detail/sched_attrs.hpp | 2 +- .../detail/simple_counting_scope.hpp | 6 ++--- .../beman/execution26/detail/stop_source.hpp | 4 +-- tests/beman/execution26/exec-connect.test.cpp | 25 +++++++++---------- 14 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/beman/execution26/detail/basic_sender.hpp b/include/beman/execution26/detail/basic_sender.hpp index e6741895..0ec69f6a 100644 --- a/include/beman/execution26/detail/basic_sender.hpp +++ b/include/beman/execution26/detail/basic_sender.hpp @@ -66,7 +66,7 @@ struct basic_sender : ::beman::execution26::detail::product_type Self, ::beman::execution26::receiver Receiver> - auto connect(this Self&& self, Receiver receiver) && noexcept( + auto connect(this Self&& self, Receiver receiver) noexcept( noexcept(::beman::execution26::detail::basic_operation{::std::forward(self), ::std::move(receiver)})) -> ::beman::execution26::detail::basic_operation { diff --git a/include/beman/execution26/detail/basic_state.hpp b/include/beman/execution26/detail/basic_state.hpp index 292f3090..83850a44 100644 --- a/include/beman/execution26/detail/basic_state.hpp +++ b/include/beman/execution26/detail/basic_state.hpp @@ -20,8 +20,8 @@ namespace beman::execution26::detail { */ template struct basic_state { - basic_state(Sender&& sender, Receiver&& receiver) noexcept(true) - : receiver(::std::move(receiver)), + basic_state(Sender&& sender, Receiver&& rcvr) noexcept(true) + : receiver(::std::move(rcvr)), state(::beman::execution26::detail::impls_for< ::beman::execution26::tag_of_t >::get_state( ::std::forward(sender), this->receiver)) {} diff --git a/include/beman/execution26/detail/fwd_env.hpp b/include/beman/execution26/detail/fwd_env.hpp index 0cf15759..b3288deb 100644 --- a/include/beman/execution26/detail/fwd_env.hpp +++ b/include/beman/execution26/detail/fwd_env.hpp @@ -25,7 +25,7 @@ class fwd_env { Env env; public: - explicit fwd_env(Env&& env) : env(::std::forward(env)) {} + explicit fwd_env(Env&& e) : env(::std::forward(e)) {} template requires(not::beman::execution26::forwarding_query(::std::remove_cvref_t())) diff --git a/include/beman/execution26/detail/get_completion_signatures.hpp b/include/beman/execution26/detail/get_completion_signatures.hpp index 8cf764fe..06236557 100644 --- a/include/beman/execution26/detail/get_completion_signatures.hpp +++ b/include/beman/execution26/detail/get_completion_signatures.hpp @@ -23,10 +23,11 @@ struct get_completion_signatures_t { private: template static auto get(Sender&& sender, Env&& env) noexcept { - auto new_sender{[](auto&& sender, auto&& env) -> decltype(auto) { - return ::beman::execution26::transform_sender(::beman::execution26::detail::get_domain_late(sender, env), - ::std::forward(sender), - ::std::forward(env)); + auto new_sender{[](auto&& sndr, auto&& e) -> decltype(auto) { + auto domain{::beman::execution26::detail::get_domain_late(sndr, e)}; + return ::beman::execution26::transform_sender(domain, + ::std::forward(sndr), + ::std::forward(e)); }}; using sender_type = ::std::remove_cvref_t; diff --git a/include/beman/execution26/detail/inplace_stop_source.hpp b/include/beman/execution26/detail/inplace_stop_source.hpp index dfca933f..615cf155 100644 --- a/include/beman/execution26/detail/inplace_stop_source.hpp +++ b/include/beman/execution26/detail/inplace_stop_source.hpp @@ -41,7 +41,7 @@ class beman::execution26::inplace_stop_token { friend class ::beman::execution26::inplace_stop_source; template friend class ::beman::execution26::inplace_stop_callback; - explicit inplace_stop_token(::beman::execution26::inplace_stop_source* source) : source(source) {} + explicit inplace_stop_token(::beman::execution26::inplace_stop_source* src) : source(src) {} ::beman::execution26::inplace_stop_source* source{}; }; diff --git a/include/beman/execution26/detail/join_env.hpp b/include/beman/execution26/detail/join_env.hpp index 6bd6a0de..1cc32dcc 100644 --- a/include/beman/execution26/detail/join_env.hpp +++ b/include/beman/execution26/detail/join_env.hpp @@ -18,7 +18,7 @@ class join_env { public: template - join_env(E1&& env1, E2&& env2) : env1(::std::forward(env1)), env2(::std::forward(env2)) {} + join_env(E1&& e1, E2&& e2) : env1(::std::forward(e1)), env2(::std::forward(e2)) {} template requires( diff --git a/include/beman/execution26/detail/make_env.hpp b/include/beman/execution26/detail/make_env.hpp index 5b7c9860..1b8cb020 100644 --- a/include/beman/execution26/detail/make_env.hpp +++ b/include/beman/execution26/detail/make_env.hpp @@ -17,7 +17,7 @@ class make_env { public: template - make_env(const Query&, V&& value) : value(::std::forward(value)) {} + make_env(const Query&, V&& v) : value(::std::forward(v)) {} constexpr auto query(const Query&) const noexcept -> const Value& { return this->value; } constexpr auto query(const Query&) noexcept -> Value& { return this->value; } }; diff --git a/include/beman/execution26/detail/notify.hpp b/include/beman/execution26/detail/notify.hpp index afa4ecda..1a09c6a9 100644 --- a/include/beman/execution26/detail/notify.hpp +++ b/include/beman/execution26/detail/notify.hpp @@ -58,8 +58,8 @@ struct impls_for<::beman::execution26::detail::notify_t> : ::beman::execution26: struct state : ::beman::execution26::detail::notifier::base { ::beman::execution26::detail::notifier* n; ::std::remove_cvref_t& receiver{}; - state(::beman::execution26::detail::notifier* n, ::std::remove_cvref_t& receiver) - : n(n), receiver(receiver) {} + state(::beman::execution26::detail::notifier* nn, ::std::remove_cvref_t& rcvr) + : n(nn), receiver(rcvr) {} auto complete() -> void override { ::beman::execution26::set_value(::std::move(this->receiver)); } }; static constexpr auto get_state{[](Sender&& sender, Receiver&& receiver) { diff --git a/include/beman/execution26/detail/operation_state_task.hpp b/include/beman/execution26/detail/operation_state_task.hpp index 85e115e1..6818d178 100644 --- a/include/beman/execution26/detail/operation_state_task.hpp +++ b/include/beman/execution26/detail/operation_state_task.hpp @@ -28,7 +28,7 @@ struct connect_awaitable_promise; template struct beman::execution26::detail::connect_awaitable_promise : ::beman::execution26::detail::with_await_transform> { - connect_awaitable_promise(auto&&, Receiver& receiver) noexcept : receiver(receiver) {} + connect_awaitable_promise(auto&&, Receiver& rcvr) noexcept : receiver(rcvr) {} auto initial_suspend() noexcept -> ::std::suspend_always { return {}; } [[noreturn]] auto final_suspend() noexcept -> ::std::suspend_always { ::std::terminate(); } [[noreturn]] auto unhandled_exception() noexcept -> void { ::std::terminate(); } @@ -56,7 +56,7 @@ struct beman::execution26::detail::operation_state_task { using operation_state_concept = ::beman::execution26::operation_state_t; using promise_type = ::beman::execution26::detail::connect_awaitable_promise; - explicit operation_state_task(::std::coroutine_handle<> handle) noexcept : handle(handle) {} + explicit operation_state_task(::std::coroutine_handle<> hndl) noexcept : handle(hndl) {} operation_state_task(const operation_state_task&) = delete; operation_state_task(operation_state_task&& other) noexcept : handle(::std::exchange(other.handle, {})) {} ~operation_state_task() { diff --git a/include/beman/execution26/detail/run_loop.hpp b/include/beman/execution26/detail/run_loop.hpp index c5b49d30..b7913f2e 100644 --- a/include/beman/execution26/detail/run_loop.hpp +++ b/include/beman/execution26/detail/run_loop.hpp @@ -51,7 +51,7 @@ class run_loop { Receiver receiver; template - opstate(run_loop* loop, R&& receiver) : loop(loop), receiver(::std::forward(receiver)) {} + opstate(run_loop* l, R&& rcvr) : loop(l), receiver(::std::forward(rcvr)) {} auto start() & noexcept -> void { try { this->loop->push_back(this); diff --git a/include/beman/execution26/detail/sched_attrs.hpp b/include/beman/execution26/detail/sched_attrs.hpp index ef650152..55f7a709 100644 --- a/include/beman/execution26/detail/sched_attrs.hpp +++ b/include/beman/execution26/detail/sched_attrs.hpp @@ -24,7 +24,7 @@ class sched_attrs { public: template - explicit sched_attrs(S sched) : sched(::std::move(sched)) {} + explicit sched_attrs(S s) : sched(::std::move(s)) {} template auto query(const ::beman::execution26::get_completion_scheduler_t&) const noexcept { diff --git a/include/beman/execution26/detail/simple_counting_scope.hpp b/include/beman/execution26/detail/simple_counting_scope.hpp index 09206613..d3b37d9d 100644 --- a/include/beman/execution26/detail/simple_counting_scope.hpp +++ b/include/beman/execution26/detail/simple_counting_scope.hpp @@ -118,8 +118,8 @@ class beman::execution26::simple_counting_scope::assoc { private: friend class beman::execution26::simple_counting_scope::token; - explicit assoc(beman::execution26::simple_counting_scope* scope) - : scope(scope ? scope->try_associate() : nullptr) {} + explicit assoc(beman::execution26::simple_counting_scope* scp) + : scope(scp ? scp->try_associate() : nullptr) {} beman::execution26::simple_counting_scope* scope{}; }; // NOLINTEND(misc-unconventional-assign-operator,hicpp-special-member-functions) @@ -139,7 +139,7 @@ class beman::execution26::simple_counting_scope::token { private: friend class beman::execution26::simple_counting_scope; - explicit token(beman::execution26::simple_counting_scope* scope) noexcept : scope(scope) {} + explicit token(beman::execution26::simple_counting_scope* scp) noexcept : scope(scp) {} beman::execution26::simple_counting_scope* scope; }; diff --git a/include/beman/execution26/detail/stop_source.hpp b/include/beman/execution26/detail/stop_source.hpp index acaa579c..2ef2c52c 100644 --- a/include/beman/execution26/detail/stop_source.hpp +++ b/include/beman/execution26/detail/stop_source.hpp @@ -192,8 +192,8 @@ inline auto beman::execution26::detail::stop_callback_base::deregister() -> void inline auto beman::execution26::detail::stop_callback_base::call() -> void { this->do_call(); } -inline beman::execution26::stop_token::stop_token(::std::shared_ptr<::beman::execution26::detail::stop_state> state) - : state(::std::move(state)) {} +inline beman::execution26::stop_token::stop_token(::std::shared_ptr<::beman::execution26::detail::stop_state> st) + : state(::std::move(st)) {} inline auto beman::execution26::stop_token::swap(stop_token& other) noexcept -> void { this->state.swap(other.state); } diff --git a/tests/beman/execution26/exec-connect.test.cpp b/tests/beman/execution26/exec-connect.test.cpp index 5c5ef2e6..e747152c 100644 --- a/tests/beman/execution26/exec-connect.test.cpp +++ b/tests/beman/execution26/exec-connect.test.cpp @@ -22,7 +22,7 @@ struct state { std::remove_cvref_t receiver; template - state(int value, R&& r) : value(value), receiver(std::forward(r)) {} + state(int val, R&& r) : value(val), receiver(std::forward(r)) {} state(const state&) = delete; state(state&&) = delete; ~state() = default; @@ -45,7 +45,7 @@ struct rvalue_sender { using sender_concept = test_std::sender_t; int value{}; - explicit rvalue_sender(int value) : value(value) {} + explicit rvalue_sender(int val) : value(val) {} rvalue_sender(const rvalue_sender&) = delete; rvalue_sender(rvalue_sender&&) = default; auto operator=(const rvalue_sender&) -> rvalue_sender& = delete; @@ -67,8 +67,8 @@ struct receiver { int value{}; bool* set_stopped_called{}; - explicit receiver(int value, bool* set_stopped_called = {}) - : value(value), set_stopped_called(set_stopped_called) {} + explicit receiver(int val, bool* called = {}) + : value(val), set_stopped_called(called) {} receiver(receiver&&) = default; receiver(const receiver&) = delete; ~receiver() = default; @@ -104,7 +104,7 @@ struct domain_receiver { using receiver_concept = test_std::receiver_t; int value{}; - explicit domain_receiver(int value) : value(value) {} + explicit domain_receiver(int val) : value(val) {} domain_receiver(domain_receiver&&) = default; domain_receiver(const domain_receiver&) = delete; ~domain_receiver() = default; @@ -167,7 +167,6 @@ auto test_operation_state_task() -> void { static_assert( std::same_as<::beman::execution26::detail::connect_awaitable_promise, state_t::promise_type>); static_assert(noexcept(state_t(std::coroutine_handle<>{}))); - static_assert(noexcept(state_t(state_t(std::coroutine_handle<>{})))); state_t state(::std::coroutine_handle<>{}); static_assert(noexcept(state.start())); } @@ -201,7 +200,7 @@ auto test_suspend_complete() -> void { } auto test_connect_awaitable() -> void { - struct awaiter { + struct local_awaiter { ::std::coroutine_handle<>& handle; int& result; @@ -225,7 +224,7 @@ auto test_connect_awaitable() -> void { auto await_resume() -> void {} }; - struct receiver { + struct local_receiver { using receiver_concept = test_std::receiver_t; int& iv; @@ -253,7 +252,7 @@ auto test_connect_awaitable() -> void { int iv{}; bool bv{}; - auto op1{test_detail::connect_awaitable(awaiter{handle, result}, receiver{iv, bv})}; + auto op1{test_detail::connect_awaitable(local_awaiter{handle, result}, local_receiver{iv, bv})}; ASSERT(handle == std::coroutine_handle<>()); op1.start(); ASSERT(handle != std::coroutine_handle<>()); @@ -269,7 +268,7 @@ auto test_connect_awaitable() -> void { int iv{}; bool bv{}; - auto op1{test_detail::connect_awaitable(awaiter{handle, result}, receiver{iv, bv})}; + auto op1{test_detail::connect_awaitable(local_awaiter{handle, result}, local_receiver{iv, bv})}; ASSERT(handle == std::coroutine_handle<>()); op1.start(); ASSERT(handle != std::coroutine_handle<>()); @@ -285,7 +284,7 @@ auto test_connect_awaitable() -> void { int iv{}; bool bv{}; - auto op1{test_detail::connect_awaitable(void_awaiter{handle}, receiver{iv, bv})}; + auto op1{test_detail::connect_awaitable(void_awaiter{handle}, local_receiver{iv, bv})}; ASSERT(handle == std::coroutine_handle<>()); op1.start(); ASSERT(handle != std::coroutine_handle<>()); @@ -302,7 +301,7 @@ auto test_connect_with_awaiter() -> void { auto await_suspend(std::coroutine_handle<> h) -> void { this->handle = h; } auto await_resume() -> int { return 17; } }; - struct receiver { + struct local_receiver { using receiver_concept = test_std::receiver_t; bool& result; auto set_value(int i) && noexcept -> void { this->result = i == 17; } @@ -312,7 +311,7 @@ auto test_connect_with_awaiter() -> void { std::coroutine_handle<> handle{}; bool result{}; - auto op{test_std::connect(awaiter{handle}, receiver{result})}; + auto op{test_std::connect(awaiter{handle}, local_receiver{result})}; ASSERT(handle == std::coroutine_handle{}); test_std::start(op); ASSERT(handle != std::coroutine_handle{});