From aee392a046a26ae2340849fe98e38332d9537397 Mon Sep 17 00:00:00 2001 From: Eric Niebler Date: Wed, 18 Dec 2024 11:12:00 -0800 Subject: [PATCH 1/2] reformat with clang-format-20 --- .clang-format | 4 +- examples/algorithms/retry.hpp | 13 ++- examples/benchmark/common.hpp | 5 +- examples/hello_world.cpp | 8 +- examples/io_uring.cpp | 82 +++++++-------- examples/nvexec/maxwell/common.cuh | 51 ++++------ examples/nvexec/maxwell/snr.cuh | 27 +++-- examples/nvexec/maxwell_distributed.cpp | 6 +- examples/scope.cpp | 8 +- include/exec/__detail/__basic_sequence.hpp | 16 +-- .../__system_context_default_impl_entry.hpp | 5 +- include/exec/__detail/intrusive_heap.hpp | 8 +- include/exec/any_sender_of.hpp | 41 ++++---- include/exec/async_scope.hpp | 30 +++--- include/exec/at_coroutine_exit.hpp | 8 +- include/exec/create.hpp | 21 ++-- include/exec/env.hpp | 6 +- include/exec/finally.hpp | 4 +- include/exec/into_tuple.hpp | 4 +- include/exec/just_from.hpp | 23 ++--- .../linux/__detail/memory_mapped_region.hpp | 4 +- .../linux/__detail/safe_file_descriptor.hpp | 4 +- include/exec/linux/io_uring_context.hpp | 10 +- include/exec/materialize.hpp | 12 +-- include/exec/on_coro_disposition.hpp | 4 +- include/exec/repeat_effect_until.hpp | 4 +- include/exec/repeat_n.hpp | 3 +- include/exec/sequence.hpp | 57 +++-------- include/exec/sequence/any_sequence_of.hpp | 5 +- include/exec/sequence/empty_sequence.hpp | 6 +- include/exec/sequence/ignore_all_values.hpp | 12 +-- include/exec/sequence/iterate.hpp | 9 +- include/exec/sequence/transform_each.hpp | 9 +- include/exec/sequence_senders.hpp | 7 +- include/exec/start_now.hpp | 5 +- include/exec/static_thread_pool.hpp | 13 ++- include/exec/task.hpp | 16 ++- include/exec/timed_thread_scheduler.hpp | 4 +- include/exec/trampoline_scheduler.hpp | 3 +- include/exec/when_any.hpp | 4 +- include/execpools/thread_pool_base.hpp | 3 +- include/nvexec/detail/queue.cuh | 3 +- include/nvexec/detail/variant.cuh | 61 ++++-------- include/nvexec/multi_gpu_context.cuh | 11 ++- include/nvexec/nvtx.cuh | 12 +-- include/nvexec/stream/algorithm_base.cuh | 12 +-- include/nvexec/stream/bulk.cuh | 26 ++--- include/nvexec/stream/common.cuh | 60 +++++------ include/nvexec/stream/continues_on.cuh | 17 ++-- include/nvexec/stream/ensure_started.cuh | 17 ++-- include/nvexec/stream/launch.cuh | 8 +- include/nvexec/stream/let_xxx.cuh | 14 +-- include/nvexec/stream/reduce.cuh | 42 ++++---- include/nvexec/stream/schedule_from.cuh | 10 +- include/nvexec/stream/split.cuh | 17 ++-- include/nvexec/stream/submit.cuh | 4 +- include/nvexec/stream/then.cuh | 3 +- include/nvexec/stream/upon_error.cuh | 3 +- include/nvexec/stream/upon_stopped.cuh | 5 +- include/nvexec/stream/when_all.cuh | 22 ++--- include/nvexec/stream_context.cuh | 29 +++--- include/stdexec/__detail/__awaitable.hpp | 7 +- include/stdexec/__detail/__basic_sender.hpp | 91 ++++++----------- include/stdexec/__detail/__bulk.hpp | 12 +-- include/stdexec/__detail/__config.hpp | 2 +- .../stdexec/__detail/__connect_awaitable.hpp | 6 +- include/stdexec/__detail/__continues_on.hpp | 4 +- include/stdexec/__detail/__debug.hpp | 27 ++--- include/stdexec/__detail/__domain.hpp | 16 +-- include/stdexec/__detail/__ensure_started.hpp | 4 +- include/stdexec/__detail/__env.hpp | 56 ++++------- include/stdexec/__detail/__into_variant.hpp | 4 +- .../__detail/__intrusive_mpsc_queue.hpp | 2 +- include/stdexec/__detail/__intrusive_ptr.hpp | 4 +- .../stdexec/__detail/__intrusive_queue.hpp | 2 +- .../stdexec/__detail/__intrusive_slist.hpp | 2 +- include/stdexec/__detail/__just.hpp | 12 +-- include/stdexec/__detail/__let.hpp | 6 +- .../stdexec/__detail/__manual_lifetime.hpp | 12 ++- include/stdexec/__detail/__meta.hpp | 44 +++------ include/stdexec/__detail/__on.hpp | 22 ++--- .../stdexec/__detail/__operation_states.hpp | 8 +- .../stdexec/__detail/__receiver_adaptor.hpp | 35 ++----- include/stdexec/__detail/__receivers.hpp | 26 ++--- include/stdexec/__detail/__run_loop.hpp | 7 +- include/stdexec/__detail/__schedule_from.hpp | 4 +- include/stdexec/__detail/__schedulers.hpp | 16 +-- include/stdexec/__detail/__scope.hpp | 42 +++----- .../__detail/__sender_adaptor_closure.hpp | 42 +++----- .../__detail/__sender_introspection.hpp | 4 +- include/stdexec/__detail/__senders.hpp | 10 +- include/stdexec/__detail/__shared.hpp | 19 ++-- .../stdexec/__detail/__spin_loop_pause.hpp | 12 +-- include/stdexec/__detail/__split.hpp | 4 +- include/stdexec/__detail/__start_detached.hpp | 3 +- include/stdexec/__detail/__starts_on.hpp | 4 +- .../stdexec/__detail/__stopped_as_error.hpp | 4 +- .../__detail/__stopped_as_optional.hpp | 4 +- include/stdexec/__detail/__submit.hpp | 3 +- include/stdexec/__detail/__sync_wait.hpp | 11 ++- include/stdexec/__detail/__tag_invoke.hpp | 14 +-- include/stdexec/__detail/__then.hpp | 4 +- .../__transform_completion_signatures.hpp | 99 +++++++------------ .../stdexec/__detail/__transform_sender.hpp | 18 ++-- include/stdexec/__detail/__tuple.hpp | 34 ++----- include/stdexec/__detail/__type_traits.hpp | 2 +- include/stdexec/__detail/__upon_error.hpp | 4 +- include/stdexec/__detail/__upon_stopped.hpp | 4 +- include/stdexec/__detail/__utility.hpp | 11 +-- include/stdexec/__detail/__variant.hpp | 66 ++++--------- include/stdexec/__detail/__when_all.hpp | 3 +- include/stdexec/__detail/__write_env.hpp | 8 +- include/stdexec/functional.hpp | 68 ++++--------- include/stdexec/stop_token.hpp | 8 +- include/tbbexec/tbb_thread_pool.hpp | 5 +- test/exec/async_scope/test_spawn.cpp | 34 ++++--- test/exec/async_scope/test_spawn_future.cpp | 34 ++++--- test/exec/sequence/test_any_sequence_of.cpp | 28 +++--- test/exec/sequence/test_empty_sequence.cpp | 7 +- test/exec/sequence/test_ignore_all_values.cpp | 35 ++++--- test/exec/test_any_sender.cpp | 22 +++-- test/exec/test_finally.cpp | 28 +++--- test/exec/test_repeat_n.cpp | 6 +- test/exec/test_sequence_senders.cpp | 21 ++-- .../test_system_context_replaceability.cpp | 4 +- test/exec/test_variant_sender.cpp | 19 ++-- test/execpools/test_asio_thread_pool.cpp | 14 +-- test/execpools/test_taskflow_thread_pool.cpp | 14 +-- test/execpools/test_tbb_thread_pool.cpp | 7 +- test/nvexec/bulk.cpp | 2 +- test/nvexec/common.cuh | 11 +-- test/nvexec/then.cpp | 2 +- test/nvexec/upon_error.cpp | 2 +- test/stdexec/algos/adaptors/test_bulk.cpp | 16 +-- .../stdexec/algos/adaptors/test_let_fail1.cpp | 2 +- test/stdexec/algos/adaptors/test_split.cpp | 31 +++--- .../stdexec/algos/adaptors/test_starts_on.cpp | 2 +- test/stdexec/algos/adaptors/test_then.cpp | 16 +-- .../algos/adaptors/test_then_fail1.cpp | 2 +- .../algos/adaptors/test_upon_error.cpp | 4 +- .../algos/adaptors/test_upon_stopped.cpp | 4 +- test/stdexec/concepts/test_awaitables.cpp | 8 +- .../queries/test_forwarding_queries.cpp | 5 +- test/test_common/retry.hpp | 13 ++- test/test_common/tuple.hpp | 4 +- 145 files changed, 923 insertions(+), 1355 deletions(-) diff --git a/.clang-format b/.clang-format index fe89be65e..d34b775ac 100644 --- a/.clang-format +++ b/.clang-format @@ -27,7 +27,7 @@ AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true AlwaysBreakTemplateDeclarations: Yes AttributeMacros: [ - 'STDEXEC_SYSTEM_CONTEXT_INLINE' + STDEXEC_SYSTEM_CONTEXT_INLINE ] BinPackArguments: false BinPackParameters: false @@ -86,7 +86,7 @@ Macros: [ 'STDEXEC_MEMFN_DECL(X)=X', 'STDEXEC_MEMFN_DECL(X,Y)=X,Y', 'STDEXEC_MEMFN_DECL(X,Y,Z)=X,Y,Z', - 'STDEXEC_ATTRIBUTE(X)=__attribute__(X) //', + 'STDEXEC_ATTRIBUTE(X)=[[]]', 'STDEXEC_NO_UNIQUE_ADDRESS=[[no_unique_address]]', 'STDEXEC_IMMOVABLE_NO_UNIQUE_ADDRESS=[[no_unique_address]]', 'STDEXEC_MISSING_MEMBER(X,Y)=true', diff --git a/examples/algorithms/retry.hpp b/examples/algorithms/retry.hpp index 70639145e..d65710903 100644 --- a/examples/algorithms/retry.hpp +++ b/examples/algorithms/retry.hpp @@ -121,13 +121,12 @@ struct _retry_sender { using _value = stdexec::completion_signatures; template - auto get_completion_signatures(Env&&) const - -> stdexec::transform_completion_signatures_of< - S&, - Env, - stdexec::completion_signatures, - _value, - _error> { + auto get_completion_signatures(Env&&) const -> stdexec::transform_completion_signatures_of< + S&, + Env, + stdexec::completion_signatures, + _value, + _error> { return {}; } diff --git a/examples/benchmark/common.hpp b/examples/benchmark/common.hpp index 040a8dcfb..2156c4550 100644 --- a/examples/benchmark/common.hpp +++ b/examples/benchmark/common.hpp @@ -121,8 +121,9 @@ void my_main(int argc, char** argv, exec::numa_policy policy = exec::get_numa_po std::size_t buffer_size = 2000 << 20; for (std::size_t i = 0; i < static_cast(nthreads); ++i) { exec::numa_allocator alloc(policy.thread_index_to_node(i)); - buffers.push_back(std::unique_ptr{ - alloc.allocate(buffer_size), numa_deleter{buffer_size, alloc} + buffers.push_back( + std::unique_ptr{ + alloc.allocate(buffer_size), numa_deleter{buffer_size, alloc} }); } #endif diff --git a/examples/hello_world.cpp b/examples/hello_world.cpp index 37054d7b1..0e3869840 100644 --- a/examples/hello_world.cpp +++ b/examples/hello_world.cpp @@ -26,16 +26,16 @@ using stdexec::sync_wait; int main() { exec::numa_policy numa{exec::no_numa_policy{}}; exec::static_thread_pool ctx{8}; - scheduler auto sch = ctx.get_scheduler(); // 1 - // - sender auto begin = schedule(sch); // 2 + scheduler auto sch = ctx.get_scheduler(); // 1 + // + sender auto begin = schedule(sch); // 2 sender auto hi_again = then( // 3 begin, // 3 [] { // 3 std::cout << "Hello world! Have an int.\n"; // 3 return 13; // 3 }); // 3 - // + // sender auto add_42 = then(hi_again, [](int arg) { return arg + 42; }); // 4 auto [i] = sync_wait(std::move(add_42)).value(); // 5 std::cout << "Result: " << i << std::endl; diff --git a/examples/io_uring.cpp b/examples/io_uring.cpp index dfc7d9bf8..90f0add95 100644 --- a/examples/io_uring.cpp +++ b/examples/io_uring.cpp @@ -40,42 +40,45 @@ int main() { auto scheduler2 = context2.get_scheduler(); using namespace std::chrono_literals; - stdexec::sync_wait(exec::when_any( - exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }), - exec::schedule_after(scheduler2, 2s) | stdexec::then([] { std::cout << "Hello, 2!\n"; }) - | stdexec::upon_stopped([] { std::cout << "Hello, 2, stopped.\n"; }))); - - stdexec::sync_wait(exec::when_any( - exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }) - | stdexec::upon_stopped([] { std::cout << "Hello, 1, stopped.\n"; }), - exec::schedule_after(scheduler2, 500ms) | stdexec::then([] { std::cout << "Hello, 2!\n"; }) - | stdexec::upon_stopped([] { std::cout << "Hello, 2, stopped.\n"; }))); - - stdexec::sync_wait(stdexec::when_all( - stdexec::schedule(scheduler) | stdexec::then([] { std::cout << "Hello, 0!\n"; }), - exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }), - exec::schedule_after(scheduler2, 2s) | stdexec::then([] { std::cout << "Hello, 2!\n"; }), - exec::schedule_after(scheduler, 3s) | stdexec::then([] { std::cout << "Stop it!\n"; }), - exec::finally(exec::schedule_after(scheduler2, 4s), stdexec::just() | stdexec::then([&] { - context.request_stop(); - })), - exec::finally(exec::schedule_after(scheduler, 4s), stdexec::just() | stdexec::then([&] { - context2.request_stop(); - })), - exec::schedule_after(scheduler, 10s) // - | stdexec::then([] { // - std::cout << "Hello, world!\n"; // - }) // - | stdexec::upon_stopped([] { // - std::cout << "Hello, stopped.\n"; // - }), // - exec::schedule_after(scheduler2, 10s) // - | stdexec::then([] { // - std::cout << "Hello, world!\n"; // - }) // - | stdexec::upon_stopped([] { // - std::cout << "Hello, stopped.\n"; // - }))); // + stdexec::sync_wait( + exec::when_any( + exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }), + exec::schedule_after(scheduler2, 2s) | stdexec::then([] { std::cout << "Hello, 2!\n"; }) + | stdexec::upon_stopped([] { std::cout << "Hello, 2, stopped.\n"; }))); + + stdexec::sync_wait( + exec::when_any( + exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }) + | stdexec::upon_stopped([] { std::cout << "Hello, 1, stopped.\n"; }), + exec::schedule_after(scheduler2, 500ms) | stdexec::then([] { std::cout << "Hello, 2!\n"; }) + | stdexec::upon_stopped([] { std::cout << "Hello, 2, stopped.\n"; }))); + + stdexec::sync_wait( + stdexec::when_all( + stdexec::schedule(scheduler) | stdexec::then([] { std::cout << "Hello, 0!\n"; }), + exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }), + exec::schedule_after(scheduler2, 2s) | stdexec::then([] { std::cout << "Hello, 2!\n"; }), + exec::schedule_after(scheduler, 3s) | stdexec::then([] { std::cout << "Stop it!\n"; }), + exec::finally(exec::schedule_after(scheduler2, 4s), stdexec::just() | stdexec::then([&] { + context.request_stop(); + })), + exec::finally(exec::schedule_after(scheduler, 4s), stdexec::just() | stdexec::then([&] { + context2.request_stop(); + })), + exec::schedule_after(scheduler, 10s) // + | stdexec::then([] { // + std::cout << "Hello, world!\n"; // + }) // + | stdexec::upon_stopped([] { // + std::cout << "Hello, stopped.\n"; // + }), // + exec::schedule_after(scheduler2, 10s) // + | stdexec::then([] { // + std::cout << "Hello, world!\n"; // + }) // + | stdexec::upon_stopped([] { // + std::cout << "Hello, stopped.\n"; // + }))); // io_thread.join(); io_thread2.join(); @@ -96,9 +99,10 @@ int main() { while (!context.is_running()) ; - stdexec::sync_wait(exec::when_any( - exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }), - exec::schedule_after(scheduler, 500ms) | stdexec::then([] { std::cout << "Hello, 2!\n"; }))); + stdexec::sync_wait( + exec::when_any( + exec::schedule_after(scheduler, 1s) | stdexec::then([] { std::cout << "Hello, 1!\n"; }), + exec::schedule_after(scheduler, 500ms) | stdexec::then([] { std::cout << "Hello, 2!\n"; }))); auto time_point = std::chrono::steady_clock::now() + 1s; stdexec::sync_wait(exec::schedule_at(scheduler, time_point) | stdexec::then([] { diff --git a/examples/nvexec/maxwell/common.cuh b/examples/nvexec/maxwell/common.cuh index 69beab419..9df58b3ca 100644 --- a/examples/nvexec/maxwell/common.cuh +++ b/examples/nvexec/maxwell/common.cuh @@ -51,8 +51,7 @@ struct deleter_t { }; template -STDEXEC_ATTRIBUTE((host, device)) -inline std::unique_ptr allocate_on(bool gpu, std::size_t elements = 1) { +STDEXEC_ATTRIBUTE((host, device)) inline std::unique_ptr allocate_on(bool gpu, std::size_t elements = 1) { T *ptr{}; #if defined(_NVHPC_CUDA) || defined(__CUDACC__) @@ -90,8 +89,7 @@ struct fields_accessor { float *base_ptr; - STDEXEC_ATTRIBUTE((nodiscard, host, device)) - float *get(field_id id) const { + STDEXEC_ATTRIBUTE((nodiscard, host, device)) float *get(field_id id) const { return base_ptr + static_cast(id) * cells; } }; @@ -111,9 +109,10 @@ struct grid_t { grid_t(std::size_t n, bool gpu) : n(n) , cells(n * n) - , fields_(allocate_on( - gpu, - static_cast(cells) * static_cast(field_id::fields_count))) { + , fields_( + allocate_on( + gpu, + static_cast(cells) * static_cast(field_id::fields_count))) { } [[nodiscard]] @@ -124,8 +123,8 @@ struct grid_t { constexpr float C0 = 299792458.0f; // Speed of light [metres per second] -STDEXEC_ATTRIBUTE((host, device)) -inline bool is_circle_part(float x, float y, float object_x, float object_y, float object_size) { +STDEXEC_ATTRIBUTE((host, device)) inline bool + is_circle_part(float x, float y, float object_x, float object_y, float object_size) { const float os2 = object_size * object_size; return ((x - object_x) * (x - object_x) + (y - object_y) * (y - object_y) <= os2); } @@ -139,9 +138,7 @@ struct grid_initializer_t { float dt; fields_accessor accessor; - STDEXEC_ATTRIBUTE((host, device)) - void - operator()(std::size_t cell_id) const { + STDEXEC_ATTRIBUTE((host, device)) void operator()(std::size_t cell_id) const { const std::size_t row = cell_id / accessor.n; const std::size_t column = cell_id % accessor.n; @@ -184,32 +181,26 @@ inline grid_initializer_t grid_initializer(float dt, fields_accessor accessor) { return {dt, accessor}; } -STDEXEC_ATTRIBUTE((host, device)) -inline std::size_t right_nid(std::size_t cell_id, std::size_t col, std::size_t N) { +STDEXEC_ATTRIBUTE((host, device)) inline std::size_t right_nid(std::size_t cell_id, std::size_t col, std::size_t N) { return col == N - 1 ? cell_id - (N - 1) : cell_id + 1; } -STDEXEC_ATTRIBUTE((host, device)) -inline std::size_t left_nid(std::size_t cell_id, std::size_t col, std::size_t N) { +STDEXEC_ATTRIBUTE((host, device)) inline std::size_t left_nid(std::size_t cell_id, std::size_t col, std::size_t N) { return col == 0 ? cell_id + N - 1 : cell_id - 1; } -STDEXEC_ATTRIBUTE((host, device)) -inline std::size_t bottom_nid(std::size_t cell_id, std::size_t row, std::size_t N) { +STDEXEC_ATTRIBUTE((host, device)) inline std::size_t bottom_nid(std::size_t cell_id, std::size_t row, std::size_t N) { return row == 0 ? cell_id + N * (N - 1) : cell_id - N; } -STDEXEC_ATTRIBUTE((host, device)) -inline std::size_t top_nid(std::size_t cell_id, std::size_t row, std::size_t N) { +STDEXEC_ATTRIBUTE((host, device)) inline std::size_t top_nid(std::size_t cell_id, std::size_t row, std::size_t N) { return row == N - 1 ? cell_id - N * (N - 1) : cell_id + N; } struct h_field_calculator_t { fields_accessor accessor; - STDEXEC_ATTRIBUTE((always_inline, host, device)) - void - operator()(std::size_t cell_id) const { + STDEXEC_ATTRIBUTE((always_inline, host, device)) void operator()(std::size_t cell_id) const { const std::size_t N = accessor.n; const std::size_t column = cell_id % N; const std::size_t row = cell_id / N; @@ -235,21 +226,17 @@ struct e_field_calculator_t { fields_accessor accessor; std::size_t source_position; - STDEXEC_ATTRIBUTE((nodiscard, host, device)) - float gaussian_pulse(float t, float t_0, float tau) const { + STDEXEC_ATTRIBUTE((nodiscard, host, device)) float gaussian_pulse(float t, float t_0, float tau) const { return exp(-(((t - t_0) / tau) * (t - t_0) / tau)); } - STDEXEC_ATTRIBUTE((nodiscard, host, device)) - float calculate_source(float t, float frequency) const { + STDEXEC_ATTRIBUTE((nodiscard, host, device)) float calculate_source(float t, float frequency) const { const float tau = 0.5f / frequency; const float t_0 = 6.0f * tau; return gaussian_pulse(t, t_0, tau); } - STDEXEC_ATTRIBUTE((always_inline, host, device)) - void - operator()(std::size_t cell_id) const { + STDEXEC_ATTRIBUTE((always_inline, host, device)) void operator()(std::size_t cell_id) const { const std::size_t N = accessor.n; const std::size_t column = cell_id % N; const std::size_t row = cell_id / N; @@ -364,8 +351,8 @@ class result_dumper_t { void operator()(bool update_time = true) const { int rank_ = 0; - const std::string filename = std::string("output_") + std::to_string(rank_) + "_" - + std::to_string(0) + ".vtk"; + const std::string filename = + std::string("output_") + std::to_string(rank_) + "_" + std::to_string(0) + ".vtk"; write_vtk(filename); } diff --git a/examples/nvexec/maxwell/snr.cuh b/examples/nvexec/maxwell/snr.cuh index 85b91651c..82dce94fb 100644 --- a/examples/nvexec/maxwell/snr.cuh +++ b/examples/nvexec/maxwell/snr.cuh @@ -148,10 +148,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { // struct operation_state_t : operation_state_base_t { using PredSender = stdexec::__t; using Receiver = stdexec::__t; - using Scheduler = - std::invoke_result_t>; - using InnerSender = - std::invoke_result_t>; + using Scheduler = std::invoke_result_t>; + using InnerSender = std::invoke_result_t>; using predecessor_op_state_t = ex::connect_result_t>; @@ -167,8 +165,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { // friend void tag_invoke(stdexec::start_t, operation_state_t& op) noexcept { if (op.stream_provider_.status_ != cudaSuccess) { // Couldn't allocate memory for operation state, complete with error - op.propagate_completion_signal( - stdexec::set_error, std::move(op.stream_provider_.status_)); + op.propagate_completion_signal(stdexec::set_error, std::move(op.stream_provider_.status_)); } else { if (op.n_) { stdexec::start(*op.pred_op_state_); @@ -180,9 +177,9 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { // operation_state_t(PredSender&& pred_sender, Closure closure, Receiver&& rcvr, std::size_t n) : operation_state_base_t( - static_cast(rcvr), - stdexec::get_completion_scheduler(stdexec::get_env(pred_sender)) - .context_state_) + static_cast(rcvr), + stdexec::get_completion_scheduler(stdexec::get_env(pred_sender)) + .context_state_) , pred_sender_{static_cast(pred_sender)} , closure_(closure) , n_(n) { @@ -290,10 +287,8 @@ namespace repeat_n_detail { struct operation_state_t { using PredSender = stdexec::__t; using Receiver = stdexec::__t; - using Scheduler = - std::invoke_result_t>; - using InnerSender = - std::invoke_result_t>; + using Scheduler = std::invoke_result_t>; + using InnerSender = std::invoke_result_t>; using predecessor_op_state_t = ex::connect_result_t>; @@ -395,7 +390,11 @@ struct repeat_n_t { template auto operator()(std::size_t n, Closure closure) const -> stdexec::__binder_back { - return {{n, static_cast(closure)}, {}, {}}; + return { + {n, static_cast(closure)}, + {}, + {} + }; } }; diff --git a/examples/nvexec/maxwell_distributed.cpp b/examples/nvexec/maxwell_distributed.cpp index a75cb34be..bb8e281a2 100644 --- a/examples/nvexec/maxwell_distributed.cpp +++ b/examples/nvexec/maxwell_distributed.cpp @@ -88,8 +88,10 @@ namespace distributed { , begin(grid_begin) , end(grid_end) , own_cells(end - begin) - , fields_(device_alloc( - static_cast(own_cells + n * 2) * static_cast(field_id::fields_count))) { + , fields_( + device_alloc( + static_cast(own_cells + n * 2) + * static_cast(field_id::fields_count))) { } [[nodiscard]] diff --git a/examples/scope.cpp b/examples/scope.cpp index 57b56d87a..0759352e4 100644 --- a/examples/scope.cpp +++ b/examples/scope.cpp @@ -84,10 +84,10 @@ int main() { // sender auto printFortyTwo = then( std::move(fortyTwoFuture), - [](int fortyTwo) noexcept { // 9 - printf("%d\n", fortyTwo); // - }); // - // + [](int fortyTwo) noexcept { // 9 + printf("%d\n", fortyTwo); // + }); // + // sender auto allDone = then( // when_all(printEmpty, std::move(printFortyTwo)), // [](auto&&...) noexcept { printf("\nall done\n"); }); // 10 diff --git a/include/exec/__detail/__basic_sequence.hpp b/include/exec/__detail/__basic_sequence.hpp index 9931a2f60..aa72e6aa5 100644 --- a/include/exec/__detail/__basic_sequence.hpp +++ b/include/exec/__detail/__basic_sequence.hpp @@ -48,12 +48,12 @@ namespace exec { mutable __captures_t __impl_; template - STDEXEC_ATTRIBUTE((host, device)) - explicit __seqexpr(_Tag, _Data&& __data, _Child&&... __child) - : __impl_(stdexec::__detail::__captures( - _Tag(), - static_cast<_Data&&>(__data), - static_cast<_Child&&>(__child)...)) { + STDEXEC_ATTRIBUTE((host, device)) explicit __seqexpr(_Tag, _Data&& __data, _Child&&... __child) + : __impl_( + stdexec::__detail::__captures( + _Tag(), + static_cast<_Data&&>(__data), + static_cast<_Child&&>(__child)...)) { } template _Self = __seqexpr> @@ -110,8 +110,8 @@ namespace exec { }; template - STDEXEC_ATTRIBUTE((host, device)) - __seqexpr(_Tag, _Data, _Child...) -> __seqexpr; + STDEXEC_ATTRIBUTE((host, device)) __seqexpr(_Tag, _Data, _Child...) + -> __seqexpr; template using __seqexpr_t = __seqexpr; diff --git a/include/exec/__detail/__system_context_default_impl_entry.hpp b/include/exec/__detail/__system_context_default_impl_entry.hpp index 9027e8274..bf4c71542 100644 --- a/include/exec/__detail/__system_context_default_impl_entry.hpp +++ b/include/exec/__detail/__system_context_default_impl_entry.hpp @@ -27,10 +27,7 @@ STDEXEC_PRAGMA_PUSH() STDEXEC_PRAGMA_IGNORE_GNU("-Wattributes") // warning: inline function '[...]' declared weak /// Gets the default system context implementation. -extern - STDEXEC_SYSTEM_CONTEXT_INLINE - STDEXEC_ATTRIBUTE((weak)) - void* +extern STDEXEC_SYSTEM_CONTEXT_INLINE STDEXEC_ATTRIBUTE((weak)) void* __query_system_context_interface(const __uuid& __id) noexcept { return exec::__system_context_default_impl::__default_query_system_context_interface(__id); } diff --git a/include/exec/__detail/intrusive_heap.hpp b/include/exec/__detail/intrusive_heap.hpp index c94947713..d81cf6c7a 100644 --- a/include/exec/__detail/intrusive_heap.hpp +++ b/include/exec/__detail/intrusive_heap.hpp @@ -60,10 +60,10 @@ namespace exec { template < class Node, class KeyT, - KeyT Node::*Key, - Node* Node::*Prev, - Node* Node::*Left, - Node* Node::*Right> + KeyT Node::* Key, + Node* Node::* Prev, + Node* Node::* Left, + Node* Node::* Right> class intrusive_heap { public: void insert(Node* node) noexcept { diff --git a/include/exec/any_sender_of.hpp b/include/exec/any_sender_of.hpp index 3f4c847aa..eff7cd631 100644 --- a/include/exec/any_sender_of.hpp +++ b/include/exec/any_sender_of.hpp @@ -366,8 +366,7 @@ namespace exec { const __vtable_t* __vtable_{__default_storage_vtable(static_cast<__vtable_t*>(nullptr))}; void* __object_pointer_{nullptr}; alignas(__alignment) std::byte __buffer_[__buffer_size]{}; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Allocator __allocator_{}; + STDEXEC_ATTRIBUTE((no_unique_address)) _Allocator __allocator_{}; }; }; @@ -520,7 +519,8 @@ namespace exec { } template - STDEXEC_MEMFN_DECL(void __move_construct)(this __mtype<_Tp>, __t& __self, __t&& __other) noexcept { + STDEXEC_MEMFN_DECL( + void __move_construct)(this __mtype<_Tp>, __t& __self, __t&& __other) noexcept { if (!__other.__object_pointer_) { return; } @@ -540,8 +540,7 @@ namespace exec { template requires _Copyable - STDEXEC_MEMFN_DECL( - void __copy_construct)(this __mtype<_Tp>, __t& __self, const __t& __other) { + STDEXEC_MEMFN_DECL(void __copy_construct)(this __mtype<_Tp>, __t& __self, const __t& __other) { if (!__other.__object_pointer_) { return; } @@ -557,13 +556,13 @@ namespace exec { const __vtable_t* __vtable_{__default_storage_vtable(static_cast<__vtable_t*>(nullptr))}; void* __object_pointer_{nullptr}; alignas(__alignment) std::byte __buffer_[__buffer_size]{}; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Allocator __allocator_{}; + STDEXEC_ATTRIBUTE((no_unique_address)) _Allocator __allocator_{}; }; struct __empty_vtable { template - STDEXEC_MEMFN_DECL(auto __create_vtable)(this __mtype<__empty_vtable>, __mtype<_Sender>) noexcept + STDEXEC_MEMFN_DECL( + auto __create_vtable)(this __mtype<__empty_vtable>, __mtype<_Sender>) noexcept -> const __empty_vtable* { static const __empty_vtable __vtable_{}; return &__vtable_; @@ -620,7 +619,7 @@ namespace exec { private: template requires receiver_of<_Rcvr, completion_signatures<_Sigs...>> - && (__callable<__query_vfun_fn<_Rcvr>, _Queries> && ...) + && (__callable<__query_vfun_fn<_Rcvr>, _Queries> && ...) STDEXEC_MEMFN_DECL( auto __create_vtable)(this __mtype<__t>, __mtype<_Rcvr>) noexcept -> const __t* { static const __t __vtable_{ @@ -700,8 +699,8 @@ namespace exec { } }; - auto __test_never_stop_token( - get_stop_token_t (*)(never_stop_token (*)() noexcept)) -> __mbool; + auto __test_never_stop_token(get_stop_token_t (*)(never_stop_token (*)() noexcept)) + -> __mbool; template auto __test_never_stop_token(_Tag (*)(_Ret (*)(_As...) noexcept)) -> __mbool; @@ -783,7 +782,8 @@ namespace exec { private: template - STDEXEC_MEMFN_DECL(auto __create_vtable)(this __mtype<__operation_vtable>, __mtype<_Op>) noexcept + STDEXEC_MEMFN_DECL( + auto __create_vtable)(this __mtype<__operation_vtable>, __mtype<_Op>) noexcept -> const __operation_vtable* { static __operation_vtable __vtable{[](void* __object_pointer) noexcept -> void { STDEXEC_ASSERT(__object_pointer); @@ -810,8 +810,7 @@ namespace exec { template struct __operation_base { - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __rcvr_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_; stdexec::inplace_stop_source __stop_source_{}; using __stop_callback = typename stdexec::stop_token_of_t< stdexec::env_of_t<_Receiver>>::template callback_type<__on_stop_t>; @@ -831,8 +830,7 @@ namespace exec { template _Self, class _Item> requires __callable - STDEXEC_MEMFN_DECL( - auto set_next)(this _Self& __self, _Item&& __item) noexcept + STDEXEC_MEMFN_DECL(auto set_next)(this _Self& __self, _Item&& __item) noexcept -> __call_result_t { return exec::set_next(__self.__op_->__rcvr_, static_cast<_Item&&>(__item)); } @@ -919,8 +917,7 @@ namespace exec { } private: - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __rec_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rec_; __immovable_operation_storage __storage_{}; }; }; @@ -961,7 +958,9 @@ namespace exec { __immovable_operation_storage (*__connect_)(void*, __receiver_ref_t); private: template _Sender> - STDEXEC_MEMFN_DECL(auto __create_vtable)(this __mtype<__vtable>, __mtype<_Sender>) noexcept -> const __vtable* { + STDEXEC_MEMFN_DECL( + auto + __create_vtable)(this __mtype<__vtable>, __mtype<_Sender>) noexcept -> const __vtable* { static const __vtable __vtable_{ {*__create_vtable(__mtype<__query_vtable<_SenderQueries>>{}, __mtype<_Sender>{})}, [](void* __object_pointer, __receiver_ref_t __receiver) @@ -1083,7 +1082,9 @@ namespace exec { } private: template - STDEXEC_MEMFN_DECL(auto __create_vtable)(this __mtype<__vtable>, __mtype<_Scheduler>) noexcept -> const __vtable* { + STDEXEC_MEMFN_DECL( + auto + __create_vtable)(this __mtype<__vtable>, __mtype<_Scheduler>) noexcept -> const __vtable* { static const __vtable __vtable_{ {*__create_vtable( __mtype<__query_vtable<_SchedulerQueries, false>>{}, __mtype<_Scheduler>{})}, diff --git a/include/exec/async_scope.hpp b/include/exec/async_scope.hpp index 39bf6880b..460fda402 100644 --- a/include/exec/async_scope.hpp +++ b/include/exec/async_scope.hpp @@ -71,9 +71,10 @@ namespace exec { explicit __t(const __impl* __scope, _Constrained&& __sndr, _Receiver __rcvr) : __task{{}, __scope, __notify_waiter} - , __op_(stdexec::connect( - static_cast<_Constrained&&>(__sndr), - static_cast<_Receiver&&>(__rcvr))) { + , __op_( + stdexec::connect( + static_cast<_Constrained&&>(__sndr), + static_cast<_Receiver&&>(__rcvr))) { } void start() & noexcept { @@ -126,8 +127,7 @@ namespace exec { } const __impl* __scope_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Constrained __c_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Constrained __c_; }; }; @@ -140,8 +140,7 @@ namespace exec { struct __nest_op_base : __immovable { using _Receiver = stdexec::__t<_ReceiverId>; const __impl* __scope_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __rcvr_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_; }; template @@ -244,8 +243,7 @@ namespace exec { using sender_concept = stdexec::sender_t; const __impl* __scope_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Constrained __c_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Constrained __c_; template using __nest_operation_t = @@ -354,12 +352,9 @@ namespace exec { } } - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __rcvr_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_; std::unique_ptr<__future_state<_Sender, _Env>> __state_; - STDEXEC_ATTRIBUTE((no_unique_address)) - stdexec::__optional<__forward_consumer> - __forward_consumer_; + STDEXEC_ATTRIBUTE((no_unique_address)) stdexec::__optional<__forward_consumer> __forward_consumer_; public: using __id = __future_op; @@ -597,9 +592,10 @@ namespace exec { __future_state(_Sender __sndr, _Env __env, const __impl* __scope) : __future_state_base<_Completions, _Env>(static_cast<_Env&&>(__env), __scope) - , __op_(stdexec::connect( - static_cast<_Sender&&>(__sndr), - __future_receiver_t<_Sender, _Env>{this, __scope})) { + , __op_( + stdexec::connect( + static_cast<_Sender&&>(__sndr), + __future_receiver_t<_Sender, _Env>{this, __scope})) { } connect_result_t<_Sender, __future_receiver_t<_Sender, _Env>> __op_; diff --git a/include/exec/at_coroutine_exit.hpp b/include/exec/at_coroutine_exit.hpp index 1b6c79a9e..7716f4963 100644 --- a/include/exec/at_coroutine_exit.hpp +++ b/include/exec/at_coroutine_exit.hpp @@ -106,8 +106,8 @@ namespace exec { using __sender = __t<__sender_id<__decay_t<_Sender>>>; template - auto operator()(_Sender&& __sndr) const - noexcept(__nothrow_decay_copyable<_Sender>) -> __sender<_Sender> { + auto operator()(_Sender&& __sndr) const noexcept(__nothrow_decay_copyable<_Sender>) + -> __sender<_Sender> { return __sender<_Sender>{static_cast<_Sender&&>(__sndr)}; } @@ -169,8 +169,8 @@ namespace exec { return false; } - static auto await_suspend( - __coro::coroutine_handle<__promise> __h) noexcept -> __coro::coroutine_handle<> { + static auto await_suspend(__coro::coroutine_handle<__promise> __h) noexcept + -> __coro::coroutine_handle<> { __promise& __p = __h.promise(); auto __coro = __p.__is_unhandled_stopped_ ? __p.continuation().unhandled_stopped() : __p.continuation().handle(); diff --git a/include/exec/create.hpp b/include/exec/create.hpp index 4be162576..995a981a0 100644 --- a/include/exec/create.hpp +++ b/include/exec/create.hpp @@ -32,10 +32,8 @@ namespace exec { template struct __context { - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver receiver; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Args args; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver receiver; + STDEXEC_ATTRIBUTE((no_unique_address)) _Args args; }; template @@ -47,12 +45,9 @@ namespace exec { struct __t : stdexec::__immovable { using __id = __operation; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Context __ctx_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Fun __fun_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _State __state_{}; + STDEXEC_ATTRIBUTE((no_unique_address)) _Context __ctx_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_; + STDEXEC_ATTRIBUTE((no_unique_address)) _State __state_{}; void start() & noexcept { __state_.emplace(__emplace_from{[&]() noexcept { @@ -76,8 +71,8 @@ namespace exec { template <__decays_to<__t> _Self, receiver_of _Receiver> requires __callable<_Fun, __context<_Receiver, _Args>&> - && constructible_from<_Fun, __copy_cvref_t<_Self, _Fun>> - && constructible_from<_Args, __copy_cvref_t<_Self, _Args>> + && constructible_from<_Fun, __copy_cvref_t<_Self, _Fun>> + && constructible_from<_Args, __copy_cvref_t<_Self, _Args>> static auto connect(_Self&& __self, _Receiver __rcvr) -> stdexec::__t<__operation, _Fun, _ArgsId>> { static_assert(__nothrow_callable<_Fun, __context<_Receiver, _Args>&>); @@ -94,7 +89,7 @@ namespace exec { struct __create_t { template requires move_constructible<_Fun> - && constructible_from<__decayed_std_tuple<_Args...>, _Args...> + && constructible_from<__decayed_std_tuple<_Args...>, _Args...> auto operator()(_Fun __fun, _Args&&... __args) const -> __t<__sender<_Fun, __id<__decayed_std_tuple<_Args...>>, _Sigs...>> { return {static_cast<_Fun&&>(__fun), {static_cast<_Args&&>(__args)...}}; diff --git a/include/exec/env.hpp b/include/exec/env.hpp index df3fd8f19..a610f0d9c 100644 --- a/include/exec/env.hpp +++ b/include/exec/env.hpp @@ -77,8 +77,7 @@ namespace exec { struct __t : __immovable { using __id = __operation; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Default __default_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Default __default_; _Receiver __rcvr_; void start() & noexcept { @@ -105,8 +104,7 @@ namespace exec { using __id = __sender; using __t = __sender; using sender_concept = stdexec::sender_t; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Default __default_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Default __default_; template using __value_t = diff --git a/include/exec/finally.hpp b/include/exec/finally.hpp index a37f3d7d6..0caf6a781 100644 --- a/include/exec/finally.hpp +++ b/include/exec/finally.hpp @@ -296,9 +296,7 @@ namespace exec { } template - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(_Final&& __final) const -> __binder_back> { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(_Final&& __final) const -> __binder_back> { return {{static_cast<_Final&&>(__final)}, {}, {}}; } diff --git a/include/exec/into_tuple.hpp b/include/exec/into_tuple.hpp index f0d9a7f7a..1a15aaa08 100644 --- a/include/exec/into_tuple.hpp +++ b/include/exec/into_tuple.hpp @@ -101,9 +101,7 @@ namespace exec { __domain, __make_sexpr({}, static_cast<_Sender &&>(__sndr))); } - STDEXEC_ATTRIBUTE((always_inline)) - constexpr auto - operator()() const noexcept -> __binder_back { + STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()() const noexcept -> __binder_back { return {{}, {}, {}}; } }; diff --git a/include/exec/just_from.hpp b/include/exec/just_from.hpp index 1006a90cd..496c6ef50 100644 --- a/include/exec/just_from.hpp +++ b/include/exec/just_from.hpp @@ -68,9 +68,7 @@ namespace exec { Rcvr& _rcvr; template - STDEXEC_ATTRIBUTE((always_inline, host, device)) - void - operator()(Ts&&... ts) const noexcept { + STDEXEC_ATTRIBUTE((always_inline, host, device)) void operator()(Ts&&... ts) const noexcept { _set_tag_t()(static_cast(_rcvr), static_cast(ts)...); } }; @@ -82,9 +80,7 @@ namespace exec { Rcvr _rcvr; Fn _fn; - STDEXEC_ATTRIBUTE((host, device)) - void - start() & noexcept { + STDEXEC_ATTRIBUTE((host, device)) void start() & noexcept { if constexpr (stdexec::__nothrow_callable>) { static_cast(_fn)(_complete_fn{_rcvr}); } else { @@ -123,22 +119,17 @@ namespace exec { using sender_concept = stdexec::sender_t; using completion_signatures = _completions; - STDEXEC_ATTRIBUTE((no_unique_address)) - JustTag _tag; + STDEXEC_ATTRIBUTE((no_unique_address)) JustTag _tag; Fn _fn; template - STDEXEC_ATTRIBUTE((host, device)) - auto - connect(Rcvr rcvr) && // + STDEXEC_ATTRIBUTE((host, device)) auto connect(Rcvr rcvr) && // noexcept(stdexec::__nothrow_decay_copyable) -> _opstate { return _opstate{static_cast(rcvr), static_cast(_fn)}; } template - STDEXEC_ATTRIBUTE((host, device)) - auto - connect(Rcvr rcvr) const & // + STDEXEC_ATTRIBUTE((host, device)) auto connect(Rcvr rcvr) const & // noexcept(stdexec::__nothrow_decay_copyable) -> _opstate { return _opstate{static_cast(rcvr), _fn}; } @@ -149,9 +140,7 @@ namespace exec { public: template - STDEXEC_ATTRIBUTE((always_inline, host, device)) - auto - operator()(Fn fn) const noexcept { + STDEXEC_ATTRIBUTE((always_inline, host, device)) auto operator()(Fn fn) const noexcept { if constexpr (stdexec::__callable) { using _completions = stdexec::__call_result_t; static_assert( diff --git a/include/exec/linux/__detail/memory_mapped_region.hpp b/include/exec/linux/__detail/memory_mapped_region.hpp index ce6b936b9..12f536f75 100644 --- a/include/exec/linux/__detail/memory_mapped_region.hpp +++ b/include/exec/linux/__detail/memory_mapped_region.hpp @@ -42,8 +42,8 @@ namespace exec { , __size_(std::exchange(__other.__size_, 0)) { } - inline auto memory_mapped_region::operator=( - memory_mapped_region&& __other) noexcept -> memory_mapped_region& { + inline auto memory_mapped_region::operator=(memory_mapped_region&& __other) noexcept + -> memory_mapped_region& { if (this != &__other) { if (__ptr_) { ::munmap(__ptr_, __size_); diff --git a/include/exec/linux/__detail/safe_file_descriptor.hpp b/include/exec/linux/__detail/safe_file_descriptor.hpp index b3aee1258..c5c63af6a 100644 --- a/include/exec/linux/__detail/safe_file_descriptor.hpp +++ b/include/exec/linux/__detail/safe_file_descriptor.hpp @@ -30,8 +30,8 @@ namespace exec { : __fd_(std::exchange(__other.__fd_, -1)) { } - inline auto safe_file_descriptor::operator=( - safe_file_descriptor&& __other) noexcept -> safe_file_descriptor& { + inline auto safe_file_descriptor::operator=(safe_file_descriptor&& __other) noexcept + -> safe_file_descriptor& { if (this != &__other) { if (__fd_ != -1) { ::close(__fd_); diff --git a/include/exec/linux/io_uring_context.hpp b/include/exec/linux/io_uring_context.hpp index c13400e1c..59235ec54 100644 --- a/include/exec/linux/io_uring_context.hpp +++ b/include/exec/linux/io_uring_context.hpp @@ -275,8 +275,8 @@ namespace exec { // This function first completes all tasks that are ready in the completion queue of the io_uring. // Then it completes all tasks that are ready in the given queue of ready tasks. // The function returns the number of previously submitted completed tasks. - auto complete( - stdexec::__intrusive_queue<&__task::__next_> __ready = __task_queue{}) noexcept -> int { + auto complete(stdexec::__intrusive_queue<&__task::__next_> __ready = __task_queue{}) noexcept + -> int { __u32 __head = __head_.load(std::memory_order_relaxed); __u32 __tail = __tail_.load(std::memory_order_acquire); int __count = 0; @@ -654,7 +654,8 @@ namespace exec { requires(_Op& __op) { { static_cast<_Op&&>(__op).receiver() - } noexcept -> stdexec::receiver_of>; + } noexcept + -> stdexec::receiver_of>; }; template <__stoppable_task _Op> @@ -716,8 +717,7 @@ namespace exec { struct __impl { __context& __context_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __receiver_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __receiver_; __impl(__context& __context, _Receiver&& __receiver) : __context_{__context} diff --git a/include/exec/materialize.hpp b/include/exec/materialize.hpp index 99f961506..99e6217f3 100644 --- a/include/exec/materialize.hpp +++ b/include/exec/materialize.hpp @@ -121,9 +121,7 @@ namespace exec { return {static_cast<_Sender&&>(__sender)}; } - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()() const noexcept -> __binder_back<__materialize_t> { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()() const noexcept -> __binder_back<__materialize_t> { return {{}, {}, {}}; } }; @@ -228,14 +226,12 @@ namespace exec { using __sender_t = __t<__sender<__id<_Sender>>>; template - auto operator()(_Sender&& __sndr) const - noexcept(__nothrow_decay_copyable<_Sender>) -> __sender_t<_Sender> { + auto operator()(_Sender&& __sndr) const noexcept(__nothrow_decay_copyable<_Sender>) + -> __sender_t<_Sender> { return __sender_t<_Sender>(static_cast<_Sender&&>(__sndr)); } - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()() const noexcept -> __binder_back<__dematerialize_t> { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()() const noexcept -> __binder_back<__dematerialize_t> { return {{}, {}, {}}; } }; diff --git a/include/exec/on_coro_disposition.hpp b/include/exec/on_coro_disposition.hpp index e7c78cf99..0ec4fbea4 100644 --- a/include/exec/on_coro_disposition.hpp +++ b/include/exec/on_coro_disposition.hpp @@ -108,8 +108,8 @@ namespace exec { return false; } - static auto await_suspend( - __coro::coroutine_handle<__promise> __h) noexcept -> __coro::coroutine_handle<> { + static auto await_suspend(__coro::coroutine_handle<__promise> __h) noexcept + -> __coro::coroutine_handle<> { __promise& __p = __h.promise(); auto __coro = __p.__is_unhandled_stopped_ ? __p.continuation().unhandled_stopped() : __p.continuation().handle(); diff --git a/include/exec/repeat_effect_until.hpp b/include/exec/repeat_effect_until.hpp index 52d27b135..b79a195fe 100644 --- a/include/exec/repeat_effect_until.hpp +++ b/include/exec/repeat_effect_until.hpp @@ -196,9 +196,7 @@ namespace exec { __domain, __make_sexpr({}, static_cast<_Sender &&>(__sndr))); } - STDEXEC_ATTRIBUTE((always_inline)) - constexpr auto - operator()() const -> __binder_back { + STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()() const -> __binder_back { return {{}, {}, {}}; } diff --git a/include/exec/repeat_n.hpp b/include/exec/repeat_n.hpp index d9193afe6..560929a97 100644 --- a/include/exec/repeat_n.hpp +++ b/include/exec/repeat_n.hpp @@ -212,8 +212,7 @@ namespace exec { __domain, __make_sexpr(__count, static_cast<_Sender &&>(__sndr))); } - STDEXEC_ATTRIBUTE((always_inline)) - constexpr auto + STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()(std::size_t __count) const -> __binder_back { return {{__count}, {}, {}}; } diff --git a/include/exec/sequence.hpp b/include/exec/sequence.hpp index b60d2122f..9d84fc3e4 100644 --- a/include/exec/sequence.hpp +++ b/include/exec/sequence.hpp @@ -26,15 +26,11 @@ namespace exec { struct sequence_t { template - STDEXEC_ATTRIBUTE((nodiscard, host, device)) - Sndr - operator()(Sndr sndr) const; + STDEXEC_ATTRIBUTE((nodiscard, host, device)) Sndr operator()(Sndr sndr) const; template requires(sizeof...(Sndrs) > 1) && stdexec::__domain::__has_common_domain - STDEXEC_ATTRIBUTE((nodiscard, host, device)) - _sndr - operator()(Sndrs... sndrs) const; + STDEXEC_ATTRIBUTE((nodiscard, host, device)) _sndr operator()(Sndrs... sndrs) const; }; template @@ -44,29 +40,21 @@ namespace exec { _opstate_t* _opstate; template - STDEXEC_ATTRIBUTE((always_inline, host, device)) - void - set_value(Args&&... args) && noexcept { + STDEXEC_ATTRIBUTE((always_inline, host, device)) void set_value(Args&&... args) && noexcept { _opstate->_set_value(Index(), static_cast(args)...); } template - STDEXEC_ATTRIBUTE((host, device)) - void - set_error(Error&& err) && noexcept { + STDEXEC_ATTRIBUTE((host, device)) void set_error(Error&& err) && noexcept { stdexec::set_error(static_cast(_opstate->_rcvr), static_cast(err)); } - STDEXEC_ATTRIBUTE((host, device)) - void - set_stopped() && noexcept { + STDEXEC_ATTRIBUTE((host, device)) void set_stopped() && noexcept { stdexec::set_stopped(static_cast(_opstate->_rcvr)); } // TODO: use the predecessor's completion scheduler as the current scheduler here. - STDEXEC_ATTRIBUTE((host, device)) - stdexec::env_of_t - get_env() const noexcept { + STDEXEC_ATTRIBUTE((host, device)) stdexec::env_of_t get_env() const noexcept { return stdexec::get_env(_opstate->_rcvr); } }; @@ -98,8 +86,7 @@ namespace exec { stdexec::__make_indices>; template - STDEXEC_ATTRIBUTE((host, device)) - explicit _opstate(Rcvr&& rcvr, CvrefSndrs&& sndrs) + STDEXEC_ATTRIBUTE((host, device)) explicit _opstate(Rcvr&& rcvr, CvrefSndrs&& sndrs) : _rcvr{static_cast(rcvr)} , _sndrs{_senders_tuple_t::__convert_from(static_cast(sndrs))} // move all but the first sender into the opstate. @@ -114,9 +101,7 @@ namespace exec { } template - STDEXEC_ATTRIBUTE((host, device)) - void - _set_value(Index, [[maybe_unused]] Args&&... args) noexcept { + STDEXEC_ATTRIBUTE((host, device)) void _set_value(Index, [[maybe_unused]] Args&&... args) noexcept { try { constexpr size_t Idx = stdexec::__v + 1; if constexpr (Idx == sizeof...(Sndrs) + 1) { @@ -132,9 +117,7 @@ namespace exec { } } - STDEXEC_ATTRIBUTE((host, device)) - void - start() & noexcept { + STDEXEC_ATTRIBUTE((host, device)) void start() & noexcept { stdexec::start(_ops.template get<0>()); } @@ -192,38 +175,28 @@ namespace exec { template requires(stdexec::__decay_copyable> && ...) - STDEXEC_ATTRIBUTE((host, device)) - static auto - get_completion_signatures(Self&&, Env&&...) -> _completions_t { + STDEXEC_ATTRIBUTE((host, device)) static auto get_completion_signatures(Self&&, Env&&...) -> _completions_t { return {}; } template - STDEXEC_ATTRIBUTE((host, device)) - static auto - connect(Self&& self, Rcvr rcvr) { + STDEXEC_ATTRIBUTE((host, device)) static auto connect(Self&& self, Rcvr rcvr) { return _opstate{static_cast(rcvr), static_cast(self)._sndrs}; } - STDEXEC_ATTRIBUTE((no_unique_address, maybe_unused)) - sequence_t _tag; // - STDEXEC_ATTRIBUTE((no_unique_address, maybe_unused)) - stdexec::__ignore _ignore; // + STDEXEC_ATTRIBUTE((no_unique_address, maybe_unused)) sequence_t _tag; // + STDEXEC_ATTRIBUTE((no_unique_address, maybe_unused)) stdexec::__ignore _ignore; // stdexec::__tuple_for _sndrs; }; template - STDEXEC_ATTRIBUTE((host, device)) - Sndr - sequence_t::operator()(Sndr sndr) const { + STDEXEC_ATTRIBUTE((host, device)) Sndr sequence_t::operator()(Sndr sndr) const { return sndr; } template requires(sizeof...(Sndrs) > 1) && stdexec::__domain::__has_common_domain - STDEXEC_ATTRIBUTE((host, device)) - _sndr - sequence_t::operator()(Sndrs... sndrs) const { + STDEXEC_ATTRIBUTE((host, device)) _sndr sequence_t::operator()(Sndrs... sndrs) const { return _sndr{{}, {}, {{static_cast(sndrs)}...}}; } } // namespace _seq diff --git a/include/exec/sequence/any_sequence_of.hpp b/include/exec/sequence/any_sequence_of.hpp index b92fc6705..2d1d34425 100644 --- a/include/exec/sequence/any_sequence_of.hpp +++ b/include/exec/sequence/any_sequence_of.hpp @@ -66,7 +66,7 @@ namespace exec { template requires sequence_receiver_of<_Rcvr, __item_types> - && (__callable<__query_vfun_fn<_Rcvr>, _Queries> && ...) + && (__callable<__query_vfun_fn<_Rcvr>, _Queries> && ...) STDEXEC_MEMFN_DECL( auto __create_vtable)(this __mtype<__t>, __mtype<_Rcvr>) noexcept -> const __t* { static const __t __vtable_{ @@ -306,8 +306,7 @@ namespace exec { template _Self, stdexec::sender _Sender> requires stdexec::__callable - STDEXEC_MEMFN_DECL( - auto set_next)(this _Self& __self, _Sender&& __sender) { + STDEXEC_MEMFN_DECL(auto set_next)(this _Self& __self, _Sender&& __sender) { return exec::set_next(__self.__receiver_, static_cast<_Sender&&>(__sender)); } diff --git a/include/exec/sequence/empty_sequence.hpp b/include/exec/sequence/empty_sequence.hpp index b79539db5..5cd2c5b9b 100644 --- a/include/exec/sequence/empty_sequence.hpp +++ b/include/exec/sequence/empty_sequence.hpp @@ -31,8 +31,7 @@ namespace exec { struct __t { using __id = __operation; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __rcvr_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_; void start() & noexcept { stdexec::set_value(static_cast<_Receiver&&>(__rcvr_)); @@ -48,7 +47,8 @@ namespace exec { using item_types = exec::item_types<>; template <__decays_to<__t> _Self, receiver_of _Rcvr> - STDEXEC_MEMFN_DECL(auto subscribe)(this _Self&&, _Rcvr __rcvr) noexcept(__nothrow_move_constructible<_Rcvr>) { + STDEXEC_MEMFN_DECL( + auto subscribe)(this _Self&&, _Rcvr __rcvr) noexcept(__nothrow_move_constructible<_Rcvr>) { return stdexec::__t<__operation>>{static_cast<_Rcvr&&>(__rcvr)}; } }; diff --git a/include/exec/sequence/ignore_all_values.hpp b/include/exec/sequence/ignore_all_values.hpp index de3f80c1d..f729a54e5 100644 --- a/include/exec/sequence/ignore_all_values.hpp +++ b/include/exec/sequence/ignore_all_values.hpp @@ -74,8 +74,7 @@ namespace exec { template struct __item_operation_base { - STDEXEC_ATTRIBUTE((no_unique_address)) - _ItemReceiver __receiver_; + STDEXEC_ATTRIBUTE((no_unique_address)) _ItemReceiver __receiver_; __result_type<_ResultVariant>* __result_; }; @@ -175,8 +174,7 @@ namespace exec { template struct __operation_base : __result_type<_ResultVariant> { - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __receiver_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __receiver_; }; template @@ -275,7 +273,7 @@ namespace exec { template requires receiver_of<_Receiver, __completion_sigs<_Child>> - && sequence_sender_to<_Child, __receiver_t<_Child>> + && sequence_sender_to<_Child, __receiver_t<_Child>> auto operator()(__ignore, __ignore, _Child&& __child) // noexcept(__nothrow_constructible_from<__operation_t<_Child>, _Child, _Receiver>) -> __operation_t<_Child> { @@ -291,9 +289,7 @@ namespace exec { __domain, __make_sexpr(__(), static_cast<_Sender&&>(__sndr))); } - STDEXEC_ATTRIBUTE((always_inline)) - constexpr auto - operator()() const noexcept -> __binder_back { + STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()() const noexcept -> __binder_back { return {{}, {}, {}}; } }; diff --git a/include/exec/sequence/iterate.hpp b/include/exec/sequence/iterate.hpp index 012bd627b..c58cf7175 100644 --- a/include/exec/sequence/iterate.hpp +++ b/include/exec/sequence/iterate.hpp @@ -37,10 +37,8 @@ namespace exec { template struct __operation_base { - STDEXEC_ATTRIBUTE((no_unique_address)) - _Iterator __iterator_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Sentinel __sentinel_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Iterator __iterator_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Sentinel __sentinel_; }; template @@ -51,8 +49,7 @@ namespace exec { struct __item_operation { struct __t { using __id = __item_operation; - STDEXEC_ATTRIBUTE((no_unique_address)) - _ItemRcvr __rcvr_; + STDEXEC_ATTRIBUTE((no_unique_address)) _ItemRcvr __rcvr_; __operation_base<_Iterator, _Sentinel>* __parent_; void start() & noexcept { diff --git a/include/exec/sequence/transform_each.hpp b/include/exec/sequence/transform_each.hpp index 84593cd19..8eb531e3c 100644 --- a/include/exec/sequence/transform_each.hpp +++ b/include/exec/sequence/transform_each.hpp @@ -43,7 +43,7 @@ namespace exec { template _SetNext, same_as<__t> _Self, class _Item> requires __callable<_Adaptor&, _Item> - && __callable> + && __callable> friend auto tag_invoke(_SetNext, _Self& __self, _Item&& __item) // noexcept( __nothrow_callable<_SetNext, _Receiver&, __call_result_t<_Adaptor&, _Item>> // @@ -153,8 +153,7 @@ namespace exec { } template - STDEXEC_ATTRIBUTE((always_inline)) - constexpr auto + STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()(_Adaptor __adaptor) const noexcept -> __binder_back { return {{static_cast<_Adaptor&&>(__adaptor)}, {}, {}}; } @@ -190,8 +189,8 @@ namespace exec { requires __callabale_adaptor_for< __data_of<_Self>, item_types_of_t<__child_of<_Self>, env_of_t<_Receiver>>> - && sequence_receiver_of<_Receiver, __item_types_t<_Self, env_of_t<_Receiver>>> - && sequence_sender_to<__child_of<_Self>, __receiver_t<_Self, _Receiver>> + && sequence_receiver_of<_Receiver, __item_types_t<_Self, env_of_t<_Receiver>>> + && sequence_sender_to<__child_of<_Self>, __receiver_t<_Self, _Receiver>> static auto subscribe(_Self&& __self, _Receiver __rcvr) // noexcept(__nothrow_callable<__sexpr_apply_t, _Self, __subscribe_fn<_Receiver>>) -> __call_result_t<__sexpr_apply_t, _Self, __subscribe_fn<_Receiver>> { diff --git a/include/exec/sequence_senders.hpp b/include/exec/sequence_senders.hpp index 64a5ea3f7..460bdb29e 100644 --- a/include/exec/sequence_senders.hpp +++ b/include/exec/sequence_senders.hpp @@ -83,8 +83,7 @@ namespace exec { using __id = __stopped_means_break; using _Receiver = stdexec::__t<_ReceiverId>; using _Token = stop_token_of_t>; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __rcvr_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __rcvr_; auto get_env() const noexcept -> env_of_t<_Receiver> { return stdexec::get_env(__rcvr_); @@ -347,8 +346,8 @@ namespace exec { template requires __next_connectable<__tfx_sndr<_Sender, _Receiver>, _Receiver> - || __subscribeable_with_tag_invoke<__tfx_sndr<_Sender, _Receiver>, _Receiver> - || __is_debug_env> + || __subscribeable_with_tag_invoke<__tfx_sndr<_Sender, _Receiver>, _Receiver> + || __is_debug_env> auto operator()(_Sender&& __sndr, _Receiver&& __rcvr) const noexcept(__nothrow_callable<__select_impl_t<_Sender, _Receiver>>) -> __call_result_t<__select_impl_t<_Sender, _Receiver>> { diff --git a/include/exec/start_now.hpp b/include/exec/start_now.hpp index 04c2f7195..8e805bd76 100644 --- a/include/exec/start_now.hpp +++ b/include/exec/start_now.hpp @@ -148,8 +148,9 @@ namespace exec { using connect_t = stdexec::connect_t; template _Receiver> - auto connect(_Receiver __rcvr) const noexcept( - stdexec::__nothrow_move_constructible<_Receiver>) -> __operation<_EnvId, _Receiver> { + auto + connect(_Receiver __rcvr) const noexcept(stdexec::__nothrow_move_constructible<_Receiver>) + -> __operation<_EnvId, _Receiver> { return {__stg_, static_cast<_Receiver&&>(__rcvr)}; } diff --git a/include/exec/static_thread_pool.hpp b/include/exec/static_thread_pool.hpp index 97636b1bb..132e79ed9 100644 --- a/include/exec/static_thread_pool.hpp +++ b/include/exec/static_thread_pool.hpp @@ -880,8 +880,8 @@ namespace exec { return result; } - inline auto - static_thread_pool_::thread_state::try_pop() -> static_thread_pool_::thread_state::pop_result { + inline auto static_thread_pool_::thread_state::try_pop() + -> static_thread_pool_::thread_state::pop_result { pop_result result{nullptr, index_}; result.task = local_queue_.pop_back(); if (result.task) [[likely]] { @@ -890,8 +890,8 @@ namespace exec { return try_remote(); } - inline auto static_thread_pool_::thread_state::try_steal( - std::span victims) -> static_thread_pool_::thread_state::pop_result { + inline auto static_thread_pool_::thread_state::try_steal(std::span victims) + -> static_thread_pool_::thread_state::pop_result { if (victims.empty()) { return {nullptr, index_}; } @@ -1239,7 +1239,6 @@ namespace exec { } }; - //! A customized receiver to allow parallel execution of `stdexec::bulk` operations: template struct static_thread_pool_::bulk_receiver::__t { @@ -1405,8 +1404,8 @@ namespace exec { struct env { static_thread_pool_* pool_; - auto query( - get_completion_scheduler_t) noexcept -> static_thread_pool_::scheduler { + auto query(get_completion_scheduler_t) noexcept + -> static_thread_pool_::scheduler { return pool_->get_scheduler(); } }; diff --git a/include/exec/task.hpp b/include/exec/task.hpp index 58570d289..32cb2e067 100644 --- a/include/exec/task.hpp +++ b/include/exec/task.hpp @@ -99,8 +99,7 @@ namespace exec { static constexpr bool __with_scheduler = _SchedulerAffinity == __scheduler_affinity::__sticky; - STDEXEC_ATTRIBUTE((no_unique_address)) - __if_c<__with_scheduler, __any_scheduler, __ignore> // + STDEXEC_ATTRIBUTE((no_unique_address)) __if_c<__with_scheduler, __any_scheduler, __ignore> // __scheduler_{exec::inline_scheduler{}}; inplace_stop_token __stop_token_; @@ -323,8 +322,8 @@ namespace exec { return false; } - static auto await_suspend( - __coro::coroutine_handle<__promise> __h) noexcept -> __coro::coroutine_handle<> { + static auto await_suspend(__coro::coroutine_handle<__promise> __h) noexcept + -> __coro::coroutine_handle<> { return __h.promise().continuation().handle(); } @@ -454,11 +453,10 @@ namespace exec { // Make this task awaitable within a particular context: template requires constructible_from< - awaiter_context_t<__promise, _ParentPromise>, - __promise_context_t&, - _ParentPromise&> - STDEXEC_MEMFN_DECL( - auto as_awaitable)(this basic_task&& __self, _ParentPromise&) noexcept + awaiter_context_t<__promise, _ParentPromise>, + __promise_context_t&, + _ParentPromise&> + STDEXEC_MEMFN_DECL(auto as_awaitable)(this basic_task&& __self, _ParentPromise&) noexcept -> __task_awaitable<_ParentPromise> { return __task_awaitable<_ParentPromise>{std::exchange(__self.__coro_, {})}; } diff --git a/include/exec/timed_thread_scheduler.hpp b/include/exec/timed_thread_scheduler.hpp index 81dc92112..8fd32c0d3 100644 --- a/include/exec/timed_thread_scheduler.hpp +++ b/include/exec/timed_thread_scheduler.hpp @@ -354,7 +354,9 @@ namespace exec { return std::chrono::steady_clock::now(); } - STDEXEC_MEMFN_DECL(auto schedule_at)(this const timed_thread_scheduler& self, time_point tp) noexcept -> schedule_at { + STDEXEC_MEMFN_DECL( + auto + schedule_at)(this const timed_thread_scheduler& self, time_point tp) noexcept -> schedule_at { return schedule_at{*self.context_, tp}; } diff --git a/include/exec/trampoline_scheduler.hpp b/include/exec/trampoline_scheduler.hpp index aed5bfd6e..0617b028d 100644 --- a/include/exec/trampoline_scheduler.hpp +++ b/include/exec/trampoline_scheduler.hpp @@ -96,8 +96,7 @@ namespace exec { struct __t : __operation_base { using __id = __operation; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Receiver __receiver_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Receiver __receiver_; explicit __t(_Receiver __rcvr, std::size_t __max_depth) // noexcept(__nothrow_move_constructible<_Receiver>) diff --git a/include/exec/when_any.hpp b/include/exec/when_any.hpp index afc89fc6a..18413981f 100644 --- a/include/exec/when_any.hpp +++ b/include/exec/when_any.hpp @@ -269,8 +269,8 @@ namespace exec { } template <__decays_to<__t> _Self, class... _Env> - static auto - get_completion_signatures(_Self&&, _Env&&...) noexcept -> __completions_t<_Self, _Env...> { + static auto get_completion_signatures(_Self&&, _Env&&...) noexcept + -> __completions_t<_Self, _Env...> { return {}; } diff --git a/include/execpools/thread_pool_base.hpp b/include/execpools/thread_pool_base.hpp index 9d29d1c97..11967615b 100644 --- a/include/execpools/thread_pool_base.hpp +++ b/include/execpools/thread_pool_base.hpp @@ -384,7 +384,8 @@ namespace execpools { STDEXEC_MEMFN_FRIEND(bulk); template - STDEXEC_MEMFN_DECL(auto bulk)(this const scheduler& sch, S&& sndr, Shape shape, Fun fun) noexcept + STDEXEC_MEMFN_DECL( + auto bulk)(this const scheduler& sch, S&& sndr, Shape shape, Fun fun) noexcept -> bulk_sender_t { return bulk_sender_t{ *sch.pool_, static_cast(sndr), shape, static_cast(fun)}; diff --git a/include/nvexec/detail/queue.cuh b/include/nvexec/detail/queue.cuh index 85aab37e0..6bcae6348 100644 --- a/include/nvexec/detail/queue.cuh +++ b/include/nvexec/detail/queue.cuh @@ -43,7 +43,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { namespace queue { STDEXEC_ATTRIBUTE((host, device)) - void operator()(task_base_t* task) { + void + operator()(task_base_t* task) { atom_task_ref tail_ref(*tail_); task_base_t* old_tail = tail_ref.load(::cuda::memory_order_acquire); diff --git a/include/nvexec/detail/variant.cuh b/include/nvexec/detail/variant.cuh index 59e493b1e..792844f1d 100644 --- a/include/nvexec/detail/variant.cuh +++ b/include/nvexec/detail/variant.cuh @@ -106,26 +106,22 @@ namespace nvexec { }; template - STDEXEC_ATTRIBUTE((host, device)) - void - visit_impl( - std::integral_constant, - VisitorT&& visitor, - V&& v, - std::size_t index) { + STDEXEC_ATTRIBUTE((host, device)) void visit_impl( + std::integral_constant, + VisitorT&& visitor, + V&& v, + std::size_t index) { if (0 == index) { static_cast(visitor)((static_cast(v)).template get<0>()); } } template - STDEXEC_ATTRIBUTE((host, device)) - void - visit_impl( - std::integral_constant, - VisitorT&& visitor, - V&& v, - std::size_t index) { + STDEXEC_ATTRIBUTE((host, device)) void visit_impl( + std::integral_constant, + VisitorT&& visitor, + V&& v, + std::size_t index) { if (I == index) { static_cast(visitor)((static_cast(v)).template get()); return; @@ -140,9 +136,7 @@ namespace nvexec { } // namespace detail template - STDEXEC_ATTRIBUTE((host, device)) - void - visit(VisitorT&& visitor, V&& v) { + STDEXEC_ATTRIBUTE((host, device)) void visit(VisitorT&& visitor, V&& v) { detail::visit_impl( std::integral_constant::size - 1>{}, static_cast(visitor), @@ -151,9 +145,7 @@ namespace nvexec { } template - STDEXEC_ATTRIBUTE((host, device)) - void - visit(VisitorT&& visitor, V&& v, std::size_t index) { + STDEXEC_ATTRIBUTE((host, device)) void visit(VisitorT&& visitor, V&& v, std::size_t index) { detail::visit_impl( std::integral_constant::size - 1>{}, static_cast(visitor), @@ -176,56 +168,43 @@ namespace nvexec { using index_of = std::integral_constant()>; template T> - STDEXEC_ATTRIBUTE((host, device)) - T& get() noexcept { + STDEXEC_ATTRIBUTE((host, device)) T& get() noexcept { void* data = storage_.data_; return *static_cast(data); } template - STDEXEC_ATTRIBUTE((host, device)) - detail::nth_type& - get() noexcept { + STDEXEC_ATTRIBUTE((host, device)) detail::nth_type& get() noexcept { return get>(); } - STDEXEC_ATTRIBUTE((host, device)) - variant_t() + STDEXEC_ATTRIBUTE((host, device)) variant_t() requires std::default_initializable { emplace(); } - STDEXEC_ATTRIBUTE((host, device)) - ~variant_t() { + STDEXEC_ATTRIBUTE((host, device)) ~variant_t() { destroy(); } - STDEXEC_ATTRIBUTE((host, device)) - bool - holds_alternative() const { + STDEXEC_ATTRIBUTE((host, device)) bool holds_alternative() const { return index_ != detail::npos(); } template T, class... As> - STDEXEC_ATTRIBUTE((host, device)) - void - emplace(As&&... as) { + STDEXEC_ATTRIBUTE((host, device)) void emplace(As&&... as) { destroy(); construct(static_cast(as)...); } template T, class... As> - STDEXEC_ATTRIBUTE((host, device)) - void - construct(As&&... as) { + STDEXEC_ATTRIBUTE((host, device)) void construct(As&&... as) { ::new (storage_.data_) T(static_cast(as)...); index_ = index_of(); } - STDEXEC_ATTRIBUTE((host, device)) - void - destroy() { + STDEXEC_ATTRIBUTE((host, device)) void destroy() { if (holds_alternative()) { visit( [](auto& val) noexcept { diff --git a/include/nvexec/multi_gpu_context.cuh b/include/nvexec/multi_gpu_context.cuh index 5a5f7f645..cd3d805c1 100644 --- a/include/nvexec/multi_gpu_context.cuh +++ b/include/nvexec/multi_gpu_context.cuh @@ -142,12 +142,16 @@ namespace nvexec { } template - STDEXEC_MEMFN_DECL(upon_error_sender_th upon_error)(this const multi_gpu_stream_scheduler& sch, S&& sndr, Fn fun) noexcept { + STDEXEC_MEMFN_DECL( + upon_error_sender_th + upon_error)(this const multi_gpu_stream_scheduler& sch, S&& sndr, Fn fun) noexcept { return upon_error_sender_th{{}, static_cast(sndr), static_cast(fun)}; } template - STDEXEC_MEMFN_DECL(upon_stopped_sender_th upon_stopped)(this const multi_gpu_stream_scheduler& sch, S&& sndr, Fn fun) noexcept { + STDEXEC_MEMFN_DECL( + upon_stopped_sender_th + upon_stopped)(this const multi_gpu_stream_scheduler& sch, S&& sndr, Fn fun) noexcept { return upon_stopped_sender_th{{}, static_cast(sndr), static_cast(fun)}; } @@ -180,7 +184,8 @@ namespace nvexec { } template - STDEXEC_MEMFN_DECL(split_sender_th split)(this const multi_gpu_stream_scheduler& sch, S&& sndr) noexcept { + STDEXEC_MEMFN_DECL( + split_sender_th split)(this const multi_gpu_stream_scheduler& sch, S&& sndr) noexcept { return split_sender_th(static_cast(sndr), sch.context_state_); } diff --git a/include/nvexec/nvtx.cuh b/include/nvexec/nvtx.cuh index 9d59e46d4..35e28ad1e 100644 --- a/include/nvexec/nvtx.cuh +++ b/include/nvexec/nvtx.cuh @@ -133,9 +133,7 @@ namespace nvexec { return nvtx_sender_th{{}, static_cast(sndr), std::move(name)}; } - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(std::string name) const -> stdexec::__binder_back { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(std::string name) const -> stdexec::__binder_back { return {{std::move(name)}, {}, {}}; } }; @@ -146,9 +144,7 @@ namespace nvexec { return nvtx_sender_th{{}, static_cast(sndr), {}}; } - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()() const noexcept -> stdexec::__binder_back { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()() const noexcept -> stdexec::__binder_back { return {{}, {}, {}}; } }; @@ -163,9 +159,7 @@ namespace nvexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(std::string name, Closure closure) const + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(std::string name, Closure closure) const -> stdexec::__binder_back { return { {std::move(name), static_cast(closure)}, diff --git a/include/nvexec/stream/algorithm_base.cuh b/include/nvexec/stream/algorithm_base.cuh index 4956e8598..314d9d820 100644 --- a/include/nvexec/stream/algorithm_base.cuh +++ b/include/nvexec/stream/algorithm_base.cuh @@ -61,10 +61,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS::__algo_range_init_fun { }; operation_state_base_t& op_state_; - STDEXEC_ATTRIBUTE((no_unique_address)) - InitT init_; - STDEXEC_ATTRIBUTE((no_unique_address)) - Fun fun_; + STDEXEC_ATTRIBUTE((no_unique_address)) InitT init_; + STDEXEC_ATTRIBUTE((no_unique_address)) Fun fun_; public: using __id = receiver_t; @@ -110,10 +108,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS::__algo_range_init_fun { using _set_value_t = typename DerivedSender::template _set_value_t; Sender sndr_; - STDEXEC_ATTRIBUTE((no_unique_address)) - InitT init_; - STDEXEC_ATTRIBUTE((no_unique_address)) - Fun fun_; + STDEXEC_ATTRIBUTE((no_unique_address)) InitT init_; + STDEXEC_ATTRIBUTE((no_unique_address)) Fun fun_; template using completion_signatures = // diff --git a/include/nvexec/stream/bulk.cuh b/include/nvexec/stream/bulk.cuh index e17fc614c..be9212bb1 100644 --- a/include/nvexec/stream/bulk.cuh +++ b/include/nvexec/stream/bulk.cuh @@ -110,7 +110,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { template using _completion_signatures_t = // transform_completion_signatures< - __completion_signatures_of_t< __copy_cvref_t, Env...>, + __completion_signatures_of_t<__copy_cvref_t, Env...>, _set_error_t, _set_value_t>; @@ -128,7 +128,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { } template <__decays_to<__t> Self, class... Env> - static auto get_completion_signatures(Self&&, Env&&...) -> _completion_signatures_t { + static auto + get_completion_signatures(Self&&, Env&&...) -> _completion_signatures_t { return {}; } @@ -276,14 +277,14 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { Fun fun, context_state_t context_state) : operation_base_t( - static_cast(__sndr), - static_cast<_Receiver2&&>(__rcvr), - [&](operation_state_base_t>&) - -> stdexec::__t> { - return stdexec::__t>( - shape, fun, *this); - }, - context_state) + static_cast(__sndr), + static_cast<_Receiver2&&>(__rcvr), + [&](operation_state_base_t>&) + -> stdexec::__t> { + return stdexec::__t>( + shape, fun, *this); + }, + context_state) , num_devices_(num_devices) , streams_(new cudaStream_t[num_devices_]) , ready_to_complete_(new cudaEvent_t[num_devices_]) { @@ -339,7 +340,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { template using _completion_signatures_t = // transform_completion_signatures< - __completion_signatures_of_t< __copy_cvref_t, Env...>, + __completion_signatures_of_t<__copy_cvref_t, Env...>, _set_error_t, _set_value_t>; @@ -360,7 +361,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { } template <__decays_to<__t> Self, class... Env> - static auto get_completion_signatures(Self&&, Env&&...) -> _completion_signatures_t { + static auto + get_completion_signatures(Self&&, Env&&...) -> _completion_signatures_t { return {}; } diff --git a/include/nvexec/stream/common.cuh b/include/nvexec/stream/common.cuh index 59b6df8c8..984358c20 100644 --- a/include/nvexec/stream/common.cuh +++ b/include/nvexec/stream/common.cuh @@ -59,9 +59,7 @@ namespace nvexec { } #endif - inline STDEXEC_ATTRIBUTE((host, device)) - bool - is_on_gpu() noexcept { + inline STDEXEC_ATTRIBUTE((host, device)) bool is_on_gpu() noexcept { return get_device_type() == device_type::device; } } // namespace nvexec @@ -77,7 +75,7 @@ namespace nvexec { #else template concept trivially_copyable = - ((STDEXEC_IS_TRIVIALLY_COPYABLE(Ts) || std::is_reference_v) &&...); + ((STDEXEC_IS_TRIVIALLY_COPYABLE(Ts) || std::is_reference_v) && ...); #endif inline std::pair get_stream_priority(stream_priority priority) { @@ -266,18 +264,14 @@ namespace nvexec { return tag_invoke(get_stream_provider_t{}, env); } - STDEXEC_ATTRIBUTE((host, device)) - static constexpr auto - query(stdexec::forwarding_query_t) noexcept -> bool { + STDEXEC_ATTRIBUTE((host, device)) static constexpr auto query(stdexec::forwarding_query_t) noexcept -> bool { return true; } }; struct set_noop { template - STDEXEC_ATTRIBUTE((host, device)) - void - operator()(Ts&&...) const noexcept { + STDEXEC_ATTRIBUTE((host, device)) void operator()(Ts&&...) const noexcept { // TODO TRAP std::printf("ERROR: use of empty variant."); } @@ -305,15 +299,11 @@ namespace nvexec { return get_stream_provider(env)->own_stream_.value(); } - STDEXEC_ATTRIBUTE((host, device)) - auto - operator()() const noexcept { + STDEXEC_ATTRIBUTE((host, device)) auto operator()() const noexcept { return stdexec::read(*this); } - STDEXEC_ATTRIBUTE((host, device)) - static constexpr auto - query(stdexec::forwarding_query_t) noexcept -> bool { + STDEXEC_ATTRIBUTE((host, device)) static constexpr auto query(stdexec::forwarding_query_t) noexcept -> bool { return true; } }; @@ -380,25 +370,19 @@ namespace nvexec { using __id = stream_enqueue_receiver; template - STDEXEC_ATTRIBUTE((host, device)) - void - set_value(As&&... as) noexcept { + STDEXEC_ATTRIBUTE((host, device)) void set_value(As&&... as) noexcept { variant_->template emplace>( set_value_t(), static_cast(as)...); producer_(task_); } - STDEXEC_ATTRIBUTE((host, device)) - void - set_stopped() noexcept { + STDEXEC_ATTRIBUTE((host, device)) void set_stopped() noexcept { variant_->template emplace>(set_stopped_t()); producer_(task_); } template - STDEXEC_ATTRIBUTE((host, device)) - void - set_error(Error&& err) noexcept { + STDEXEC_ATTRIBUTE((host, device)) void set_error(Error&& err) noexcept { if constexpr (__decays_to) { // What is `exception_ptr` but death pending variant_->template emplace>( @@ -687,18 +671,20 @@ namespace nvexec { : base_t(static_cast(out_receiver), context_state) , storage_( make_host(this->stream_provider_.status_, context_state.pinned_resource_)) - , task_(make_host( - this->stream_provider_.status_, - context_state.pinned_resource_, - receiver_provider(*this), - storage_.get(), - this->get_stream(), - context_state.pinned_resource_) - .release()) - , env_(make_host( - this->stream_provider_.status_, - context_state.pinned_resource_, - this->make_env())) + , task_( + make_host( + this->stream_provider_.status_, + context_state.pinned_resource_, + receiver_provider(*this), + storage_.get(), + this->get_stream(), + context_state.pinned_resource_) + .release()) + , env_( + make_host( + this->stream_provider_.status_, + context_state.pinned_resource_, + this->make_env())) , inner_op_{connect( static_cast(sender), stream_enqueue_receiver_t{ diff --git a/include/nvexec/stream/continues_on.cuh b/include/nvexec/stream/continues_on.cuh index 13c0ca77c..ce969e6aa 100644 --- a/include/nvexec/stream/continues_on.cuh +++ b/include/nvexec/stream/continues_on.cuh @@ -87,14 +87,15 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { : operation_state_base_t(static_cast(rcvr), context_state) , context_state_(context_state) , storage_(make_host(this->status_, context_state.pinned_resource_)) - , task_(make_host( - this->status_, - context_state.pinned_resource_, - receiver_t{*this}, - storage_.get(), - this->get_stream(), - context_state.pinned_resource_) - .release()) + , task_( + make_host( + this->status_, + context_state.pinned_resource_, + receiver_t{*this}, + storage_.get(), + this->get_stream(), + context_state.pinned_resource_) + .release()) , env_(make_host(this->status_, context_state_.pinned_resource_, this->make_env())) , inner_op_{connect( static_cast(sender), diff --git a/include/nvexec/stream/ensure_started.cuh b/include/nvexec/stream/ensure_started.cuh index 34441bafc..3eab8e2b1 100644 --- a/include/nvexec/stream/ensure_started.cuh +++ b/include/nvexec/stream/ensure_started.cuh @@ -170,14 +170,15 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { : context_state_(context_state) , stream_provider_(false, context_state) , data_(malloc_managed(stream_provider_.status_)) - , task_(make_host( - stream_provider_.status_, - context_state.pinned_resource_, - inner_receiver_t{*this}, - data_, - stream_provider_.own_stream_.value(), - context_state.pinned_resource_) - .release()) + , task_( + make_host( + stream_provider_.status_, + context_state.pinned_resource_, + inner_receiver_t{*this}, + data_, + stream_provider_.own_stream_.value(), + context_state.pinned_resource_) + .release()) , env_( make_host(this->stream_provider_.status_, context_state_.pinned_resource_, make_env())) , op_state2_(connect( diff --git a/include/nvexec/stream/launch.cuh b/include/nvexec/stream/launch.cuh index db60c140a..16a293f90 100644 --- a/include/nvexec/stream/launch.cuh +++ b/include/nvexec/stream/launch.cuh @@ -163,16 +163,12 @@ namespace nvexec { } template <__movable_value Fun> - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(Fun&& fun) const -> __binder_back { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(Fun&& fun) const -> __binder_back { return {{static_cast(fun)}}; } template <__movable_value Fun> - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(launch_params params, Fun&& fun) const + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(launch_params params, Fun&& fun) const -> __binder_back { return { {params, static_cast(fun)}, diff --git a/include/nvexec/stream/let_xxx.cuh b/include/nvexec/stream/let_xxx.cuh index 0ceb492fc..8a58d269c 100644 --- a/include/nvexec/stream/let_xxx.cuh +++ b/include/nvexec/stream/let_xxx.cuh @@ -77,7 +77,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { template using __f = // transform_completion_signatures< - __completion_signatures_of_t< __minvoke<__result_sender_fn<_Fun>, _Args...>, _StreamEnv...>, + __completion_signatures_of_t<__minvoke<__result_sender_fn<_Fun>, _Args...>, _StreamEnv...>, completion_signatures>; }; @@ -188,12 +188,12 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { template __operation(_Sender&& __sndr, _Receiver2&& __rcvr, _Fun __fun) : __operation_base<_SenderId, _ReceiverId, _Fun, _Let>( - static_cast<_Sender&&>(__sndr), - static_cast<_Receiver2&&>(__rcvr), - [this](operation_state_base_t>&) -> __receiver_t { - return __receiver_t{{}, this}; - }, - get_completion_scheduler(get_env(__sndr)).context_state_) + static_cast<_Sender&&>(__sndr), + static_cast<_Receiver2&&>(__rcvr), + [this](operation_state_base_t>&) -> __receiver_t { + return __receiver_t{{}, this}; + }, + get_completion_scheduler(get_env(__sndr)).context_state_) , __fun_(static_cast<_Fun&&>(__fun)) { } diff --git a/include/nvexec/stream/reduce.cuh b/include/nvexec/stream/reduce.cuh index cbfd68e52..e6429e0c4 100644 --- a/include/nvexec/stream/reduce.cuh +++ b/include/nvexec/stream/reduce.cuh @@ -65,15 +65,16 @@ namespace nvexec { std::size_t num_items = std::distance(first, last); - if (status = STDEXEC_DBG_ERR(cub::DeviceReduce::Reduce( - d_temp_storage, - temp_storage_size, - first, - d_out, - num_items, - self.fun_, - self.init_, - stream)); + if (status = STDEXEC_DBG_ERR( + cub::DeviceReduce::Reduce( + d_temp_storage, + temp_storage_size, + first, + d_out, + num_items, + self.fun_, + self.init_, + stream)); status != cudaSuccess) { self.op_state_.propagate_completion_signal(stdexec::set_error, std::move(status)); return; @@ -86,15 +87,16 @@ namespace nvexec { return; } - if (status = STDEXEC_DBG_ERR(cub::DeviceReduce::Reduce( - d_temp_storage, - temp_storage_size, - first, - d_out, - num_items, - self.fun_, - self.init_, - stream)); + if (status = STDEXEC_DBG_ERR( + cub::DeviceReduce::Reduce( + d_temp_storage, + temp_storage_size, + first, + d_out, + num_items, + self.fun_, + self.init_, + stream)); status != cudaSuccess) { self.op_state_.propagate_completion_signal(stdexec::set_error, std::move(status)); return; @@ -138,9 +140,7 @@ namespace nvexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(InitT init, Fun fun = {}) const -> __binder_back { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(InitT init, Fun fun = {}) const -> __binder_back { return { {static_cast(init), static_cast(fun)}, {}, diff --git a/include/nvexec/stream/schedule_from.cuh b/include/nvexec/stream/schedule_from.cuh index 354171a3d..690448167 100644 --- a/include/nvexec/stream/schedule_from.cuh +++ b/include/nvexec/stream/schedule_from.cuh @@ -217,11 +217,11 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { template <__decays_to<__t> _Self, class... _Env> static auto get_completion_signatures(_Self&&, _Env&&...) // - -> transform_completion_signatures< - __completion_signatures_of_t<__copy_cvref_t<_Self, Sender>, _Env...>, - completion_signatures, - _sched_from::value_completions_t, - _sched_from::error_completions_t> { + -> transform_completion_signatures< + __completion_signatures_of_t<__copy_cvref_t<_Self, Sender>, _Env...>, + completion_signatures, + _sched_from::value_completions_t, + _sched_from::error_completions_t> { return {}; } diff --git a/include/nvexec/stream/split.cuh b/include/nvexec/stream/split.cuh index e17831c01..d0c88092d 100644 --- a/include/nvexec/stream/split.cuh +++ b/include/nvexec/stream/split.cuh @@ -163,14 +163,15 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { : context_state_(context_state) , stream_provider_(false, context_state) , data_(malloc_managed(stream_provider_.status_)) - , task_(make_host( - stream_provider_.status_, - context_state.pinned_resource_, - inner_receiver_t{*this}, - data_, - stream_provider_.own_stream_.value(), - context_state.pinned_resource_) - .release()) + , task_( + make_host( + stream_provider_.status_, + context_state.pinned_resource_, + inner_receiver_t{*this}, + data_, + stream_provider_.own_stream_.value(), + context_state.pinned_resource_) + .release()) , env_( make_host(this->stream_provider_.status_, context_state_.pinned_resource_, make_env())) , op_state2_(connect( diff --git a/include/nvexec/stream/submit.cuh b/include/nvexec/stream/submit.cuh index 1adb69039..211bb6c98 100644 --- a/include/nvexec/stream/submit.cuh +++ b/include/nvexec/stream/submit.cuh @@ -46,7 +46,9 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS::_submit { stdexec::set_error(static_cast(op_state_->rcvr_), static_cast(err)); } - void set_stopped() noexcept requires __callable { + void set_stopped() noexcept + requires __callable + { // Delete the state as cleanup: std::unique_ptr g{op_state_}; stdexec::set_stopped(static_cast(op_state_->rcvr_)); diff --git a/include/nvexec/stream/then.cuh b/include/nvexec/stream/then.cuh index 1cd1efff1..c4b9eff23 100644 --- a/include/nvexec/stream/then.cuh +++ b/include/nvexec/stream/then.cuh @@ -189,7 +189,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { } template <__decays_to<__t> Self, class... Env> - static auto get_completion_signatures(Self&&, Env&&...) -> _completion_signatures_t { + static auto + get_completion_signatures(Self&&, Env&&...) -> _completion_signatures_t { return {}; } diff --git a/include/nvexec/stream/upon_error.cuh b/include/nvexec/stream/upon_error.cuh index 5edb1b9f7..570b0a7bc 100644 --- a/include/nvexec/stream/upon_error.cuh +++ b/include/nvexec/stream/upon_error.cuh @@ -171,7 +171,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { } template <__decays_to<__t> Self, class... Env> - static auto get_completion_signatures(Self&&, Env&&...) -> completion_signatures { + static auto + get_completion_signatures(Self&&, Env&&...) -> completion_signatures { return {}; } diff --git a/include/nvexec/stream/upon_stopped.cuh b/include/nvexec/stream/upon_stopped.cuh index 0279a2845..cb1f74c21 100644 --- a/include/nvexec/stream/upon_stopped.cuh +++ b/include/nvexec/stream/upon_stopped.cuh @@ -120,7 +120,7 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { template using completion_signatures = // transform_completion_signatures< - __completion_signatures_of_t< __copy_cvref_t, Env...>, + __completion_signatures_of_t<__copy_cvref_t, Env...>, __with_error_invoke_t< __callable_error<"In nvexec::upon_stopped(Sender, Function)..."_mstr>, set_stopped_t, @@ -143,7 +143,8 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { } template <__decays_to<__t> Self, class... Env> - static auto get_completion_signatures(Self&&, Env&&...) -> completion_signatures { + static auto + get_completion_signatures(Self&&, Env&&...) -> completion_signatures { return {}; } diff --git a/include/nvexec/stream/when_all.cuh b/include/nvexec/stream/when_all.cuh index 4bff741cd..c418304de 100644 --- a/include/nvexec/stream/when_all.cuh +++ b/include/nvexec/stream/when_all.cuh @@ -45,21 +45,17 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { using env_t = exec::make_env_t>; template - concept valid_child_sender = - sender_in && - requires { - requires (__v<__count_of> <= 1); - }; + concept valid_child_sender = sender_in && requires { + requires(__v<__count_of> <= 1); + }; template - concept too_many_completions_sender = - sender_in && - requires { - requires (__v<__count_of> > 1); - }; + concept too_many_completions_sender = sender_in && requires { + requires(__v<__count_of> > 1); + }; template - struct completions {}; + struct completions { }; template requires(too_many_completions_sender || ...) @@ -94,7 +90,9 @@ namespace nvexec::STDEXEC_STREAM_DETAIL_NS { __minvoke< __mconcat<__qf>, __value_types_t< - __completion_signatures_of_t, __q<__types>, __msingle_or<__types<>>>...>; + __completion_signatures_of_t, + __q<__types>, + __msingle_or<__types<>>>...>; using __t = // __if_c< (__sends && ...), diff --git a/include/nvexec/stream_context.cuh b/include/nvexec/stream_context.cuh index 9f65aa2c8..c7d88306e 100644 --- a/include/nvexec/stream_context.cuh +++ b/include/nvexec/stream_context.cuh @@ -132,8 +132,7 @@ namespace nvexec { return env_; }; - STDEXEC_ATTRIBUTE((host, device)) - inline __t(context_state_t context_state) noexcept + STDEXEC_ATTRIBUTE((host, device)) inline __t(context_state_t context_state) noexcept : env_{context_state} { } @@ -150,19 +149,23 @@ namespace nvexec { } template - STDEXEC_MEMFN_DECL(auto bulk)(this const stream_scheduler& sch, S&& sndr, Shape shape, Fn fun) noexcept + STDEXEC_MEMFN_DECL( + auto bulk)(this const stream_scheduler& sch, S&& sndr, Shape shape, Fn fun) noexcept -> bulk_sender_th { return bulk_sender_th{ {}, static_cast(sndr), shape, static_cast(fun)}; } template - STDEXEC_MEMFN_DECL(auto then)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept -> then_sender_th { + STDEXEC_MEMFN_DECL( + auto + then)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept -> then_sender_th { return then_sender_th{{}, static_cast(sndr), static_cast(fun)}; } template - STDEXEC_MEMFN_DECL(auto ensure_started)(this const stream_scheduler& sch, S&& sndr) noexcept -> ensure_started_th { + STDEXEC_MEMFN_DECL(auto ensure_started)(this const stream_scheduler& sch, S&& sndr) noexcept + -> ensure_started_th { return ensure_started_th(sch.context_state_, static_cast(sndr)); } @@ -179,19 +182,22 @@ namespace nvexec { } template - STDEXEC_MEMFN_DECL(auto let_stopped)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept + STDEXEC_MEMFN_DECL( + auto let_stopped)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept -> let_xxx_th { return let_xxx_th{{}, static_cast(sndr), static_cast(fun)}; } template - STDEXEC_MEMFN_DECL(auto upon_error)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept + STDEXEC_MEMFN_DECL( + auto upon_error)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept -> upon_error_sender_th { return upon_error_sender_th{{}, static_cast(sndr), static_cast(fun)}; } template - STDEXEC_MEMFN_DECL(auto upon_stopped)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept + STDEXEC_MEMFN_DECL( + auto upon_stopped)(this const stream_scheduler& sch, S&& sndr, Fn fun) noexcept -> upon_stopped_sender_th { return upon_stopped_sender_th{{}, static_cast(sndr), static_cast(fun)}; } @@ -215,7 +221,8 @@ namespace nvexec { } template - STDEXEC_MEMFN_DECL(auto continues_on)(this const stream_scheduler& sch, S&& sndr, Sch&& scheduler) // + STDEXEC_MEMFN_DECL( + auto continues_on)(this const stream_scheduler& sch, S&& sndr, Sch&& scheduler) // noexcept -> __result_of> { return schedule_from( static_cast(scheduler), @@ -228,9 +235,7 @@ namespace nvexec { return split_sender_th(sch.context_state_, static_cast(sndr)); } - STDEXEC_ATTRIBUTE((host, device)) - inline auto - schedule() const noexcept -> sender_t { + STDEXEC_ATTRIBUTE((host, device)) inline auto schedule() const noexcept -> sender_t { return {context_state_}; } diff --git a/include/stdexec/__detail/__awaitable.hpp b/include/stdexec/__detail/__awaitable.hpp index 046ccf3d4..d70790797 100644 --- a/include/stdexec/__detail/__awaitable.hpp +++ b/include/stdexec/__detail/__awaitable.hpp @@ -101,9 +101,10 @@ namespace stdexec { template requires __awaitable<_Awaitable, _Promise...> - using __await_result_t = decltype(stdexec::__as_lvalue(stdexec::__get_awaiter( - std::declval<_Awaitable>(), - static_cast<_Promise*>(nullptr)...)) + using __await_result_t = decltype(stdexec::__as_lvalue( + stdexec::__get_awaiter( + std::declval<_Awaitable>(), + static_cast<_Promise*>(nullptr)...)) .await_resume()); #else diff --git a/include/stdexec/__detail/__basic_sender.hpp b/include/stdexec/__detail/__basic_sender.hpp index 6bec279e0..264c59d44 100644 --- a/include/stdexec/__detail/__basic_sender.hpp +++ b/include/stdexec/__detail/__basic_sender.hpp @@ -40,9 +40,7 @@ namespace stdexec { struct __get_data { template - STDEXEC_ATTRIBUTE((always_inline)) - _Data&& - operator()(__ignore, _Data&& __data, auto&&...) const noexcept { + STDEXEC_ATTRIBUTE((always_inline)) _Data&& operator()(__ignore, _Data&& __data, auto&&...) const noexcept { return static_cast<_Data&&>(__data); } }; @@ -186,28 +184,21 @@ namespace stdexec { // } template - STDEXEC_ATTRIBUTE((always_inline)) - void - set_value(_Args&&... __args) noexcept { + STDEXEC_ATTRIBUTE((always_inline)) void set_value(_Args&&... __args) noexcept { __op_->__complete(_Idx(), stdexec::set_value, static_cast<_Args&&>(__args)...); } template - STDEXEC_ATTRIBUTE((always_inline)) - void - set_error(_Error&& __err) noexcept { + STDEXEC_ATTRIBUTE((always_inline)) void set_error(_Error&& __err) noexcept { __op_->__complete(_Idx(), stdexec::set_error, static_cast<_Error&&>(__err)); } - STDEXEC_ATTRIBUTE((always_inline)) - void - set_stopped() noexcept { + STDEXEC_ATTRIBUTE((always_inline)) void set_stopped() noexcept { __op_->__complete(_Idx(), stdexec::set_stopped); } template <__same_as<__t> _Self = __t> - STDEXEC_ATTRIBUTE((always_inline)) - auto + STDEXEC_ATTRIBUTE((always_inline)) auto get_env() const noexcept -> __env_type_t<_Self, __tag_t, _Idx, _Sexpr, _Receiver> { return __op_->__get_env(_Idx()); } @@ -230,15 +221,11 @@ namespace stdexec { struct __receiver_box { _Receiver __rcvr_; - STDEXEC_ATTRIBUTE((always_inline)) - auto - __rcvr() & noexcept -> _Receiver& { + STDEXEC_ATTRIBUTE((always_inline)) auto __rcvr() & noexcept -> _Receiver& { return this->__rcvr_; } - STDEXEC_ATTRIBUTE((always_inline)) - auto - __rcvr() const & noexcept -> const _Receiver& { + STDEXEC_ATTRIBUTE((always_inline)) auto __rcvr() const & noexcept -> const _Receiver& { return this->__rcvr_; } }; @@ -293,15 +280,11 @@ namespace stdexec { , __state_(__sexpr_impl<__tag_t>::get_state(static_cast<_Sexpr&&>(__sndr), __rcvr_)) { } - STDEXEC_ATTRIBUTE((always_inline)) - auto - __rcvr() & noexcept -> _Receiver& { + STDEXEC_ATTRIBUTE((always_inline)) auto __rcvr() & noexcept -> _Receiver& { return __rcvr_; } - STDEXEC_ATTRIBUTE((always_inline)) - auto - __rcvr() const & noexcept -> const _Receiver& { + STDEXEC_ATTRIBUTE((always_inline)) auto __rcvr() const & noexcept -> const _Receiver& { return __rcvr_; } }; @@ -404,9 +387,7 @@ namespace stdexec { __sexpr_apply(static_cast<_Sexpr&&>(__sexpr), __connect_fn<_Sexpr, _Receiver>{this})) { } - STDEXEC_ATTRIBUTE((always_inline)) - void - start() & noexcept { + STDEXEC_ATTRIBUTE((always_inline)) void start() & noexcept { using __tag_t = typename __op_state::__tag_t; auto&& __rcvr = this->__rcvr(); __inner_ops_.apply( @@ -417,9 +398,7 @@ namespace stdexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - void - __complete(_Index, _Tag2, _Args&&... __args) noexcept { + STDEXEC_ATTRIBUTE((always_inline)) void __complete(_Index, _Tag2, _Args&&... __args) noexcept { using __tag_t = typename __op_state::__tag_t; auto&& __rcvr = this->__rcvr(); using _CompleteFn = __mtypeof<__sexpr_impl<__tag_t>::complete>; @@ -432,9 +411,7 @@ namespace stdexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - auto - __get_env(_Index) const noexcept + STDEXEC_ATTRIBUTE((always_inline)) auto __get_env(_Index) const noexcept -> __env_type_t<_Index, __tag_t, _Index, _Sexpr, _Receiver> { const auto& __rcvr = this->__rcvr(); return __sexpr_impl<__tag_t>::get_env(_Index(), this->__state_, __rcvr); @@ -451,9 +428,7 @@ namespace stdexec { }; template - STDEXEC_ATTRIBUTE((host, device, always_inline)) - constexpr auto - __captures(_Tag, _Captures&&... __captures2) { + STDEXEC_ATTRIBUTE((host, device, always_inline)) constexpr auto __captures(_Tag, _Captures&&... __captures2) { return [... __captures3 = static_cast<_Captures&&>(__captures2)]( _Cvref, _Fun&& __fun) mutable // noexcept(__nothrow_callable<_Fun, _Tag, __minvoke<_Cvref, _Captures>...>) // @@ -500,7 +475,7 @@ namespace stdexec { using __get_attrs_fn = __result_of<__detail::__drop_front, __mtypeof<__sexpr_impl<_Tag>::get_attrs>>; - //! A dummy type used only for diagnostic purposes. + //! A dummy type used only for diagnostic purposes. //! See `__sexpr` for the implementation of P2300's _`basic-sender`_. template struct __basic_sender { @@ -527,28 +502,25 @@ namespace stdexec { mutable __captures_t __impl_; template - STDEXEC_ATTRIBUTE((host, device, always_inline)) - explicit __sexpr(_Tag, _Data&& __data, _Child&&... __child) - : __impl_(__detail::__captures( - _Tag(), - static_cast<_Data&&>(__data), - static_cast<_Child&&>(__child)...)) { + STDEXEC_ATTRIBUTE((host, device, always_inline)) explicit __sexpr(_Tag, _Data&& __data, _Child&&... __child) + : __impl_( + __detail::__captures( + _Tag(), + static_cast<_Data&&>(__data), + static_cast<_Child&&>(__child)...)) { } template using __impl = __sexpr_impl<__meval<__msecond, _Self, __tag_t>>; template - STDEXEC_ATTRIBUTE((always_inline)) - auto - get_env() const noexcept -> __result_of<__sexpr_apply, const _Self&, __get_attrs_fn<__tag_t>> { + STDEXEC_ATTRIBUTE((always_inline)) auto get_env() const noexcept + -> __result_of<__sexpr_apply, const _Self&, __get_attrs_fn<__tag_t>> { return __sexpr_apply(*this, __detail::__drop_front(__impl<_Self>::get_attrs)); } template <__decays_to<__sexpr> _Self, class... _Env> - STDEXEC_ATTRIBUTE((always_inline)) - static auto - get_completion_signatures(_Self&&, _Env&&...) noexcept // + STDEXEC_ATTRIBUTE((always_inline)) static auto get_completion_signatures(_Self&&, _Env&&...) noexcept // -> __msecond< __if_c<__decays_to<_Self, __sexpr>>, __result_of<__impl<_Self>::get_completion_signatures, _Self, _Env...>> { @@ -557,9 +529,7 @@ namespace stdexec { // BUGBUG fix receiver constraint here: template <__decays_to<__sexpr> _Self, /*receiver*/ class _Receiver> - STDEXEC_ATTRIBUTE((always_inline)) - static auto - connect(_Self&& __self, _Receiver&& __rcvr) // + STDEXEC_ATTRIBUTE((always_inline)) static auto connect(_Self&& __self, _Receiver&& __rcvr) // noexcept(__noexcept_of<__impl<_Self>::connect, _Self, _Receiver>) // -> __msecond< __if_c<__decays_to<_Self, __sexpr>>, @@ -568,9 +538,7 @@ namespace stdexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - static auto - apply(_Sender&& __sndr, _ApplyFn&& __fun) // + STDEXEC_ATTRIBUTE((always_inline)) static auto apply(_Sender&& __sndr, _ApplyFn&& __fun) // noexcept( __nothrow_callable<__detail::__impl_of<_Sender>, __copy_cvref_fn<_Sender>, _ApplyFn>) // -> __call_result_t<__detail::__impl_of<_Sender>, __copy_cvref_fn<_Sender>, _ApplyFn> { // @@ -579,9 +547,7 @@ namespace stdexec { } template _Self> - STDEXEC_ATTRIBUTE((always_inline)) - friend auto - get(_Self&& __self) noexcept -> decltype(auto) + STDEXEC_ATTRIBUTE((always_inline)) friend auto get(_Self&& __self) noexcept -> decltype(auto) requires __detail::__in_range<_Idx, __desc_t> { if constexpr (_Idx == 0) { @@ -593,8 +559,7 @@ namespace stdexec { }; template - STDEXEC_ATTRIBUTE((host, device)) - __sexpr(_Tag, _Data, _Child...) -> __sexpr; + STDEXEC_ATTRIBUTE((host, device)) __sexpr(_Tag, _Data, _Child...) -> __sexpr; template using __sexpr_t = __sexpr; @@ -602,7 +567,7 @@ namespace stdexec { ////////////////////////////////////////////////////////////////////////////////////////////////// // __make_sexpr //! A tagged function-object - //! Takes data and children and + //! Takes data and children and //! returns `__sexpr_t<_Tag, _Data, _Child...>{_Tag(), data, children...}`. namespace __detail { template diff --git a/include/stdexec/__detail/__bulk.hpp b/include/stdexec/__detail/__bulk.hpp index d832495c2..12dd91898 100644 --- a/include/stdexec/__detail/__bulk.hpp +++ b/include/stdexec/__detail/__bulk.hpp @@ -41,8 +41,7 @@ namespace stdexec { template struct __data { _Shape __shape_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Fun __fun_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_; static constexpr auto __mbrs_ = __mliterals<&__data::__shape_, &__data::__fun_>(); }; template @@ -71,10 +70,8 @@ namespace stdexec { struct bulk_t { template - STDEXEC_ATTRIBUTE((host, device)) - auto - operator()(_Sender&& __sndr, _Shape __shape, _Fun __fun) const -> __well_formed_sender - auto { + STDEXEC_ATTRIBUTE((host, device)) auto operator()(_Sender&& __sndr, _Shape __shape, _Fun __fun) const + -> __well_formed_sender auto { auto __domain = __get_early_domain(__sndr); return stdexec::transform_sender( __domain, @@ -83,8 +80,7 @@ namespace stdexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - auto + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(_Shape __shape, _Fun __fun) const -> __binder_back { return { {static_cast<_Shape&&>(__shape), static_cast<_Fun&&>(__fun)}, diff --git a/include/stdexec/__detail/__config.hpp b/include/stdexec/__detail/__config.hpp index 18331d0c7..51847f6ce 100644 --- a/include/stdexec/__detail/__config.hpp +++ b/include/stdexec/__detail/__config.hpp @@ -138,7 +138,7 @@ #elif defined(__GNUC__) # define STDEXEC_GCC(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) #elif defined(_MSC_VER) -# define STDEXEC_MSVC(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) +# define STDEXEC_MSVC(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) # define STDEXEC_MSVC_HEADERS(...) STDEXEC_HEAD_OR_TAIL(1, __VA_ARGS__) #endif diff --git a/include/stdexec/__detail/__connect_awaitable.hpp b/include/stdexec/__detail/__connect_awaitable.hpp index 7e55cf67b..4425a6569 100644 --- a/include/stdexec/__detail/__connect_awaitable.hpp +++ b/include/stdexec/__detail/__connect_awaitable.hpp @@ -104,15 +104,15 @@ namespace stdexec { struct __t : __promise_base { using __id = __promise; -#if STDEXEC_EDG() +# if STDEXEC_EDG() __t(auto&&, _Receiver&& __rcvr) noexcept : __rcvr_(__rcvr) { } -#else +# else explicit __t(auto&, _Receiver& __rcvr) noexcept : __rcvr_(__rcvr) { } -#endif +# endif auto unhandled_stopped() noexcept -> __coro::coroutine_handle<> { stdexec::set_stopped(static_cast<_Receiver&&>(__rcvr_)); diff --git a/include/stdexec/__detail/__continues_on.hpp b/include/stdexec/__detail/__continues_on.hpp index 4ebf8ab47..5eef33036 100644 --- a/include/stdexec/__detail/__continues_on.hpp +++ b/include/stdexec/__detail/__continues_on.hpp @@ -58,9 +58,7 @@ namespace stdexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(_Scheduler&& __sched) const + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(_Scheduler&& __sched) const -> __binder_back> { return {{static_cast<_Scheduler&&>(__sched)}, {}, {}}; } diff --git a/include/stdexec/__detail/__debug.hpp b/include/stdexec/__detail/__debug.hpp index aa2af8704..ff3639ab4 100644 --- a/include/stdexec/__detail/__debug.hpp +++ b/include/stdexec/__detail/__debug.hpp @@ -34,8 +34,8 @@ namespace stdexec { } template requires tag_invocable<__is_debug_env_t, const _Env&> - auto - operator()(const _Env&) const noexcept -> tag_invoke_result_t<__is_debug_env_t, const _Env&>; + auto operator()(const _Env&) const noexcept + -> tag_invoke_result_t<__is_debug_env_t, const _Env&>; }; template @@ -75,23 +75,17 @@ namespace stdexec { struct __valid_completions { template requires __one_of - STDEXEC_ATTRIBUTE((host, device)) - void - set_value(_Args&&...) noexcept { + STDEXEC_ATTRIBUTE((host, device)) void set_value(_Args&&...) noexcept { STDEXEC_TERMINATE(); } template requires __one_of - STDEXEC_ATTRIBUTE((host, device)) - void - set_error(_Error&&) noexcept { + STDEXEC_ATTRIBUTE((host, device)) void set_error(_Error&&) noexcept { STDEXEC_TERMINATE(); } - STDEXEC_ATTRIBUTE((host, device)) - void - set_stopped() noexcept + STDEXEC_ATTRIBUTE((host, device)) void set_stopped() noexcept requires __one_of { STDEXEC_TERMINATE(); @@ -112,9 +106,7 @@ namespace stdexec { using __id = __debug_receiver; using receiver_concept = receiver_t; - STDEXEC_ATTRIBUTE((host, device)) - auto - get_env() const noexcept -> __debug_env_t<_Env> { + STDEXEC_ATTRIBUTE((host, device)) auto get_env() const noexcept -> __debug_env_t<_Env> { STDEXEC_TERMINATE(); } }; @@ -135,8 +127,7 @@ namespace stdexec { "The sender claims to send a particular set of completions," " but in actual fact it completes with a result that is not" " one of the declared completion signatures.")]] - STDEXEC_ATTRIBUTE((host, device)) - void _ATTENTION_() noexcept { + STDEXEC_ATTRIBUTE((host, device)) void _ATTENTION_() noexcept { } template @@ -160,9 +151,7 @@ namespace stdexec { }; template <__completion_tag _Tag, class... _Args> - STDEXEC_ATTRIBUTE((host, device)) - void - tag_invoke(_Tag, __t<__invalid_completion<_Tag(_Args...)>>, _Args&&...) noexcept { + STDEXEC_ATTRIBUTE((host, device)) void tag_invoke(_Tag, __t<__invalid_completion<_Tag(_Args...)>>, _Args&&...) noexcept { } struct __debug_operation { diff --git a/include/stdexec/__detail/__domain.hpp b/include/stdexec/__detail/__domain.hpp index f4ef2b8dd..6d0148530 100644 --- a/include/stdexec/__detail/__domain.hpp +++ b/include/stdexec/__detail/__domain.hpp @@ -143,9 +143,7 @@ namespace stdexec { // Called without the environment during eager customization template - STDEXEC_ATTRIBUTE((always_inline)) - decltype(auto) - transform_sender(_Sender&& __sndr) const + STDEXEC_ATTRIBUTE((always_inline)) decltype(auto) transform_sender(_Sender&& __sndr) const noexcept(__domain::__is_nothrow_transform_sender<_Sender>()) { // Look for a legacy customization for the given tag, and if found, apply it. if constexpr (__callable<__sexpr_apply_t, _Sender, __domain::__legacy_customization>) { @@ -160,9 +158,7 @@ namespace stdexec { // Called with an environment during lazy customization template - STDEXEC_ATTRIBUTE((always_inline)) - decltype(auto) - transform_sender(_Sender&& __sndr, const _Env& __env) const + STDEXEC_ATTRIBUTE((always_inline)) decltype(auto) transform_sender(_Sender&& __sndr, const _Env& __env) const noexcept(__domain::__is_nothrow_transform_sender<_Sender, _Env>()) { if constexpr (__domain::__has_default_transform_sender<_Sender, _Env>) { return tag_of_t<_Sender>().transform_sender(static_cast<_Sender&&>(__sndr), __env); @@ -174,9 +170,7 @@ namespace stdexec { template requires __domain::__has_legacy_c11n<_Tag, _Sender, _Args...> || __domain::__has_apply_sender<_Tag, _Sender, _Args...> - STDEXEC_ATTRIBUTE((always_inline)) - decltype(auto) - apply_sender(_Tag, _Sender&& __sndr, _Args&&... __args) const { + STDEXEC_ATTRIBUTE((always_inline)) decltype(auto) apply_sender(_Tag, _Sender&& __sndr, _Args&&... __args) const { // Look for a legacy customization for the given tag, and if found, apply it. if constexpr (__domain::__has_legacy_c11n<_Tag, _Sender, _Args...>) { return __domain::__legacy_c11n_fn<_Tag, _Sender, _Args...>()( @@ -263,9 +257,7 @@ namespace stdexec { // defined in __transform_sender.hpp template requires same_as<__early_domain_of_t<_Sender>, dependent_domain> - STDEXEC_ATTRIBUTE((always_inline)) - decltype(auto) - transform_sender(_Sender&& __sndr, const _Env& __env) const + STDEXEC_ATTRIBUTE((always_inline)) decltype(auto) transform_sender(_Sender&& __sndr, const _Env& __env) const noexcept(__is_nothrow_transform_sender<_Sender, _Env>()); }; diff --git a/include/stdexec/__detail/__ensure_started.hpp b/include/stdexec/__detail/__ensure_started.hpp index 3254ba197..c450fa656 100644 --- a/include/stdexec/__detail/__ensure_started.hpp +++ b/include/stdexec/__detail/__ensure_started.hpp @@ -54,9 +54,7 @@ namespace stdexec { } } - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()() const noexcept -> __binder_back { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()() const noexcept -> __binder_back { return {{}, {}, {}}; } diff --git a/include/stdexec/__detail/__env.hpp b/include/stdexec/__detail/__env.hpp index 704cbe033..6b3875202 100644 --- a/include/stdexec/__detail/__env.hpp +++ b/include/stdexec/__detail/__env.hpp @@ -311,8 +311,8 @@ namespace stdexec { inline constexpr get_scheduler_t get_scheduler{}; inline constexpr get_delegation_scheduler_t get_delegation_scheduler{}; inline constexpr auto& get_delegatee_scheduler - [[deprecated("get_delegatee_scheduler has been renamed get_delegation_scheduler")]] = - get_delegation_scheduler; + [[deprecated("get_delegatee_scheduler has been renamed get_delegation_scheduler")]] + = get_delegation_scheduler; inline constexpr get_allocator_t get_allocator{}; inline constexpr get_stop_token_t get_stop_token{}; #if !STDEXEC_GCC() || defined(__OPTIMIZE_SIZE__) @@ -377,15 +377,11 @@ namespace stdexec { using __t = prop; using __id = prop; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Query __query; + STDEXEC_ATTRIBUTE((no_unique_address)) _Query __query; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Value __value; + STDEXEC_ATTRIBUTE((no_unique_address)) _Value __value; - STDEXEC_ATTRIBUTE((nodiscard)) - constexpr const _Value& - query(_Query) const noexcept { + STDEXEC_ATTRIBUTE((nodiscard)) constexpr const _Value& query(_Query) const noexcept { return __value; } @@ -406,9 +402,7 @@ namespace stdexec { // return a reference to the first child env for which // __queryable<_Envs, _Query, _Args...> is true. template - STDEXEC_ATTRIBUTE((always_inline)) - constexpr decltype(auto) - __get_1st() const noexcept { + STDEXEC_ATTRIBUTE((always_inline)) constexpr decltype(auto) __get_1st() const noexcept { constexpr bool __flags[] = {__queryable<_Envs, _Query, _Args...>...}; constexpr std::size_t __idx = __pos_of(__flags, __flags + sizeof...(_Envs)); return __tup::get<__idx>(__tup_); @@ -416,9 +410,7 @@ namespace stdexec { template requires(__queryable<_Envs, _Query, _Args...> || ...) - STDEXEC_ATTRIBUTE((always_inline)) - constexpr decltype(auto) - query(_Query __q, _Args&&... __args) const + STDEXEC_ATTRIBUTE((always_inline)) constexpr decltype(auto) query(_Query __q, _Args&&... __args) const noexcept(__nothrow_queryable()), _Query, _Args...>) { return tag_invoke(__q, __get_1st<_Query, _Args...>(), static_cast<_Args&&>(__args)...); } @@ -432,17 +424,13 @@ namespace stdexec { using __t = env; using __id = env; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Env0 __env0_; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Env1 __env1_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Env0 __env0_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Env1 __env1_; // return a reference to the first child env for which // __queryable<_Envs, _Query, _Args...> is true. template - STDEXEC_ATTRIBUTE((always_inline)) - constexpr decltype(auto) - __get_1st() const noexcept { + STDEXEC_ATTRIBUTE((always_inline)) constexpr decltype(auto) __get_1st() const noexcept { if constexpr (__queryable<_Env0, _Query, _Args...>) { return (__env0_); } else { @@ -452,9 +440,7 @@ namespace stdexec { template requires __queryable<_Env0, _Query, _Args...> || __queryable<_Env1, _Query, _Args...> - STDEXEC_ATTRIBUTE((always_inline)) - constexpr decltype(auto) - query(_Query __q, _Args&&... __args) const + STDEXEC_ATTRIBUTE((always_inline)) constexpr decltype(auto) query(_Query __q, _Args&&... __args) const noexcept(__nothrow_queryable()), _Query, _Args...>) { return tag_invoke(__q, __get_1st<_Query, _Args...>(), static_cast<_Args&&>(__args)...); } @@ -469,8 +455,7 @@ namespace stdexec { struct __with { using __t = __with; using __id = __with; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Value __value_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Value __value_; __with() = default; @@ -501,8 +486,7 @@ namespace stdexec { struct __t { using __id = __fwd; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Env __env_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Env __env_; #if STDEXEC_GCC() && __GNUC__ < 12 using __cvref_env_t = std::add_const_t<_Env>&; @@ -550,8 +534,7 @@ namespace stdexec { auto query(_Tag) const noexcept = delete; template _Key> - STDEXEC_ATTRIBUTE((always_inline)) - auto + STDEXEC_ATTRIBUTE((always_inline)) auto query(_Key) const noexcept(nothrow_tag_invocable<_Key, __cvref_env_t>) -> decltype(auto) { return tag_invoke(_Key(), __env_); } @@ -581,8 +564,7 @@ namespace stdexec { struct __from { using __t = __from; using __id = __from; - STDEXEC_ATTRIBUTE((no_unique_address)) - _Fun __fun_; + STDEXEC_ATTRIBUTE((no_unique_address)) _Fun __fun_; template requires __callable @@ -647,9 +629,7 @@ namespace stdexec { // For getting an execution environment from a receiver or the attributes from a sender. struct get_env_t { template <__same_as _Self, class _EnvProvider> - STDEXEC_ATTRIBUTE((always_inline)) - friend auto - tag_invoke(_Self, const _EnvProvider& __env_provider) noexcept + STDEXEC_ATTRIBUTE((always_inline)) friend auto tag_invoke(_Self, const _EnvProvider& __env_provider) noexcept -> decltype(__env_provider.get_env()) { static_assert(noexcept(__env_provider.get_env()), "get_env() members must be noexcept"); return __env_provider.get_env(); @@ -657,9 +637,7 @@ namespace stdexec { template requires tag_invocable - STDEXEC_ATTRIBUTE((always_inline)) - constexpr auto - operator()(const _EnvProvider& __env_provider) const noexcept + STDEXEC_ATTRIBUTE((always_inline)) constexpr auto operator()(const _EnvProvider& __env_provider) const noexcept -> tag_invoke_result_t { static_assert(queryable>); static_assert(nothrow_tag_invocable); diff --git a/include/stdexec/__detail/__into_variant.hpp b/include/stdexec/__detail/__into_variant.hpp index da88fd2d5..2bb070ba0 100644 --- a/include/stdexec/__detail/__into_variant.hpp +++ b/include/stdexec/__detail/__into_variant.hpp @@ -63,9 +63,7 @@ namespace stdexec { __domain, __make_sexpr(__(), static_cast<_Sender&&>(__sndr))); } - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()() const noexcept -> __binder_back { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()() const noexcept -> __binder_back { return {{}, {}, {}}; } }; diff --git a/include/stdexec/__detail/__intrusive_mpsc_queue.hpp b/include/stdexec/__detail/__intrusive_mpsc_queue.hpp index 879b7ef0c..57bf0615e 100644 --- a/include/stdexec/__detail/__intrusive_mpsc_queue.hpp +++ b/include/stdexec/__detail/__intrusive_mpsc_queue.hpp @@ -30,7 +30,7 @@ namespace stdexec { template class __intrusive_mpsc_queue; - template _Node::*_Next> + template _Node::* _Next> class __intrusive_mpsc_queue<_Next> { std::atomic __back_{&__nil_}; void* __front_{&__nil_}; diff --git a/include/stdexec/__detail/__intrusive_ptr.hpp b/include/stdexec/__detail/__intrusive_ptr.hpp index 658cc7705..c5ee59355 100644 --- a/include/stdexec/__detail/__intrusive_ptr.hpp +++ b/include/stdexec/__detail/__intrusive_ptr.hpp @@ -205,8 +205,8 @@ namespace stdexec { return operator=(__intrusive_ptr(__that)); } - auto operator=( - __enable_intrusive_from_this<_Ty, _ReservedBits>* __that) noexcept -> __intrusive_ptr& { + auto operator=(__enable_intrusive_from_this<_Ty, _ReservedBits>* __that) noexcept + -> __intrusive_ptr& { return operator=(__that ? __that->__intrusive_from_this() : __intrusive_ptr()); } diff --git a/include/stdexec/__detail/__intrusive_queue.hpp b/include/stdexec/__detail/__intrusive_queue.hpp index 8d0fe734f..7efcc81ac 100644 --- a/include/stdexec/__detail/__intrusive_queue.hpp +++ b/include/stdexec/__detail/__intrusive_queue.hpp @@ -27,7 +27,7 @@ namespace stdexec { template class __intrusive_queue; - template + template class __intrusive_queue<_Next> { public: __intrusive_queue() noexcept = default; diff --git a/include/stdexec/__detail/__intrusive_slist.hpp b/include/stdexec/__detail/__intrusive_slist.hpp index 5cc8208b3..092a90c4a 100644 --- a/include/stdexec/__detail/__intrusive_slist.hpp +++ b/include/stdexec/__detail/__intrusive_slist.hpp @@ -27,7 +27,7 @@ namespace stdexec { template class __intrusive_slist; - template + template class __intrusive_slist<_Next> { public: __intrusive_slist() noexcept = default; diff --git a/include/stdexec/__detail/__just.hpp b/include/stdexec/__detail/__just.hpp index 597da2126..2ac7267f8 100644 --- a/include/stdexec/__detail/__just.hpp +++ b/include/stdexec/__detail/__just.hpp @@ -54,9 +54,7 @@ namespace stdexec { using __tag_t = set_value_t; template <__movable_value... _Ts> - STDEXEC_ATTRIBUTE((host, device)) - auto - operator()(_Ts&&... __ts) const noexcept((__nothrow_decay_copyable<_Ts> && ...)) { + STDEXEC_ATTRIBUTE((host, device)) auto operator()(_Ts&&... __ts) const noexcept((__nothrow_decay_copyable<_Ts> && ...)) { return __make_sexpr(__tuple{static_cast<_Ts&&>(__ts)...}); } }; @@ -65,9 +63,7 @@ namespace stdexec { using __tag_t = set_error_t; template <__movable_value _Error> - STDEXEC_ATTRIBUTE((host, device)) - auto - operator()(_Error&& __err) const noexcept(__nothrow_decay_copyable<_Error>) { + STDEXEC_ATTRIBUTE((host, device)) auto operator()(_Error&& __err) const noexcept(__nothrow_decay_copyable<_Error>) { return __make_sexpr(__tuple{static_cast<_Error&&>(__err)}); } }; @@ -76,9 +72,7 @@ namespace stdexec { using __tag_t = set_stopped_t; template - STDEXEC_ATTRIBUTE((host, device)) - auto - operator()() const noexcept { + STDEXEC_ATTRIBUTE((host, device)) auto operator()() const noexcept { return __make_sexpr<_Tag>(__tuple{}); } }; diff --git a/include/stdexec/__detail/__let.hpp b/include/stdexec/__detail/__let.hpp index 7c057945d..1e26ae259 100644 --- a/include/stdexec/__detail/__let.hpp +++ b/include/stdexec/__detail/__let.hpp @@ -391,7 +391,7 @@ namespace stdexec { _Sched __sched_; //! Variant to hold the results passed from upstream before passing them to the function: __result_variant __args_{}; - //! Variant type for holding the operation state from connecting + //! Variant type for holding the operation state from connecting //! the function result to the downstream receiver: __op_state_variant __op_state3_{}; }; @@ -411,9 +411,7 @@ namespace stdexec { } template - STDEXEC_ATTRIBUTE((always_inline)) - auto - operator()(_Fun __fun) const -> __binder_back<__let_t, _Fun> { + STDEXEC_ATTRIBUTE((always_inline)) auto operator()(_Fun __fun) const -> __binder_back<__let_t, _Fun> { return {{static_cast<_Fun&&>(__fun)}, {}, {}}; } diff --git a/include/stdexec/__detail/__manual_lifetime.hpp b/include/stdexec/__detail/__manual_lifetime.hpp index 7650b432f..9de20d5ba 100644 --- a/include/stdexec/__detail/__manual_lifetime.hpp +++ b/include/stdexec/__detail/__manual_lifetime.hpp @@ -25,7 +25,7 @@ namespace stdexec { - //! Holds storage for a `_Ty`, but allows clients to `__construct(...)`, `__destry()`, + //! Holds storage for a `_Ty`, but allows clients to `__construct(...)`, `__destry()`, //! and `__get()` the `_Ty` without regard for usual lifetime rules. template class __manual_lifetime { @@ -34,6 +34,7 @@ namespace stdexec { //! if you want the `_Ty`'s lifetime to begin. constexpr __manual_lifetime() noexcept { } + //! Destructor does nothing: It's on you to call `__destroy()` if you mean to. constexpr ~__manual_lifetime() { } @@ -44,11 +45,12 @@ namespace stdexec { __manual_lifetime(__manual_lifetime&&) = delete; auto operator=(__manual_lifetime&&) -> __manual_lifetime& = delete; - //! Construct the `_Ty` in place. + //! Construct the `_Ty` in place. //! There are no safeties guarding against the case that there's already one there. template - auto __construct(_Args&&... __args) noexcept( - stdexec::__nothrow_constructible_from<_Ty, _Args...>) -> _Ty& { + auto + __construct(_Args&&... __args) noexcept(stdexec::__nothrow_constructible_from<_Ty, _Args...>) + -> _Ty& { // Use placement new instead of std::construct_at to support aggregate initialization with // brace elision. return *std::launder(::new (static_cast(__buffer_)) @@ -64,11 +66,13 @@ namespace stdexec { return *std::launder(::new (static_cast(__buffer_)) _Ty{(static_cast<_Func&&>(func))(static_cast<_Args&&>(__args)...)}); } + //! End the lifetime of the contained `_Ty`. //! Precondition: The lifetime has started. void __destroy() noexcept { std::destroy_at(&__get()); } + //! Get access to the `_Ty`. //! Precondition: The lifetime has started. auto __get() & noexcept -> _Ty& { diff --git a/include/stdexec/__detail/__meta.hpp b/include/stdexec/__detail/__meta.hpp index b74067851..fe70b6f7c 100644 --- a/include/stdexec/__detail/__meta.hpp +++ b/include/stdexec/__detail/__meta.hpp @@ -329,13 +329,13 @@ namespace stdexec { template concept _Ok = (STDEXEC_IS_SAME(__ok_t<_Args>, __msuccess) && ...); - //! The struct `__i` is the implementation of P2300's + //! The struct `__i` is the implementation of P2300's //! [_`META-APPLY`_](https://eel.is/c++draft/exec#util.cmplsig-5). //! > [Note [1](https://eel.is/c++draft/exec#util.cmplsig-note-1):  - //! > The purpose of META-APPLY is to make it valid to use non-variadic + //! > The purpose of META-APPLY is to make it valid to use non-variadic //! > templates as Variant and Tuple arguments to gather-signatures. — end note] //! In addition to avoiding the dreaded "pack expanded into non-pack argument" error, - //! it is part of the meta-error propagation mechanism. if any of the argument types + //! it is part of the meta-error propagation mechanism. if any of the argument types //! are a specialization of `_ERROR_`, `__i` will short-circuit and return the error. //! `__minvoke` and `__meval` are implemented in terms of `__i`. template @@ -432,11 +432,11 @@ namespace stdexec { //! This struct template is like [mpl::quote](https://www.boost.org/doc/libs/1_86_0/libs/mpl/doc/refmanual/quote.html). //! It turns an alias/class template into a metafunction that also propagates "meta-exceptions". - //! All of the meta utilities recognize specializations of stdexec::_ERROR_ as an error type. - //! Error types short-circuit the evaluation of the metafunction and are automatically propagated like an exception. + //! All of the meta utilities recognize specializations of stdexec::_ERROR_ as an error type. + //! Error types short-circuit the evaluation of the metafunction and are automatically propagated like an exception. //! Note: `__minvoke` and `__meval` also participate in this error propagation. //! - //! This design lets us report type errors briefly at the library boundary, even if the + //! This design lets us report type errors briefly at the library boundary, even if the //! actual error happens deep inside a meta-program. template