Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .nojekyll
Empty file.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ clang-tidy: build/$(SANITIZER)/compile_commands.json
codespell:
codespell -L statics,snd,copyable,cancelled

format:
format: cmake-format clang-format

cmake-format:
cmake-format -i `git diff --name-only main | egrep '(CMakeLists.txt|\.cmake)'`

clang-format:
git clang-format main

todo:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ template <typename T, typename Context>
* \headerfile beman/execution26/execution.hpp <beman/execution26/execution.hpp>
* \internal
*/
auto allocator_aware_move(T&& obj, Context&& context) -> decltype(auto) {
auto allocator_aware_move(T&& obj, Context&& context) noexcept -> decltype(auto) {
if constexpr (requires { ::beman::execution26::get_allocator(::beman::execution26::get_env(context)); }) {
if constexpr (decltype(::beman::execution26::detail::is_product_type(obj))()) {
return obj.make_from(::beman::execution26::get_allocator(::beman::execution26::get_env(context)),
Expand Down
3 changes: 3 additions & 0 deletions include/beman/execution26/detail/basic_operation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ template <typename Sender, typename Receiver>
basic_operation(Sender&& sender, Receiver&& receiver) noexcept(true /*-dk:TODO*/)
: ::beman::execution26::detail::basic_state<Sender, Receiver>(::std::forward<Sender>(sender),
::std::move(receiver)),
// NOLINTBEGIN(bugprone-use-after-move,hicpp-invalid-access-moved)
//-dk:TODO deal with moving the sender twice
inner_ops(::beman::execution26::detail::connect_all(
this, ::std::forward<Sender>(sender), ::beman::execution26::detail::indices_for<Sender>())) {}
// NOLINTEND(bugprone-use-after-move,hicpp-invalid-access-moved)

private:
auto start() & noexcept -> void {
Expand Down
7 changes: 6 additions & 1 deletion include/beman/execution26/detail/basic_sender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <beman/execution26/detail/get_completion_signatures.hpp>
#include <utility>

#include <beman/execution26/detail/suppress_push.hpp>

// ----------------------------------------------------------------------------

namespace beman::execution26::detail {
Expand All @@ -37,10 +39,11 @@ struct basic_sender : ::beman::execution26::detail::product_type<Tag, Data, Chil
data.children);
}

private:
template <typename Receiver>
requires(not::beman::execution26::receiver<Receiver>)
auto connect(Receiver receiver) = BEMAN_EXECUTION26_DELETE("the passed receiver doesn't model receiver");

private:
#if __cpp_explicit_this_parameter < 202110L
template <::beman::execution26::receiver Receiver>
auto connect(Receiver receiver) & noexcept(true /*-dk:TODO*/)
Expand Down Expand Up @@ -97,4 +100,6 @@ struct basic_sender : ::beman::execution26::detail::product_type<Tag, Data, Chil

// ----------------------------------------------------------------------------

#include <beman/execution26/detail/suppress_pop.hpp>

#endif
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/emplace_from.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct emplace_from {
using type = ::beman::execution26::detail::call_result_t<Fun>;
Fun fun;

constexpr operator type() && noexcept(::beman::execution26::detail::nothrow_callable<Fun>) {
explicit constexpr operator type() && noexcept(::beman::execution26::detail::nothrow_callable<Fun>) {
return ::std::move(fun)();
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/beman/execution26/detail/forward_like.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ template <typename T>
struct forward_like_helper {
template <typename U>
static auto forward(U&& u) -> ::std::remove_reference_t<U>&& {
return ::std::move(u);
return ::std::move(u); // NOLINT(bugprone-move-forwarding-reference)
}
};
template <typename T>
struct forward_like_helper<T&&> {
template <typename U>
static auto forward(U&& u) -> ::std::remove_cvref_t<U>&& {
return ::std::move(u);
return ::std::move(u); // NOLINT(bugprone-move-forwarding-reference)
}
};
template <typename T>
Expand All @@ -40,7 +40,7 @@ template <typename T>
struct forward_like_helper<const T&&> {
template <typename U>
static auto forward(U&& u) -> const ::std::remove_cvref_t<U>&& {
return ::std::move(u);
return ::std::move(u); // NOLINT(bugprone-move-forwarding-reference)
}
};
template <typename T>
Expand Down
6 changes: 5 additions & 1 deletion include/beman/execution26/detail/fwd_env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <type_traits>
#include <utility>

#include <beman/execution26/detail/suppress_push.hpp>

// ----------------------------------------------------------------------------

namespace beman::execution26::detail {
Expand All @@ -18,7 +20,7 @@ class fwd_env {
Env env;

public:
fwd_env(Env&& env) : env(::std::forward<Env>(env)) {}
explicit fwd_env(Env&& env) : env(::std::forward<Env>(env)) {}

template <typename Query, typename... Args>
requires(not::beman::execution26::forwarding_query(::std::remove_cvref_t<Query>()))
Expand All @@ -39,4 +41,6 @@ fwd_env(Env&&) -> fwd_env<Env>;

// ----------------------------------------------------------------------------

#include <beman/execution26/detail/suppress_pop.hpp>

#endif
4 changes: 4 additions & 0 deletions include/beman/execution26/detail/get_allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <concepts>
#include <utility>

#include <beman/execution26/detail/suppress_push.hpp>

// ----------------------------------------------------------------------------

namespace beman::execution26 {
Expand Down Expand Up @@ -54,4 +56,6 @@ inline constexpr get_allocator_t get_allocator{};

// ----------------------------------------------------------------------------

#include <beman/execution26/detail/suppress_pop.hpp>

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <type_traits>
#include <utility>

#include <beman/execution26/detail/suppress_push.hpp>

// ----------------------------------------------------------------------------

namespace beman::execution26 {
Expand Down Expand Up @@ -82,4 +84,6 @@ inline constexpr get_completion_scheduler_t<Tag> get_completion_scheduler{};

// ----------------------------------------------------------------------------

#include <beman/execution26/detail/suppress_pop.hpp>

#endif
4 changes: 4 additions & 0 deletions include/beman/execution26/detail/get_domain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <beman/execution26/detail/forwarding_query.hpp>
#include <utility>

#include <beman/execution26/detail/suppress_push.hpp>

// ----------------------------------------------------------------------------

namespace beman::execution26 {
Expand Down Expand Up @@ -40,4 +42,6 @@ inline constexpr get_domain_t get_domain{};

// ----------------------------------------------------------------------------

#include <beman/execution26/detail/suppress_pop.hpp>

#endif
22 changes: 22 additions & 0 deletions include/beman/execution26/detail/immovable.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// include/beman/execution26/detail/immovable.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_IMMOVABLE
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_IMMOVABLE

// ----------------------------------------------------------------------------

namespace beman::execution26::detail {
struct immovable {
constexpr immovable() = default;
immovable(immovable&&) = delete;
immovable(const immovable&) = delete;
~immovable() = default;
auto operator=(immovable&&) -> immovable& = delete;
auto operator=(const immovable&) -> immovable& = delete;
};
} // namespace beman::execution26::detail

// ----------------------------------------------------------------------------

#endif
5 changes: 4 additions & 1 deletion include/beman/execution26/detail/inplace_stop_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class beman::execution26::inplace_stop_token {
friend class ::beman::execution26::inplace_stop_source;
template <typename CallbackFun>
friend class ::beman::execution26::inplace_stop_callback;
inplace_stop_token(::beman::execution26::inplace_stop_source* source) : source(source) {}
explicit inplace_stop_token(::beman::execution26::inplace_stop_source* source) : source(source) {}

::beman::execution26::inplace_stop_source* source{};
};
Expand Down Expand Up @@ -83,12 +83,15 @@ class beman::execution26::inplace_stop_callback final

template <typename Init>
inplace_stop_callback(::beman::execution26::inplace_stop_token, Init&&);
inplace_stop_callback(const inplace_stop_callback&) = delete;
inplace_stop_callback(inplace_stop_callback&&) = delete;
~inplace_stop_callback() {
if (this->source) {
this->source->deregister(this);
}
}
auto operator=(const inplace_stop_callback&) -> inplace_stop_callback& = delete;
auto operator=(inplace_stop_callback&&) -> inplace_stop_callback& = delete;

private:
auto call() -> void override;
Expand Down
8 changes: 2 additions & 6 deletions include/beman/execution26/detail/notify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_NOTIFY

#include <beman/execution26/detail/make_sender.hpp>
#include <beman/execution26/detail/immovable.hpp>
#include <mutex>
#include <utility>
#include <iostream> //-dk:TODO remove
#include <cassert> //-dk:TODO remove

// ----------------------------------------------------------------------------

namespace beman::execution26::detail {
struct notify_t;
class notifier {
class notifier : ::beman::execution26::detail::immovable {
public:
notifier() = default;
notifier(notifier&&) = delete;

auto complete() -> void {
::std::unique_lock kerberos(this->lock);
this->completed = true;
Expand Down
3 changes: 3 additions & 0 deletions include/beman/execution26/detail/operation_state_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ struct beman::execution26::detail::operation_state_task {
using promise_type = ::beman::execution26::detail::connect_awaitable_promise<Receiver>;

explicit operation_state_task(::std::coroutine_handle<> handle) noexcept : handle(handle) {}
operation_state_task(const operation_state_task&) = delete;
operation_state_task(operation_state_task&& other) noexcept : handle(::std::exchange(other.handle, {})) {}
~operation_state_task() {
if (this->handle)
this->handle.destroy();
}
auto operator=(operation_state_task&&) -> operation_state_task& = delete;
auto operator=(const operation_state_task&) -> operation_state_task& = delete;

auto start() & noexcept -> void { this->handle.resume(); }

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/product_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct product_type : ::beman::execution26::detail::product_type_base<::std::ind

template <typename Allocator, typename Product>
static auto make_from(Allocator&& allocator, Product&& product) -> product_type {
return std::forward<Product>(product).make_from(
return product_type::make_from(
::std::forward<Allocator>(allocator), ::std::forward<Product>(product), ::std::index_sequence_for<T...>{});
}

Expand Down
9 changes: 6 additions & 3 deletions include/beman/execution26/detail/run_loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <beman/execution26/detail/get_completion_scheduler.hpp>
#include <beman/execution26/detail/get_env.hpp>
#include <beman/execution26/detail/get_stop_token.hpp>
#include <beman/execution26/detail/immovable.hpp>
#include <beman/execution26/detail/operation_state.hpp>
#include <beman/execution26/detail/scheduler.hpp>
#include <beman/execution26/detail/sender.hpp>
Expand Down Expand Up @@ -36,7 +37,7 @@ class run_loop {
return {this->loop};
}
};
struct opstate_base {
struct opstate_base : ::beman::execution26::detail::immovable {
opstate_base* next{};
virtual auto execute() noexcept -> void = 0;
};
Expand All @@ -49,7 +50,6 @@ class run_loop {

template <typename R>
opstate(run_loop* loop, R&& receiver) : loop(loop), receiver(::std::forward<Receiver>(receiver)) {}
opstate(opstate&&) = delete;
auto start() & noexcept -> void {
try {
this->loop->push_back(this);
Expand Down Expand Up @@ -88,7 +88,7 @@ class run_loop {
auto operator==(const scheduler&) const -> bool = default;
};

enum class state { starting, running, finishing };
enum class state : unsigned char { starting, running, finishing };

state current_state{state::starting};
::std::mutex mutex{};
Expand All @@ -115,12 +115,15 @@ class run_loop {

public:
run_loop() noexcept = default;
run_loop(const run_loop&) = delete;
run_loop(run_loop&&) = delete;
~run_loop() {
::std::lock_guard guard(this->mutex);
if (this->front != nullptr || this->current_state == state::running)
::std::terminate();
}
auto operator=(const run_loop&) -> run_loop& = delete;
auto operator=(run_loop&&) -> run_loop& = delete;

auto get_scheduler() -> scheduler { return {this}; }

Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/sched_attrs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class sched_attrs {

public:
template <typename S>
sched_attrs(S&& sched) : sched(::std::forward<S>(sched)) {}
explicit sched_attrs(S sched) : sched(::std::move(sched)) {}

template <typename Tag>
auto query(const ::beman::execution26::get_completion_scheduler_t<Tag>&) const noexcept {
Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/sched_env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class sched_env {

public:
template <typename S>
explicit sched_env(S&& sch) : sched(::std::forward<S>(sch)) {}
explicit sched_env(S sch) : sched(::std::move(sch)) {}

auto query(const ::beman::execution26::get_scheduler_t&) const noexcept { return this->sched; }
auto query(const ::beman::execution26::get_domain_t& q) const noexcept {
Expand Down
4 changes: 4 additions & 0 deletions include/beman/execution26/detail/schedule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <beman/execution26/detail/common.hpp>
#include <utility>

#include <beman/execution26/detail/suppress_push.hpp>

// ----------------------------------------------------------------------------

namespace beman::execution26 {
Expand All @@ -33,4 +35,6 @@ inline constexpr ::beman::execution26::schedule_t schedule{};

// ----------------------------------------------------------------------------

#include <beman/execution26/detail/suppress_pop.hpp>

#endif
2 changes: 2 additions & 0 deletions include/beman/execution26/detail/sender_adaptor_closure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ struct sender_adaptor_closure_base {};
} // namespace beman::execution26::detail::pipeable

namespace beman::execution26 {
// NOLINTBEGIN(bugprone-crtp-constructor-accessibility)
template <typename>
struct sender_adaptor_closure : ::beman::execution26::detail::pipeable::sender_adaptor_closure_base {};
// NOLINTEND(bugprone-crtp-constructor-accessibility)
} // namespace beman::execution26

namespace beman::execution26::detail::pipeable {
Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/sender_decompose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace beman::execution26::detail {
struct sender_convert_to_any_t {
template <typename T>
constexpr operator T() const;
constexpr operator T() const; // NOLINT(hicpp-explicit-conversions)
};

template <typename Tag, typename Data, typename Children>
Expand Down
4 changes: 4 additions & 0 deletions include/beman/execution26/detail/set_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <beman/execution26/detail/common.hpp>
#include <utility>

#include <beman/execution26/detail/suppress_push.hpp>

// ----------------------------------------------------------------------------

namespace beman::execution26 {
Expand Down Expand Up @@ -47,4 +49,6 @@ inline constexpr set_error_t set_error{};

// ----------------------------------------------------------------------------

#include <beman/execution26/detail/suppress_pop.hpp>

#endif
Loading