From 2cc0ff7fc312e15fb0b907cf92af981b677f7b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 1 Feb 2026 03:31:16 +0100 Subject: [PATCH 1/9] fixing some issues when importing the module with MSVC++ --- .../execution/detail/basic_operation.hpp | 3 +- .../beman/execution/detail/basic_sender.hpp | 2 +- .../beman/execution/detail/basic_state.hpp | 3 +- .../beman/execution/detail/connect_all.hpp | 3 +- .../beman/execution/detail/default_impls.hpp | 41 +++--- include/beman/execution/detail/env.hpp | 28 ++-- .../beman/execution/detail/indices_for.hpp | 3 +- infra/cmake/llvm-toolchain.cmake | 2 +- src/beman/execution/execution.cppm | 121 +++++++++--------- 9 files changed, 106 insertions(+), 100 deletions(-) diff --git a/include/beman/execution/detail/basic_operation.hpp b/include/beman/execution/detail/basic_operation.hpp index be78f56b..94718bf1 100644 --- a/include/beman/execution/detail/basic_operation.hpp +++ b/include/beman/execution/detail/basic_operation.hpp @@ -25,7 +25,8 @@ namespace beman::execution::detail { * \headerfile beman/execution/execution.hpp * \internal */ -template +//-dk:TODO the export below shouldn't be needed, but MSVC++ seems to require it (2026-02-01) +BEMAN_EXECUTION_EXPORT template requires ::beman::execution::detail:: //-dk:TODO why is the remove_cvref_t needed...? valid_specialization<::beman::execution::detail::state_type, std::remove_cvref_t, Receiver> diff --git a/include/beman/execution/detail/basic_sender.hpp b/include/beman/execution/detail/basic_sender.hpp index a7e1bc92..480cabd1 100644 --- a/include/beman/execution/detail/basic_sender.hpp +++ b/include/beman/execution/detail/basic_sender.hpp @@ -43,7 +43,7 @@ struct basic_sender : ::beman::execution::detail::product_type) auto connect(Receiver receiver) = BEMAN_EXECUTION_DELETE("the passed receiver doesn't model receiver"); - private: + // private: #if __cpp_explicit_this_parameter < 302110L //-dk:TODO need to figure out how to use explicit this with forwarding template <::beman::execution::receiver Receiver> auto connect(Receiver receiver) & noexcept( diff --git a/include/beman/execution/detail/basic_state.hpp b/include/beman/execution/detail/basic_state.hpp index 62d7b781..390ee05c 100644 --- a/include/beman/execution/detail/basic_state.hpp +++ b/include/beman/execution/detail/basic_state.hpp @@ -20,7 +20,8 @@ namespace beman::execution::detail { * \headerfile beman/execution/execution.hpp * \internal */ -template +//-dk:TODO the export below shouldn't be needed, but MSVC++ seems to require it (2026-02-01) +BEMAN_EXECUTION_EXPORT template struct basic_state { basic_state(Sender&& sender, Receiver&& rcvr) noexcept(true) : receiver(::std::move(rcvr)), diff --git a/include/beman/execution/detail/connect_all.hpp b/include/beman/execution/detail/connect_all.hpp index afc36186..1c2fee0c 100644 --- a/include/beman/execution/detail/connect_all.hpp +++ b/include/beman/execution/detail/connect_all.hpp @@ -122,7 +122,8 @@ struct connect_all_t { * \headerfile beman/execution/execution.hpp * \internal */ -inline constexpr connect_all_t connect_all{}; +//-dk:TODO the export below shouldn't be needed, but MSVC++ seems to require it (2026-02-01) +BEMAN_EXECUTION_EXPORT constexpr connect_all_t connect_all{}; } // namespace beman::execution::detail #include diff --git a/include/beman/execution/detail/default_impls.hpp b/include/beman/execution/detail/default_impls.hpp index 5576c902..a742e6c4 100644 --- a/include/beman/execution/detail/default_impls.hpp +++ b/include/beman/execution/detail/default_impls.hpp @@ -36,27 +36,34 @@ struct default_impls { } }; static constexpr auto get_attrs = get_attrs_impl{}; - static constexpr auto get_env = [](auto, auto&, const auto& receiver) noexcept -> decltype(auto) { - return ::beman::execution::detail::fwd_env(::beman::execution::get_env(receiver)); + struct get_env_impl { + auto operator()(auto, auto&, const auto& receiver) const noexcept -> decltype(auto) { + return ::beman::execution::detail::fwd_env(::beman::execution::get_env(receiver)); + } }; - static constexpr auto get_state = - [](Sender&& sender, Receiver& receiver) noexcept -> decltype(auto) { - auto&& data{[&sender]() -> decltype(auto) { - if constexpr (requires { - sender.size(); - sender.template get<1>(); - }) - return sender.template get<1>(); - else - return ::beman::execution::detail::get_sender_data(::std::forward(sender)).data; - }()}; + static constexpr auto get_env = get_env_impl{}; + struct get_state_impl { + template + auto operator()(Sender&& sender, Receiver& receiver) const noexcept -> decltype(auto) { + auto&& data{[&sender]() -> decltype(auto) { + if constexpr (requires { + sender.size(); + sender.template get<1>(); + }) + return sender.template get<1>(); + else + return ::beman::execution::detail::get_sender_data(::std::forward(sender)).data; + }()}; - return ::beman::execution::detail::allocator_aware_move(::beman::execution::detail::forward_like(data), - receiver); + return ::beman::execution::detail::allocator_aware_move( + ::beman::execution::detail::forward_like(data), receiver); + } }; - static constexpr auto start = [](auto&, auto&, auto&... ops) noexcept -> void { - (::beman::execution::start(ops), ...); + static constexpr auto get_state = get_state_impl{}; + struct start_impl { + auto operator()(auto&, auto&, auto&... ops) const noexcept -> void { (::beman::execution::start(ops), ...); } }; + static constexpr auto start = start_impl{}; static constexpr auto complete = []( Index, auto&, Receiver& receiver, Tag, Args&&... args) noexcept -> void requires ::beman::execution::detail::callable diff --git a/include/beman/execution/detail/env.hpp b/include/beman/execution/detail/env.hpp index a5e9c072..9b87229b 100644 --- a/include/beman/execution/detail/env.hpp +++ b/include/beman/execution/detail/env.hpp @@ -12,8 +12,10 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -template <::beman::execution::detail::queryable> -struct env_base; +template <::beman::execution::detail::queryable Env> +struct env_base { + Env env_; +}; template concept has_query = requires(const E& e) { e.query(::std::declval()); }; @@ -32,23 +34,11 @@ struct find_env { }; } // namespace beman::execution::detail -namespace beman::execution { -BEMAN_EXECUTION_EXPORT template <::beman::execution::detail::queryable... Envs> -struct env; - -template <::beman::execution::detail::queryable... Envs> -env(Envs...) -> env<::std::unwrap_reference_t...>; -} // namespace beman::execution - // ---------------------------------------------------------------------------- -template <::beman::execution::detail::queryable Env> -struct beman::execution::detail::env_base { - Env env_; -}; - -template <::beman::execution::detail::queryable... Envs> -struct beman::execution::env : ::beman::execution::detail::env_base... { +namespace beman::execution { +BEMAN_EXECUTION_EXPORT template <::beman::execution::detail::queryable... Envs> +struct env : ::beman::execution::detail::env_base... { [[no_unique_address]] ::beman::execution::detail::non_assignable na_{}; template @@ -59,6 +49,10 @@ struct beman::execution::env : ::beman::execution::detail::env_base... { } }; +template <::beman::execution::detail::queryable... Envs> +env(Envs...) -> env<::std::unwrap_reference_t...>; +} // namespace beman::execution + // ---------------------------------------------------------------------------- #endif // INCLUDED_BEMAN_EXECUTION_DETAIL_ENV diff --git a/include/beman/execution/detail/indices_for.hpp b/include/beman/execution/detail/indices_for.hpp index c5f9ce29..fcff6fef 100644 --- a/include/beman/execution/detail/indices_for.hpp +++ b/include/beman/execution/detail/indices_for.hpp @@ -10,7 +10,8 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -template +//-dk:TODO the export below shouldn't be needed, but MSVC++ seems to require it (2026-02-01) +BEMAN_EXECUTION_EXPORT template using indices_for = typename ::std::remove_reference_t::indices_for; } diff --git a/infra/cmake/llvm-toolchain.cmake b/infra/cmake/llvm-toolchain.cmake index f1623b7e..98c22391 100644 --- a/infra/cmake/llvm-toolchain.cmake +++ b/infra/cmake/llvm-toolchain.cmake @@ -20,7 +20,7 @@ set(CMAKE_CXX_COMPILER clang++) if(BEMAN_BUILDSYS_SANITIZER STREQUAL "MaxSan") set(SANITIZER_FLAGS - "-fsanitize=address -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined -fsanitize-undefined-trap-on-error" + "-fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined -fsanitize-undefined-trap-on-error" ) elseif(BEMAN_BUILDSYS_SANITIZER STREQUAL "TSan") set(SANITIZER_FLAGS "-fsanitize=thread") diff --git a/src/beman/execution/execution.cppm b/src/beman/execution/execution.cppm index 5827331d..1916bb69 100644 --- a/src/beman/execution/execution.cppm +++ b/src/beman/execution/execution.cppm @@ -11,43 +11,43 @@ module; #ifdef BEMAN_HAS_IMPORT_STD import std; #else -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include -#line 240 "./bin/mk-module.py" +#line 239 "./bin/mk-module.py" #include #endif @@ -982,7 +982,8 @@ struct indirect_meta_apply { #line 12 "include/beman/execution/detail/indices_for.hpp" namespace beman::execution::detail { -template + +export /* --------- */ template using indices_for = typename ::std::remove_reference_t::indices_for; } #line 12 "include/beman/execution/detail/decayed_typeof.hpp" @@ -1004,8 +1005,10 @@ export /* --------- */ inline constexpr nostopstate_t nostopstate{}; #line 14 "include/beman/execution/detail/env.hpp" namespace beman::execution::detail { -template <::beman::execution::detail::queryable> -struct env_base; +template <::beman::execution::detail::queryable Env> +struct env_base { + Env env_; +}; template concept has_query = requires(const E& e) { e.query(::std::declval()); }; @@ -1024,22 +1027,10 @@ struct find_env { }; } // namespace beman::execution::detail +#line 39 "include/beman/execution/detail/env.hpp" namespace beman::execution { export /* --------- */ template <::beman::execution::detail::queryable... Envs> -struct env; - -template <::beman::execution::detail::queryable... Envs> -env(Envs...) -> env<::std::unwrap_reference_t...>; -} // namespace beman::execution - -#line 45 "include/beman/execution/detail/env.hpp" -template <::beman::execution::detail::queryable Env> -struct beman::execution::detail::env_base { - Env env_; -}; - -template <::beman::execution::detail::queryable... Envs> -struct beman::execution::env : ::beman::execution::detail::env_base... { +struct env : ::beman::execution::detail::env_base... { [[no_unique_address]] ::beman::execution::detail::non_assignable na_{}; template @@ -1050,6 +1041,9 @@ struct beman::execution::env : ::beman::execution::detail::env_base... { } }; +template <::beman::execution::detail::queryable... Envs> +env(Envs...) -> env<::std::unwrap_reference_t...>; +} // namespace beman::execution #line 17 "include/beman/execution/detail/get_allocator.hpp" namespace beman::execution { export /* --------- */ struct get_allocator_t { @@ -2283,27 +2277,34 @@ struct default_impls { } }; static constexpr auto get_attrs = get_attrs_impl{}; - static constexpr auto get_env = [](auto, auto&, const auto& receiver) noexcept -> decltype(auto) { - return ::beman::execution::detail::fwd_env(::beman::execution::get_env(receiver)); + struct get_env_impl { + auto operator()(auto, auto&, const auto& receiver) const noexcept -> decltype(auto) { + return ::beman::execution::detail::fwd_env(::beman::execution::get_env(receiver)); + } }; - static constexpr auto get_state = - [](Sender&& sender, Receiver& receiver) noexcept -> decltype(auto) { - auto&& data{[&sender]() -> decltype(auto) { - if constexpr (requires { - sender.size(); - sender.template get<1>(); - }) - return sender.template get<1>(); - else - return ::beman::execution::detail::get_sender_data(::std::forward(sender)).data; - }()}; + static constexpr auto get_env = get_env_impl{}; + struct get_state_impl { + template + auto operator()(Sender&& sender, Receiver& receiver) const noexcept -> decltype(auto) { + auto&& data{[&sender]() -> decltype(auto) { + if constexpr (requires { + sender.size(); + sender.template get<1>(); + }) + return sender.template get<1>(); + else + return ::beman::execution::detail::get_sender_data(::std::forward(sender)).data; + }()}; - return ::beman::execution::detail::allocator_aware_move(::beman::execution::detail::forward_like(data), - receiver); + return ::beman::execution::detail::allocator_aware_move( + ::beman::execution::detail::forward_like(data), receiver); + } }; - static constexpr auto start = [](auto&, auto&, auto&... ops) noexcept -> void { - (::beman::execution::start(ops), ...); + static constexpr auto get_state = get_state_impl{}; + struct start_impl { + auto operator()(auto&, auto&, auto&... ops) const noexcept -> void { (::beman::execution::start(ops), ...); } }; + static constexpr auto start = start_impl{}; static constexpr auto complete = []( Index, auto&, Receiver& receiver, Tag, Args&&... args) noexcept -> void requires ::beman::execution::detail::callable @@ -2727,8 +2728,8 @@ auto spawn_get_allocator(const Sndr& sndr, const Ev& ev) { #line 17 "include/beman/execution/detail/basic_state.hpp" namespace beman::execution::detail { -#line 23 "include/beman/execution/detail/basic_state.hpp" -template +#line 24 "include/beman/execution/detail/basic_state.hpp" +export /* --------- */ template struct basic_state { basic_state(Sender&& sender, Receiver&& rcvr) noexcept(true) : receiver(::std::move(rcvr)), @@ -3778,8 +3779,8 @@ struct connect_all_t { } }; -#line 125 "include/beman/execution/detail/connect_all.hpp" -inline constexpr connect_all_t connect_all{}; +#line 126 "include/beman/execution/detail/connect_all.hpp" +export /* --------- */ constexpr connect_all_t connect_all{}; } // namespace beman::execution::detail #line 18 "include/beman/execution/detail/error_types_of_t.hpp" @@ -3926,8 +3927,8 @@ export /* --------- */ inline constexpr ::beman::execution::sync_wait_t sync_wai #line 22 "include/beman/execution/detail/basic_operation.hpp" namespace beman::execution::detail { -#line 28 "include/beman/execution/detail/basic_operation.hpp" -template +#line 29 "include/beman/execution/detail/basic_operation.hpp" +export /* --------- */ template requires ::beman::execution::detail:: valid_specialization<::beman::execution::detail::state_type, std::remove_cvref_t, Receiver> @@ -4029,7 +4030,7 @@ struct basic_sender : ::beman::execution::detail::product_type) auto connect(Receiver receiver) = BEMAN_EXECUTION_DELETE("the passed receiver doesn't model receiver"); - private: +#line 47 "include/beman/execution/detail/basic_sender.hpp" #if __cpp_explicit_this_parameter < 302110L template <::beman::execution::receiver Receiver> auto connect(Receiver receiver) & noexcept( From 703188750108fea990f1a6b8e643ed67c5aa615f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 1 Feb 2026 12:29:43 +0100 Subject: [PATCH 2/9] saving an intermediate state --- Makefile | 18 +++++++++++- examples/CMakeLists.txt | 1 + examples/modules.cpp | 4 --- .../beman/execution/detail/apply_sender.hpp | 2 +- .../execution/detail/await_result_type.hpp | 2 +- .../beman/execution/detail/basic_sender.hpp | 2 +- .../execution/detail/stoppable_source.hpp | 2 +- include/beman/execution/detail/sync_wait.hpp | 8 +++--- src/beman/execution/execution.cppm | 28 +++++++++++-------- tests/beman/execution/CMakeLists.txt | 11 +++++--- tests/beman/execution/exec-awaitable.test.cpp | 13 +++++---- tests/beman/execution/exec-bulk.test.cpp | 8 ++---- .../execution/exec-into-variant.test.cpp | 10 +++---- .../execution/exec-scope-counting.test.cpp | 8 +++--- .../exec-scope-simple-counting.test.cpp | 8 +++--- tests/beman/execution/exec-snd-apply.test.cpp | 4 +-- tests/beman/execution/exec-sync-wait.test.cpp | 11 ++++---- tests/beman/execution/exec-when-all.test.cpp | 12 ++++---- .../execution/stoptoken-general.test.cpp | 4 +-- tests/beman/execution/stoptoken-mem.test.cpp | 8 +++--- 20 files changed, 91 insertions(+), 73 deletions(-) diff --git a/Makefile b/Makefile index 768395d0..96bbef00 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ SANITIZERS := run # SANITIZERS += asan # TODO: tsan msan # endif -.PHONY: default release debug doc run update check ce todo distclean clean codespell clang-tidy build test install all format unstage $(SANITIZERS) +.PHONY: default release debug doc run update check ce todo distclean clean codespell clang-tidy build test install all format unstage $(SANITIZERS) module build-module test-module SYSROOT ?= TOOLCHAIN ?= @@ -134,6 +134,22 @@ build: test: build ctest --test-dir $(BUILD) --rerun-failed --output-on-failure +module build-module: + cmake -G Ninja -S $(SOURCEDIR) -B $(BUILD) $(TOOLCHAIN) $(SYSROOT) \ + -D CMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -D CMAKE_SKIP_INSTALL_RULES=ON \ + -D CMAKE_CXX_STANDARD=23 \ + -D CMAKE_CXX_EXTENSIONS=ON \ + -D CMAKE_CXX_STANDARD_REQUIRED=ON \ + -D CMAKE_CXX_SCAN_FOR_MODULES=ON \ + -D BEMAN_USE_MODULES=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_CXX_COMPILER=$(CXX) --log-level=VERBOSE + cmake --build $(BUILD) + +test-module: build-module + ctest --test-dir $(BUILD) --rerun-failed --output-on-failure + install: test cmake --install $(BUILD) --prefix /opt/local diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 71ffabca..60e0dfc5 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -42,6 +42,7 @@ foreach(EXAMPLE ${EXAMPLES}) set(EXAMPLE_TARGET ${PROJECT_NAME}.${EXAMPLE}) add_executable(${EXAMPLE_TARGET}) target_sources(${EXAMPLE_TARGET} PRIVATE ${EXAMPLE}.cpp) + target_compile_definitions(${EXAMPLE_TARGET} PUBLIC BEMAN_HAS_MODULES) if(BEMAN_USE_MODULES) target_link_libraries(${EXAMPLE_TARGET} PRIVATE beman::execution) else() diff --git a/examples/modules.cpp b/examples/modules.cpp index a86f861c..d1ffb843 100644 --- a/examples/modules.cpp +++ b/examples/modules.cpp @@ -14,11 +14,7 @@ import std; #endif -#ifdef BEMAN_USE_MODULES import beman.execution; -#else -#include -#endif namespace ex = beman::execution; diff --git a/include/beman/execution/detail/apply_sender.hpp b/include/beman/execution/detail/apply_sender.hpp index 55ab8cf1..2cc63a66 100644 --- a/include/beman/execution/detail/apply_sender.hpp +++ b/include/beman/execution/detail/apply_sender.hpp @@ -29,7 +29,7 @@ constexpr auto apply_sender(Domain domain, Tag, Sender&& sender, Args&&... args) * \brief Default function used to transform a second and its arguments. * \headerfile beman/execution/execution.hpp */ -template +BEMAN_EXECUTION_EXPORT template requires(not requires(Domain domain, Tag tag, Sender&& sender, Args&&... args) { domain.apply_sender(Tag(), ::std::forward(sender), ::std::forward(args)...); }) && requires(Tag tag, Sender&& sender, Args&&... args) { diff --git a/include/beman/execution/detail/await_result_type.hpp b/include/beman/execution/detail/await_result_type.hpp index 51f82439..d8c51e0e 100644 --- a/include/beman/execution/detail/await_result_type.hpp +++ b/include/beman/execution/detail/await_result_type.hpp @@ -16,7 +16,7 @@ namespace beman::execution::detail { * \headerfile beman/execution/execution.hpp * \internal */ -template +BEMAN_EXECUTION_EXPORT template using await_result_type = decltype(::beman::execution::detail::get_awaiter(::std::declval(), ::std::declval()).await_resume()); } // namespace beman::execution::detail diff --git a/include/beman/execution/detail/basic_sender.hpp b/include/beman/execution/detail/basic_sender.hpp index 480cabd1..4f1540c7 100644 --- a/include/beman/execution/detail/basic_sender.hpp +++ b/include/beman/execution/detail/basic_sender.hpp @@ -43,7 +43,7 @@ struct basic_sender : ::beman::execution::detail::product_type) auto connect(Receiver receiver) = BEMAN_EXECUTION_DELETE("the passed receiver doesn't model receiver"); - // private: +private: #if __cpp_explicit_this_parameter < 302110L //-dk:TODO need to figure out how to use explicit this with forwarding template <::beman::execution::receiver Receiver> auto connect(Receiver receiver) & noexcept( diff --git a/include/beman/execution/detail/stoppable_source.hpp b/include/beman/execution/detail/stoppable_source.hpp index 570d80e0..596a7394 100644 --- a/include/beman/execution/detail/stoppable_source.hpp +++ b/include/beman/execution/detail/stoppable_source.hpp @@ -11,7 +11,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -template +BEMAN_EXECUTION_EXPORT template concept stoppable_source = requires(Source& source, const Source& csource) { { csource.get_token() } -> ::beman::execution::stoppable_token; { csource.stop_possible() } noexcept -> ::std::same_as; diff --git a/include/beman/execution/detail/sync_wait.hpp b/include/beman/execution/detail/sync_wait.hpp index 1c4bde65..1bd74db1 100644 --- a/include/beman/execution/detail/sync_wait.hpp +++ b/include/beman/execution/detail/sync_wait.hpp @@ -26,21 +26,21 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -struct sync_wait_env { +BEMAN_EXECUTION_EXPORT struct sync_wait_env { ::beman::execution::run_loop* loop{}; auto query(::beman::execution::get_scheduler_t) const noexcept { return this->loop->get_scheduler(); } auto query(::beman::execution::get_delegation_scheduler_t) const noexcept { return this->loop->get_scheduler(); } }; -template <::beman::execution::sender_in<::beman::execution::detail::sync_wait_env> Sender> +BEMAN_EXECUTION_EXPORT template <::beman::execution::sender_in<::beman::execution::detail::sync_wait_env> Sender> using sync_wait_result_type = ::std::optional<::beman::execution::value_types_of_t>; -template +BEMAN_EXECUTION_EXPORT template struct sync_wait_state { ::beman::execution::run_loop loop{}; ::std::exception_ptr error{}; @@ -48,7 +48,7 @@ struct sync_wait_state { ::beman::execution::detail::sync_wait_result_type result{}; }; -template +BEMAN_EXECUTION_EXPORT template struct sync_wait_receiver { using receiver_concept = ::beman::execution::receiver_t; diff --git a/src/beman/execution/execution.cppm b/src/beman/execution/execution.cppm index 1916bb69..3c815da0 100644 --- a/src/beman/execution/execution.cppm +++ b/src/beman/execution/execution.cppm @@ -711,7 +711,7 @@ template #line 19 "include/beman/execution/detail/call_result_t.hpp" using call_result_t = decltype(::std::declval()(std::declval()...)); -} // namespace beman::execution::detail +} #line 12 "include/beman/execution/detail/meta_size.hpp" namespace beman::execution::detail::meta { template @@ -1044,6 +1044,7 @@ struct env : ::beman::execution::detail::env_base... { template <::beman::execution::detail::queryable... Envs> env(Envs...) -> env<::std::unwrap_reference_t...>; } // namespace beman::execution + #line 17 "include/beman/execution/detail/get_allocator.hpp" namespace beman::execution { export /* --------- */ struct get_allocator_t { @@ -1245,7 +1246,7 @@ concept completion_tag = namespace beman::execution::detail { #line 19 "include/beman/execution/detail/await_result_type.hpp" -template +export /* --------- */ template using await_result_type = decltype(::beman::execution::detail::get_awaiter(::std::declval(), ::std::declval()).await_resume()); } // namespace beman::execution::detail @@ -2154,7 +2155,7 @@ using variant_or_empty = typename ::beman::execution::detail::variant_or_empty_h #line 13 "include/beman/execution/detail/stoppable_source.hpp" namespace beman::execution::detail { -template +export /* --------- */ template concept stoppable_source = requires(Source& source, const Source& csource) { { csource.get_token() } -> ::beman::execution::stoppable_token; { csource.stop_possible() } noexcept -> ::std::same_as; @@ -2947,7 +2948,7 @@ constexpr auto apply_sender(Domain domain, Tag, Sender&& sender, Args&&... args) return domain.apply_sender(Tag(), ::std::forward(sender), ::std::forward(args)...); } #line 32 "include/beman/execution/detail/apply_sender.hpp" -template +export /* --------- */ template requires(not requires(Domain domain, Tag tag, Sender&& sender, Args&&... args) { domain.apply_sender(Tag(), ::std::forward(sender), ::std::forward(args)...); }) && requires(Tag tag, Sender&& sender, Args&&... args) { @@ -3836,21 +3837,21 @@ using connect_all_result = #line 28 "include/beman/execution/detail/sync_wait.hpp" namespace beman::execution::detail { -struct sync_wait_env { +export /* --------- */ struct sync_wait_env { ::beman::execution::run_loop* loop{}; auto query(::beman::execution::get_scheduler_t) const noexcept { return this->loop->get_scheduler(); } auto query(::beman::execution::get_delegation_scheduler_t) const noexcept { return this->loop->get_scheduler(); } }; -template <::beman::execution::sender_in<::beman::execution::detail::sync_wait_env> Sender> +export /* --------- */ template <::beman::execution::sender_in<::beman::execution::detail::sync_wait_env> Sender> using sync_wait_result_type = ::std::optional<::beman::execution::value_types_of_t>; -template +export /* --------- */ template struct sync_wait_state { ::beman::execution::run_loop loop{}; ::std::exception_ptr error{}; @@ -3858,7 +3859,7 @@ struct sync_wait_state { ::beman::execution::detail::sync_wait_result_type result{}; }; -template +export /* --------- */ template struct sync_wait_receiver { using receiver_concept = ::beman::execution::receiver_t; @@ -3931,8 +3932,8 @@ namespace beman::execution::detail { export /* --------- */ template requires ::beman::execution::detail:: - valid_specialization<::beman::execution::detail::state_type, std::remove_cvref_t, Receiver> - struct basic_operation : ::beman::execution::detail::basic_state { + valid_specialization<::beman::execution::detail::state_type, std::remove_cvref_t, Receiver> +struct basic_operation : ::beman::execution::detail::basic_state { friend struct ::beman::execution::start_t; using operation_state_concept = ::beman::execution::operation_state_t; @@ -4030,7 +4031,7 @@ struct basic_sender : ::beman::execution::detail::product_type) auto connect(Receiver receiver) = BEMAN_EXECUTION_DELETE("the passed receiver doesn't model receiver"); -#line 47 "include/beman/execution/detail/basic_sender.hpp" +private: #if __cpp_explicit_this_parameter < 302110L template <::beman::execution::receiver Receiver> auto connect(Receiver receiver) & noexcept( @@ -4807,7 +4808,9 @@ struct completion_signatures_for_impl< using type = ::beman::execution::detail::meta::combine< decltype(::beman::execution::get_completion_signatures(::std::declval(), ::std::declval())), ::beman::execution::error_types_of_t, - ::beman::execution::completion_signatures<::beman::execution::set_error_t(::std::exception_ptr)>>; + ::beman::execution::completion_signatures<::beman::execution::set_error_t( + ::std::exception_ptr)> + >; }; } // namespace beman::execution::detail @@ -6477,3 +6480,4 @@ namespace beman::execution { export /* --------- */ using on_t = ::beman::execution::detail::on_t; export /* --------- */ inline constexpr ::beman::execution::on_t on{}; } // namespace beman::execution + diff --git a/tests/beman/execution/CMakeLists.txt b/tests/beman/execution/CMakeLists.txt index ec73465a..c9fb1a36 100644 --- a/tests/beman/execution/CMakeLists.txt +++ b/tests/beman/execution/CMakeLists.txt @@ -12,19 +12,16 @@ list( exec-affine-on.test issue-174.test issue-186.test - exec-scope-counting.test exec-spawn.test exec-stop-when.test non_assignable.test exec-prop.test exec-env.test - exec-scope-simple-counting.test exec-spawn-future.test exec-scope-concepts.test issue-144.test exec-on.test notify.test - exec-awaitable.test allocator-requirements-general.test exec-connect.test exec-continues-on.test @@ -55,7 +52,6 @@ list( exec-set-error.test exec-set-stopped.test exec-set-value.test - exec-snd-apply.test exec-snd-concepts.test exec-snd-expos.test exec-snd-transform.test @@ -107,6 +103,12 @@ list( thread.test utilities.test ) +set (TODO + exec-scope-simple-counting.test + exec-scope-counting.test + exec-snd-apply.test + exec-awaitable.test +) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -114,6 +116,7 @@ foreach(test ${execution_tests}) set(TEST_EXE ${PROJECT_NAME}.${test}) add_executable(${TEST_EXE} ${test}.cpp) if(BEMAN_USE_MODULES) + target_compile_definitions(${TEST_EXE} PUBLIC BEMAN_HAS_MODULES) target_link_libraries(${TEST_EXE} PRIVATE beman::execution) else() target_link_libraries(${TEST_EXE} PRIVATE beman::execution_headers) diff --git a/tests/beman/execution/exec-awaitable.test.cpp b/tests/beman/execution/exec-awaitable.test.cpp index ddc68b29..184e0f3c 100644 --- a/tests/beman/execution/exec-awaitable.test.cpp +++ b/tests/beman/execution/exec-awaitable.test.cpp @@ -1,21 +1,22 @@ // src/beman/execution/tests/exec-awaitable.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// #include +#include +#include +#include +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else -#include -#include #include -#include #include #include -#include #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-bulk.test.cpp b/tests/beman/execution/exec-bulk.test.cpp index c9213011..99647066 100644 --- a/tests/beman/execution/exec-bulk.test.cpp +++ b/tests/beman/execution/exec-bulk.test.cpp @@ -1,6 +1,9 @@ // src/beman/execution/tests/exec-bulk.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -8,11 +11,6 @@ import beman.execution; #include "beman/execution/detail/get_env.hpp" #include "beman/execution/detail/sync_wait.hpp" #endif -#include -#include -#include -#include -#include namespace { auto test_bulk() { diff --git a/tests/beman/execution/exec-into-variant.test.cpp b/tests/beman/execution/exec-into-variant.test.cpp index 096ef92c..915eb643 100644 --- a/tests/beman/execution/exec-into-variant.test.cpp +++ b/tests/beman/execution/exec-into-variant.test.cpp @@ -1,6 +1,11 @@ // src/beman/execution/tests/exec-into-variant.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -11,11 +16,6 @@ import beman.execution; #include #include #endif -#include - -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-scope-counting.test.cpp b/tests/beman/execution/exec-scope-counting.test.cpp index 85eeca8d..3115730f 100644 --- a/tests/beman/execution/exec-scope-counting.test.cpp +++ b/tests/beman/execution/exec-scope-counting.test.cpp @@ -1,6 +1,10 @@ // tests/beman/execution/exec-scope-counting.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -9,10 +13,6 @@ import beman.execution; #include #include #endif -#include -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-scope-simple-counting.test.cpp b/tests/beman/execution/exec-scope-simple-counting.test.cpp index c9733448..8a66b550 100644 --- a/tests/beman/execution/exec-scope-simple-counting.test.cpp +++ b/tests/beman/execution/exec-scope-simple-counting.test.cpp @@ -1,6 +1,10 @@ // tests/beman/execution/exec-scope-simple-counting.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -9,10 +13,6 @@ import beman.execution; #include #include #endif -#include -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-snd-apply.test.cpp b/tests/beman/execution/exec-snd-apply.test.cpp index bd77e331..a4239dfd 100644 --- a/tests/beman/execution/exec-snd-apply.test.cpp +++ b/tests/beman/execution/exec-snd-apply.test.cpp @@ -1,13 +1,13 @@ // src/beman/execution/tests/exec-snd-apply.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-sync-wait.test.cpp b/tests/beman/execution/exec-sync-wait.test.cpp index 73cbdb42..924e0b76 100644 --- a/tests/beman/execution/exec-sync-wait.test.cpp +++ b/tests/beman/execution/exec-sync-wait.test.cpp @@ -1,17 +1,16 @@ // src/beman/execution/tests/exec-sync-wait.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include + #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include - -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-when-all.test.cpp b/tests/beman/execution/exec-when-all.test.cpp index 2da62207..3998081c 100644 --- a/tests/beman/execution/exec-when-all.test.cpp +++ b/tests/beman/execution/exec-when-all.test.cpp @@ -1,6 +1,12 @@ // src/beman/execution/tests/exec-when-all.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include +#include +// #include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -9,12 +15,6 @@ import beman.execution; #include #include #endif -#include -#include -#include -#include - -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/stoptoken-general.test.cpp b/tests/beman/execution/stoptoken-general.test.cpp index 501dced4..9de070ba 100644 --- a/tests/beman/execution/stoptoken-general.test.cpp +++ b/tests/beman/execution/stoptoken-general.test.cpp @@ -1,13 +1,13 @@ // src/beman/execution/tests/stoptoken-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include "test/execution.hpp" +#include "test/stop_token.hpp" #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include "test/execution.hpp" -#include "test/stop_token.hpp" TEST(stoptoken_general) { // [stoptoken.general] p1: diff --git a/tests/beman/execution/stoptoken-mem.test.cpp b/tests/beman/execution/stoptoken-mem.test.cpp index 2b1836fa..9b2dedad 100644 --- a/tests/beman/execution/stoptoken-mem.test.cpp +++ b/tests/beman/execution/stoptoken-mem.test.cpp @@ -1,15 +1,15 @@ // src/beman/execution/tests/stoptoken-mem.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include "test/execution.hpp" +#include "test/stop_token.hpp" #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include "test/execution.hpp" -#include "test/stop_token.hpp" namespace { auto test_stop_token_swap() -> void { From ac4ce023ea8459da21f06404d2dfdef1cb38b684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 1 Feb 2026 12:44:41 +0100 Subject: [PATCH 3/9] got most tests to compile with modules on clang --- tests/beman/execution/CMakeLists.txt | 2 +- tests/beman/execution/exec-get-env.test.cpp | 2 +- tests/beman/execution/exec-recv.test.cpp | 2 +- tests/beman/execution/exec-set-error.test.cpp | 2 +- tests/beman/execution/exec-set-stopped.test.cpp | 2 +- .../execution/execution-queryable-concept.test.cpp | 2 +- tests/beman/execution/functional-syn.test.cpp | 2 +- tests/beman/execution/stopcallback-cons.test.cpp | 2 +- tests/beman/execution/stopcallback-general.test.cpp | 2 +- .../beman/execution/stopcallback-inplace-cons.test.cpp | 2 +- .../execution/stopcallback-inplace-general.test.cpp | 2 +- tests/beman/execution/stopcallback-inplace.test.cpp | 2 +- tests/beman/execution/stopsource-cons.test.cpp | 2 +- tests/beman/execution/stopsource-general.test.cpp | 4 ++-- tests/beman/execution/stopsource-inplace-cons.test.cpp | 2 +- .../execution/stopsource-inplace-general.test.cpp | 4 ++-- tests/beman/execution/stopsource-inplace-mem.test.cpp | 2 +- tests/beman/execution/stopsource-inplace.test.cpp | 2 +- tests/beman/execution/stopsource-mem.test.cpp | 2 +- tests/beman/execution/stopsource.test.cpp | 2 +- tests/beman/execution/stoptoken-concepts.test.cpp | 2 +- tests/beman/execution/stoptoken-general.test.cpp | 4 ++-- .../beman/execution/stoptoken-inplace-general.test.cpp | 2 +- .../beman/execution/stoptoken-inplace-members.test.cpp | 2 +- tests/beman/execution/stoptoken-inplace.test.cpp | 2 +- tests/beman/execution/stoptoken-mem.test.cpp | 4 ++-- tests/beman/execution/stoptoken-never-general.test.cpp | 2 +- tests/beman/execution/stoptoken-never.test.cpp | 2 +- tests/beman/execution/stoptoken.test.cpp | 2 +- tests/beman/execution/thread-stoptoken-intro.test.cpp | 10 +++++++--- .../execution/thread-stoptoken-syn.compile.test.cpp | 2 +- tests/beman/execution/thread-stoptoken.test.cpp | 2 +- tests/beman/execution/thread.test.cpp | 2 +- tests/beman/execution/utilities.test.cpp | 2 +- 34 files changed, 44 insertions(+), 40 deletions(-) diff --git a/tests/beman/execution/CMakeLists.txt b/tests/beman/execution/CMakeLists.txt index c9fb1a36..a22f0a15 100644 --- a/tests/beman/execution/CMakeLists.txt +++ b/tests/beman/execution/CMakeLists.txt @@ -83,7 +83,6 @@ list( stopsource-cons.test stopsource-general.test stopsource-inplace-cons.test - stopsource-inplace-general.test stopsource-inplace-mem.test stopsource-inplace.test stopsource-mem.test @@ -108,6 +107,7 @@ set (TODO exec-scope-counting.test exec-snd-apply.test exec-awaitable.test + stopsource-inplace-general.test ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/tests/beman/execution/exec-get-env.test.cpp b/tests/beman/execution/exec-get-env.test.cpp index 436f154d..cdec72c3 100644 --- a/tests/beman/execution/exec-get-env.test.cpp +++ b/tests/beman/execution/exec-get-env.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include diff --git a/tests/beman/execution/exec-recv.test.cpp b/tests/beman/execution/exec-recv.test.cpp index 3b89d993..69785e1b 100644 --- a/tests/beman/execution/exec-recv.test.cpp +++ b/tests/beman/execution/exec-recv.test.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#include "test/execution.hpp" +#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-set-error.test.cpp b/tests/beman/execution/exec-set-error.test.cpp index 446a3e4c..dbfbe573 100644 --- a/tests/beman/execution/exec-set-error.test.cpp +++ b/tests/beman/execution/exec-set-error.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include diff --git a/tests/beman/execution/exec-set-stopped.test.cpp b/tests/beman/execution/exec-set-stopped.test.cpp index f9bbf787..a78ebc94 100644 --- a/tests/beman/execution/exec-set-stopped.test.cpp +++ b/tests/beman/execution/exec-set-stopped.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include diff --git a/tests/beman/execution/execution-queryable-concept.test.cpp b/tests/beman/execution/execution-queryable-concept.test.cpp index da186d39..e5a6cf8b 100644 --- a/tests/beman/execution/execution-queryable-concept.test.cpp +++ b/tests/beman/execution/execution-queryable-concept.test.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#include "test/execution.hpp" +#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/functional-syn.test.cpp b/tests/beman/execution/functional-syn.test.cpp index e3d0e78d..6b6d8739 100644 --- a/tests/beman/execution/functional-syn.test.cpp +++ b/tests/beman/execution/functional-syn.test.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#include "test/execution.hpp" +#include #include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/stopcallback-cons.test.cpp b/tests/beman/execution/stopcallback-cons.test.cpp index 8549a9d1..02095ec7 100644 --- a/tests/beman/execution/stopcallback-cons.test.cpp +++ b/tests/beman/execution/stopcallback-cons.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include diff --git a/tests/beman/execution/stopcallback-general.test.cpp b/tests/beman/execution/stopcallback-general.test.cpp index 52cba985..6998b924 100644 --- a/tests/beman/execution/stopcallback-general.test.cpp +++ b/tests/beman/execution/stopcallback-general.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include diff --git a/tests/beman/execution/stopcallback-inplace-cons.test.cpp b/tests/beman/execution/stopcallback-inplace-cons.test.cpp index e24cd244..bde56e70 100644 --- a/tests/beman/execution/stopcallback-inplace-cons.test.cpp +++ b/tests/beman/execution/stopcallback-inplace-cons.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include namespace { auto test_inplace_stopcallback_ctor() -> void { diff --git a/tests/beman/execution/stopcallback-inplace-general.test.cpp b/tests/beman/execution/stopcallback-inplace-general.test.cpp index cd5552ce..ea738fd4 100644 --- a/tests/beman/execution/stopcallback-inplace-general.test.cpp +++ b/tests/beman/execution/stopcallback-inplace-general.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include diff --git a/tests/beman/execution/stopcallback-inplace.test.cpp b/tests/beman/execution/stopcallback-inplace.test.cpp index f56a5045..7b6026a2 100644 --- a/tests/beman/execution/stopcallback-inplace.test.cpp +++ b/tests/beman/execution/stopcallback-inplace.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include TEST(stopcallback_inplace) { // section [stopcallback.inplace] is empty diff --git a/tests/beman/execution/stopsource-cons.test.cpp b/tests/beman/execution/stopsource-cons.test.cpp index 9322d5bf..be7808de 100644 --- a/tests/beman/execution/stopsource-cons.test.cpp +++ b/tests/beman/execution/stopsource-cons.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include #include diff --git a/tests/beman/execution/stopsource-general.test.cpp b/tests/beman/execution/stopsource-general.test.cpp index ae9f2442..cc7710be 100644 --- a/tests/beman/execution/stopsource-general.test.cpp +++ b/tests/beman/execution/stopsource-general.test.cpp @@ -6,8 +6,8 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" -#include "test/stop_token.hpp" +#include +#include #include TEST(stopsource_general) { diff --git a/tests/beman/execution/stopsource-inplace-cons.test.cpp b/tests/beman/execution/stopsource-inplace-cons.test.cpp index 5650a933..2bd293aa 100644 --- a/tests/beman/execution/stopsource-inplace-cons.test.cpp +++ b/tests/beman/execution/stopsource-inplace-cons.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include TEST(stopsource_inplace_cons) { diff --git a/tests/beman/execution/stopsource-inplace-general.test.cpp b/tests/beman/execution/stopsource-inplace-general.test.cpp index 6a684dc0..34950122 100644 --- a/tests/beman/execution/stopsource-inplace-general.test.cpp +++ b/tests/beman/execution/stopsource-inplace-general.test.cpp @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#include "test/execution.hpp" -#include "test/stop_token.hpp" +#include +#include TEST(stopsource_inplace_general) { // Reference: [stopsource.inplace.general] diff --git a/tests/beman/execution/stopsource-inplace-mem.test.cpp b/tests/beman/execution/stopsource-inplace-mem.test.cpp index 829c3848..086f7f41 100644 --- a/tests/beman/execution/stopsource-inplace-mem.test.cpp +++ b/tests/beman/execution/stopsource-inplace-mem.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include namespace { auto test_inplace_stop_source_get_token() -> void { diff --git a/tests/beman/execution/stopsource-inplace.test.cpp b/tests/beman/execution/stopsource-inplace.test.cpp index fef20312..91f2b1a8 100644 --- a/tests/beman/execution/stopsource-inplace.test.cpp +++ b/tests/beman/execution/stopsource-inplace.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/stopsource-inplace.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(stopsource_inplace) { // section [stopsource.inplace] is empty diff --git a/tests/beman/execution/stopsource-mem.test.cpp b/tests/beman/execution/stopsource-mem.test.cpp index 2a605f59..1aefb6b0 100644 --- a/tests/beman/execution/stopsource-mem.test.cpp +++ b/tests/beman/execution/stopsource-mem.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include namespace { auto test_stopsource_swap() -> void { diff --git a/tests/beman/execution/stopsource.test.cpp b/tests/beman/execution/stopsource.test.cpp index 7ca9ba20..21e24362 100644 --- a/tests/beman/execution/stopsource.test.cpp +++ b/tests/beman/execution/stopsource.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/stopsource.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(stopsource) { // section [thread] is empty diff --git a/tests/beman/execution/stoptoken-concepts.test.cpp b/tests/beman/execution/stoptoken-concepts.test.cpp index fa7bdeaa..732f4c70 100644 --- a/tests/beman/execution/stoptoken-concepts.test.cpp +++ b/tests/beman/execution/stoptoken-concepts.test.cpp @@ -3,7 +3,7 @@ #include #include -#include "test/execution.hpp" +#include namespace { namespace detail_stopppable_callback_for { diff --git a/tests/beman/execution/stoptoken-general.test.cpp b/tests/beman/execution/stoptoken-general.test.cpp index 9de070ba..fb679493 100644 --- a/tests/beman/execution/stoptoken-general.test.cpp +++ b/tests/beman/execution/stoptoken-general.test.cpp @@ -1,8 +1,8 @@ // src/beman/execution/tests/stoptoken-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" -#include "test/stop_token.hpp" +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else diff --git a/tests/beman/execution/stoptoken-inplace-general.test.cpp b/tests/beman/execution/stoptoken-inplace-general.test.cpp index 552e40b5..bd883d78 100644 --- a/tests/beman/execution/stoptoken-inplace-general.test.cpp +++ b/tests/beman/execution/stoptoken-inplace-general.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include #include #include diff --git a/tests/beman/execution/stoptoken-inplace-members.test.cpp b/tests/beman/execution/stoptoken-inplace-members.test.cpp index 4115289b..bd77ca2d 100644 --- a/tests/beman/execution/stoptoken-inplace-members.test.cpp +++ b/tests/beman/execution/stoptoken-inplace-members.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include namespace { auto test_inplace_stop_token_swap() -> void { diff --git a/tests/beman/execution/stoptoken-inplace.test.cpp b/tests/beman/execution/stoptoken-inplace.test.cpp index c5ec660c..05d8a475 100644 --- a/tests/beman/execution/stoptoken-inplace.test.cpp +++ b/tests/beman/execution/stoptoken-inplace.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/stoptoken-inplace.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(stoptoken_inplace) { // section [stoptoken.inplace] is empty diff --git a/tests/beman/execution/stoptoken-mem.test.cpp b/tests/beman/execution/stoptoken-mem.test.cpp index 9b2dedad..796274c2 100644 --- a/tests/beman/execution/stoptoken-mem.test.cpp +++ b/tests/beman/execution/stoptoken-mem.test.cpp @@ -3,8 +3,8 @@ #include #include -#include "test/execution.hpp" -#include "test/stop_token.hpp" +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else diff --git a/tests/beman/execution/stoptoken-never-general.test.cpp b/tests/beman/execution/stoptoken-never-general.test.cpp index 148cd5e6..8335300c 100644 --- a/tests/beman/execution/stoptoken-never-general.test.cpp +++ b/tests/beman/execution/stoptoken-never-general.test.cpp @@ -6,7 +6,7 @@ import beman.execution; #else #include #endif -#include "test/execution.hpp" +#include TEST(stoptoken_never_general) { // Reference: [stoptoken.never.general] diff --git a/tests/beman/execution/stoptoken-never.test.cpp b/tests/beman/execution/stoptoken-never.test.cpp index abb8f0c9..8036f98e 100644 --- a/tests/beman/execution/stoptoken-never.test.cpp +++ b/tests/beman/execution/stoptoken-never.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/stoptoken-never.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(stoptoken_never) { // section [stoptoken.never] is empty diff --git a/tests/beman/execution/stoptoken.test.cpp b/tests/beman/execution/stoptoken.test.cpp index b1a5250b..09f7b7a8 100644 --- a/tests/beman/execution/stoptoken.test.cpp +++ b/tests/beman/execution/stoptoken.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/stoptoken.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(stoptoken) { // section [stoptoken] is empty diff --git a/tests/beman/execution/thread-stoptoken-intro.test.cpp b/tests/beman/execution/thread-stoptoken-intro.test.cpp index 45b1351c..37cc7e5d 100644 --- a/tests/beman/execution/thread-stoptoken-intro.test.cpp +++ b/tests/beman/execution/thread-stoptoken-intro.test.cpp @@ -1,11 +1,15 @@ // src/beman/execution/tests/thread-stoptoken-intro.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include -#include "test/execution.hpp" -#include "test/stop_token.hpp" +#include +#include #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif namespace { struct test_source : test_detail::immovable { diff --git a/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp b/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp index 0c1bfef0..91336d62 100644 --- a/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp +++ b/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -#include "test/execution.hpp" +#include namespace { template diff --git a/tests/beman/execution/thread-stoptoken.test.cpp b/tests/beman/execution/thread-stoptoken.test.cpp index f65d973f..71cddaca 100644 --- a/tests/beman/execution/thread-stoptoken.test.cpp +++ b/tests/beman/execution/thread-stoptoken.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/thread-stoptoken.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(thread_stoptoken) { // section [thread.stoptoken] is empty diff --git a/tests/beman/execution/thread.test.cpp b/tests/beman/execution/thread.test.cpp index a432840f..073066f5 100644 --- a/tests/beman/execution/thread.test.cpp +++ b/tests/beman/execution/thread.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/thread.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(thread) { // section [thread] is empty diff --git a/tests/beman/execution/utilities.test.cpp b/tests/beman/execution/utilities.test.cpp index f826c849..e670ade4 100644 --- a/tests/beman/execution/utilities.test.cpp +++ b/tests/beman/execution/utilities.test.cpp @@ -1,7 +1,7 @@ // src/beman/execution/tests/utilities.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "test/execution.hpp" +#include TEST(utilities) { // section [utilities] is empty From 569009bdf2c1a3d03ec34c0e9b7ea4414e28d94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 1 Feb 2026 20:23:47 +0100 Subject: [PATCH 4/9] saving another intermediate state --- Makefile | 4 +- examples/CMakeLists.txt | 1 + include/beman/execution/detail/affine_on.hpp | 30 ++--- .../beman/execution/detail/basic_sender.hpp | 2 +- .../beman/execution/detail/default_impls.hpp | 16 ++- include/beman/execution/detail/fwd_env.hpp | 2 +- .../execution/detail/has_completions.hpp | 15 --- include/beman/execution/detail/join_env.hpp | 38 +++--- .../execution/detail/valid_completion_for.hpp | 2 +- src/beman/execution/execution.cppm | 122 ++++++++---------- tests/beman/execution/CMakeLists.txt | 3 +- tests/beman/execution/exec-affine-on.test.cpp | 10 +- tests/beman/execution/exec-bulk.test.cpp | 2 + tests/beman/execution/exec-env.test.cpp | 5 +- tests/beman/execution/exec-snd-expos.test.cpp | 8 +- tests/beman/execution/exec-sync-wait.test.cpp | 1 + tests/beman/execution/exec-when-all.test.cpp | 1 + tests/beman/execution/issue-174.test.cpp | 6 +- tests/beman/execution/stopsource-mem.test.cpp | 3 +- 19 files changed, 128 insertions(+), 143 deletions(-) diff --git a/Makefile b/Makefile index 96bbef00..92d18709 100644 --- a/Makefile +++ b/Makefile @@ -157,13 +157,13 @@ CMakeUserPresets.json:: cmake/CMakeUserPresets.json ln -s $< $@ # ========================================================== -release: CMakeUserPresets.json +appleclang-release llvm-release release: #-dk: I'm not sure why that is needed: CMakeUserPresets.json cmake --preset $@ --log-level=TRACE # XXX --fresh ln -fs $(BUILDROOT)/$@/compile_commands.json . cmake --workflow --preset $@ # ========================================================== -debug: CMakeUserPresets.json +appleclang-debug llvm-debug debug: #-dk: I'm not sure why that is needed: CMakeUserPresets.json cmake --preset $@ --log-level=TRACE # XXX --fresh ln -fs $(BUILDROOT)build/$@/compile_commands.json . cmake --workflow --preset $@ diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 60e0dfc5..6cf3246d 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -37,6 +37,7 @@ set(EXAMPLES if(BEMAN_USE_MODULES) list(APPEND EXAMPLES modules) # modules.cpp endif() +set(EXAMPLES) foreach(EXAMPLE ${EXAMPLES}) set(EXAMPLE_TARGET ${PROJECT_NAME}.${EXAMPLE}) diff --git a/include/beman/execution/detail/affine_on.hpp b/include/beman/execution/detail/affine_on.hpp index 45a3ea15..44078900 100644 --- a/include/beman/execution/detail/affine_on.hpp +++ b/include/beman/execution/detail/affine_on.hpp @@ -34,6 +34,19 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { +template +struct affine_on_env { + Ev ev_; + auto query(const ::beman::execution::get_stop_token_t&) const noexcept -> ::beman::execution::never_stop_token { + return ::beman::execution::never_stop_token(); + } + template + auto query(const Q& q) const noexcept -> decltype(q(this->ev_)) { + return q(this->ev_); + } +}; +template +affine_on_env(const Ev&) -> affine_on_env; /** * @brief The affine_on_t struct is a sender adaptor closure that transforms a sender @@ -66,21 +79,6 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { */ auto operator()() const { return ::beman::execution::detail::sender_adaptor{*this}; } - template - struct ao_env { - Ev ev_; - auto query(const ::beman::execution::get_stop_token_t&) const noexcept - -> ::beman::execution::never_stop_token { - return ::beman::execution::never_stop_token(); - } - template - auto query(const Q& q) const noexcept -> decltype(q(this->ev_)) { - return q(this->ev_); - } - }; - template - ao_env(const Ev&) -> ao_env; - /** * @brief affine_on is implemented by transforming it into a use of schedule_from. * @@ -124,7 +122,7 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { ::beman::execution::schedule_from( ::beman::execution::get_scheduler(ev), ::beman::execution::write_env(::beman::execution::detail::forward_like(child), ev)), - ao_env(ev)); + beman::execution::detail::affine_on_env(ev)); } } }; diff --git a/include/beman/execution/detail/basic_sender.hpp b/include/beman/execution/detail/basic_sender.hpp index 4f1540c7..a7e1bc92 100644 --- a/include/beman/execution/detail/basic_sender.hpp +++ b/include/beman/execution/detail/basic_sender.hpp @@ -43,7 +43,7 @@ struct basic_sender : ::beman::execution::detail::product_type) auto connect(Receiver receiver) = BEMAN_EXECUTION_DELETE("the passed receiver doesn't model receiver"); -private: + private: #if __cpp_explicit_this_parameter < 302110L //-dk:TODO need to figure out how to use explicit this with forwarding template <::beman::execution::receiver Receiver> auto connect(Receiver receiver) & noexcept( diff --git a/include/beman/execution/detail/default_impls.hpp b/include/beman/execution/detail/default_impls.hpp index a742e6c4..fc705570 100644 --- a/include/beman/execution/detail/default_impls.hpp +++ b/include/beman/execution/detail/default_impls.hpp @@ -63,14 +63,16 @@ struct default_impls { struct start_impl { auto operator()(auto&, auto&, auto&... ops) const noexcept -> void { (::beman::execution::start(ops), ...); } }; - static constexpr auto start = start_impl{}; - static constexpr auto complete = []( - Index, auto&, Receiver& receiver, Tag, Args&&... args) noexcept -> void - requires ::beman::execution::detail::callable - { - static_assert(Index::value == 0); - Tag()(::std::move(receiver), ::std::forward(args)...); + static constexpr auto start = start_impl{}; + struct complete_impl { + template + requires ::beman::execution::detail::callable + auto operator()(Index, auto&, Receiver& receiver, Tag, Args&&... args) const noexcept -> void { + static_assert(Index::value == 0); + Tag()(::std::move(receiver), ::std::forward(args)...); + } }; + static constexpr auto complete = complete_impl{}; }; } // namespace beman::execution::detail diff --git a/include/beman/execution/detail/fwd_env.hpp b/include/beman/execution/detail/fwd_env.hpp index 9c6b27e2..92a83908 100644 --- a/include/beman/execution/detail/fwd_env.hpp +++ b/include/beman/execution/detail/fwd_env.hpp @@ -19,7 +19,7 @@ namespace beman::execution::detail { * \headerfile beman/execution/execution.hpp * \internal */ -template +BEMAN_EXECUTION_EXPORT template class fwd_env { private: Env env; diff --git a/include/beman/execution/detail/has_completions.hpp b/include/beman/execution/detail/has_completions.hpp index ec756ff6..24d747ab 100644 --- a/include/beman/execution/detail/has_completions.hpp +++ b/include/beman/execution/detail/has_completions.hpp @@ -11,26 +11,11 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -#if not defined(__clang__) -// The version of clang current (2024-09-01) installed on my Mac crashes -// with this code - thus, there is a work-around. template concept has_completions = requires(Completions* completions) { []<::beman::execution::detail::valid_completion_for... Signatures>( ::beman::execution::completion_signatures*) {}(completions); }; -#else -template -struct has_completions_aux; -template -struct has_completions_aux> { - static constexpr bool value = - (::beman::execution::detail::valid_completion_for && ... && true); -}; - -template -concept has_completions = has_completions_aux::value; -#endif } // namespace beman::execution::detail // ---------------------------------------------------------------------------- diff --git a/include/beman/execution/detail/join_env.hpp b/include/beman/execution/detail/join_env.hpp index 01ee4592..65377ddd 100644 --- a/include/beman/execution/detail/join_env.hpp +++ b/include/beman/execution/detail/join_env.hpp @@ -11,7 +11,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -template +BEMAN_EXECUTION_EXPORT template class join_env { private: Env1 env1; @@ -21,33 +21,39 @@ class join_env { template join_env(E1&& e1, E2&& e2) : env1(::std::forward(e1)), env2(::std::forward(e2)) {} + template + requires requires(Env1&, const Query& query, Args&&... args) { + env1.query(query, ::std::forward(args)...); + } + auto query(const Query& query, Args&&... args) noexcept -> decltype(auto) { + return this->env1.query(query, ::std::forward(args)...); + } template requires( - requires(Env1&, const Query& query, Args&&... args) { + not requires(Env1&, const Query& query, Args&&... args) { env1.query(query, ::std::forward(args)...); - } || + } && requires(Env2& e2, const Query& query, Args&&... args) { e2.query(query, ::std::forward(args)...); }) auto query(const Query& query, Args&&... args) noexcept -> decltype(auto) { - if constexpr (requires { env1.query(query, ::std::forward(args)...); }) { - return env1.query(query, ::std::forward(args)...); - } else { - return env2.query(query, ::std::forward(args)...); + return this->env2.query(query, ::std::forward(args)...); + } + template + requires requires(const Env1& e1, const Query& query, Args&&... args) { + { e1.query(query, ::std::forward(args)...) } noexcept; } + auto query(const Query& query, Args&&... args) const noexcept -> decltype(auto) { + return this->env1.query(query, ::std::forward(args)...); } template requires( - requires(const Env1&, const Query& query, Args&&... args) { - env1.query(query, ::std::forward(args)...); - } || + not requires(const Env1& e1, const Query& query, Args&&... args) { + { e1.query(query, ::std::forward(args)...) } noexcept; + } && requires(const Env2& e2, const Query& query, Args&&... args) { - e2.query(query, ::std::forward(args)...); + { e2.query(query, ::std::forward(args)...) } noexcept; }) auto query(const Query& query, Args&&... args) const noexcept -> decltype(auto) { - if constexpr (requires { env1.query(query, ::std::forward(args)...); }) { - return env1.query(query, ::std::forward(args)...); - } else { - return env2.query(query, ::std::forward(args)...); - } + return this->env2.query(query, ::std::forward(args)...); } }; diff --git a/include/beman/execution/detail/valid_completion_for.hpp b/include/beman/execution/detail/valid_completion_for.hpp index 51aae9e1..5f9868dd 100644 --- a/include/beman/execution/detail/valid_completion_for.hpp +++ b/include/beman/execution/detail/valid_completion_for.hpp @@ -24,7 +24,7 @@ struct valid_completion_for_aux { {} }; -template +BEMAN_EXECUTION_EXPORT template concept valid_completion_for = requires(Signature* signature) { #if 1 valid_completion_for_aux::test(signature); diff --git a/src/beman/execution/execution.cppm b/src/beman/execution/execution.cppm index 3c815da0..26473729 100644 --- a/src/beman/execution/execution.cppm +++ b/src/beman/execution/execution.cppm @@ -432,7 +432,7 @@ auto forward_like(U&& u) noexcept -> decltype(auto) { #line 13 "include/beman/execution/detail/join_env.hpp" namespace beman::execution::detail { -template +export /* --------- */ template class join_env { private: Env1 env1; @@ -442,33 +442,39 @@ class join_env { template join_env(E1&& e1, E2&& e2) : env1(::std::forward(e1)), env2(::std::forward(e2)) {} + template + requires requires(Env1&, const Query& query, Args&&... args) { + env1.query(query, ::std::forward(args)...); + } + auto query(const Query& query, Args&&... args) noexcept -> decltype(auto) { + return this->env1.query(query, ::std::forward(args)...); + } template requires( - requires(Env1&, const Query& query, Args&&... args) { + not requires(Env1&, const Query& query, Args&&... args) { env1.query(query, ::std::forward(args)...); - } || + } && requires(Env2& e2, const Query& query, Args&&... args) { e2.query(query, ::std::forward(args)...); }) auto query(const Query& query, Args&&... args) noexcept -> decltype(auto) { - if constexpr (requires { env1.query(query, ::std::forward(args)...); }) { - return env1.query(query, ::std::forward(args)...); - } else { - return env2.query(query, ::std::forward(args)...); + return this->env2.query(query, ::std::forward(args)...); + } + template + requires requires(const Env1& e1, const Query& query, Args&&... args) { + { e1.query(query, ::std::forward(args)...) } noexcept; } + auto query(const Query& query, Args&&... args) const noexcept -> decltype(auto) { + return this->env1.query(query, ::std::forward(args)...); } template requires( - requires(const Env1&, const Query& query, Args&&... args) { - env1.query(query, ::std::forward(args)...); - } || + not requires(const Env1& e1, const Query& query, Args&&... args) { + { e1.query(query, ::std::forward(args)...) } noexcept; + } && requires(const Env2& e2, const Query& query, Args&&... args) { - e2.query(query, ::std::forward(args)...); + { e2.query(query, ::std::forward(args)...) } noexcept; }) auto query(const Query& query, Args&&... args) const noexcept -> decltype(auto) { - if constexpr (requires { env1.query(query, ::std::forward(args)...); }) { - return env1.query(query, ::std::forward(args)...); - } else { - return env2.query(query, ::std::forward(args)...); - } + return this->env2.query(query, ::std::forward(args)...); } }; @@ -711,7 +717,7 @@ template #line 19 "include/beman/execution/detail/call_result_t.hpp" using call_result_t = decltype(::std::declval()(std::declval()...)); -} +} // namespace beman::execution::detail #line 12 "include/beman/execution/detail/meta_size.hpp" namespace beman::execution::detail::meta { template @@ -1154,7 +1160,7 @@ struct valid_completion_for_aux { {} }; -template +export /* --------- */ template concept valid_completion_for = requires(Signature* signature) { #if 1 valid_completion_for_aux::test(signature); @@ -1255,7 +1261,7 @@ using await_result_type = namespace beman::execution::detail { #line 22 "include/beman/execution/detail/fwd_env.hpp" -template +export /* --------- */ template class fwd_env { private: Env env; @@ -2242,26 +2248,11 @@ concept has_as_awaitable = requires(T&& obj, Promise& promise) { #line 13 "include/beman/execution/detail/has_completions.hpp" namespace beman::execution::detail { -#if not defined(__clang__) - -#line 17 "include/beman/execution/detail/has_completions.hpp" template concept has_completions = requires(Completions* completions) { []<::beman::execution::detail::valid_completion_for... Signatures>( ::beman::execution::completion_signatures*) {}(completions); }; -#else -template -struct has_completions_aux; -template -struct has_completions_aux> { - static constexpr bool value = - (::beman::execution::detail::valid_completion_for && ... && true); -}; - -template -concept has_completions = has_completions_aux::value; -#endif } // namespace beman::execution::detail #line 23 "include/beman/execution/detail/default_impls.hpp" @@ -2305,14 +2296,16 @@ struct default_impls { struct start_impl { auto operator()(auto&, auto&, auto&... ops) const noexcept -> void { (::beman::execution::start(ops), ...); } }; - static constexpr auto start = start_impl{}; - static constexpr auto complete = []( - Index, auto&, Receiver& receiver, Tag, Args&&... args) noexcept -> void - requires ::beman::execution::detail::callable - { - static_assert(Index::value == 0); - Tag()(::std::move(receiver), ::std::forward(args)...); + static constexpr auto start = start_impl{}; + struct complete_impl { + template + requires ::beman::execution::detail::callable + auto operator()(Index, auto&, Receiver& receiver, Tag, Args&&... args) const noexcept -> void { + static_assert(Index::value == 0); + Tag()(::std::move(receiver), ::std::forward(args)...); + } }; + static constexpr auto complete = complete_impl{}; }; } // namespace beman::execution::detail @@ -3932,8 +3925,8 @@ namespace beman::execution::detail { export /* --------- */ template requires ::beman::execution::detail:: - valid_specialization<::beman::execution::detail::state_type, std::remove_cvref_t, Receiver> -struct basic_operation : ::beman::execution::detail::basic_state { + valid_specialization<::beman::execution::detail::state_type, std::remove_cvref_t, Receiver> + struct basic_operation : ::beman::execution::detail::basic_state { friend struct ::beman::execution::start_t; using operation_state_concept = ::beman::execution::operation_state_t; @@ -4031,7 +4024,7 @@ struct basic_sender : ::beman::execution::detail::product_type) auto connect(Receiver receiver) = BEMAN_EXECUTION_DELETE("the passed receiver doesn't model receiver"); -private: + private: #if __cpp_explicit_this_parameter < 302110L template <::beman::execution::receiver Receiver> auto connect(Receiver receiver) & noexcept( @@ -4808,9 +4801,7 @@ struct completion_signatures_for_impl< using type = ::beman::execution::detail::meta::combine< decltype(::beman::execution::get_completion_signatures(::std::declval(), ::std::declval())), ::beman::execution::error_types_of_t, - ::beman::execution::completion_signatures<::beman::execution::set_error_t( - ::std::exception_ptr)> - >; + ::beman::execution::completion_signatures<::beman::execution::set_error_t(::std::exception_ptr)>>; }; } // namespace beman::execution::detail @@ -5772,11 +5763,24 @@ struct impls_for<::beman::execution::detail::counting_scope_join_t> : ::beman::e #line 36 "include/beman/execution/detail/affine_on.hpp" namespace beman::execution::detail { +template +struct affine_on_env { + Ev ev_; + auto query(const ::beman::execution::get_stop_token_t&) const noexcept -> ::beman::execution::never_stop_token { + return ::beman::execution::never_stop_token(); + } + template + auto query(const Q& q) const noexcept -> decltype(q(this->ev_)) { + return q(this->ev_); + } +}; +template +affine_on_env(const Ev&) -> affine_on_env; -#line 46 "include/beman/execution/detail/affine_on.hpp" +#line 60 "include/beman/execution/detail/affine_on.hpp" struct affine_on_t : ::beman::execution::sender_adaptor_closure { -#line 54 "include/beman/execution/detail/affine_on.hpp" +#line 68 "include/beman/execution/detail/affine_on.hpp" template <::beman::execution::sender Sender> auto operator()(Sender&& sender) const { return ::beman::execution::detail::transform_sender( @@ -5784,24 +5788,9 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { ::beman::execution::detail::make_sender( *this, ::beman::execution::env<>{}, ::std::forward(sender))); } -#line 67 "include/beman/execution/detail/affine_on.hpp" +#line 81 "include/beman/execution/detail/affine_on.hpp" auto operator()() const { return ::beman::execution::detail::sender_adaptor{*this}; } - template - struct ao_env { - Ev ev_; - auto query(const ::beman::execution::get_stop_token_t&) const noexcept - -> ::beman::execution::never_stop_token { - return ::beman::execution::never_stop_token(); - } - template - auto query(const Q& q) const noexcept -> decltype(q(this->ev_)) { - return q(this->ev_); - } - }; - template - ao_env(const Ev&) -> ao_env; - #line 102 "include/beman/execution/detail/affine_on.hpp" template <::beman::execution::sender Sender, typename Env> requires ::beman::execution::detail::sender_for && requires(const Env& env) { @@ -5828,7 +5817,7 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { ::beman::execution::schedule_from( ::beman::execution::get_scheduler(ev), ::beman::execution::write_env(::beman::execution::detail::forward_like(child), ev)), - ao_env(ev)); + beman::execution::detail::affine_on_env(ev)); } } }; @@ -6480,4 +6469,3 @@ namespace beman::execution { export /* --------- */ using on_t = ::beman::execution::detail::on_t; export /* --------- */ inline constexpr ::beman::execution::on_t on{}; } // namespace beman::execution - diff --git a/tests/beman/execution/CMakeLists.txt b/tests/beman/execution/CMakeLists.txt index a22f0a15..421c6792 100644 --- a/tests/beman/execution/CMakeLists.txt +++ b/tests/beman/execution/CMakeLists.txt @@ -102,7 +102,8 @@ list( thread.test utilities.test ) -set (TODO +#set(execution_tests exec-affine-on.test) +set(TODO exec-scope-simple-counting.test exec-scope-counting.test exec-snd-apply.test diff --git a/tests/beman/execution/exec-affine-on.test.cpp b/tests/beman/execution/exec-affine-on.test.cpp index 0d790799..a5f9f338 100644 --- a/tests/beman/execution/exec-affine-on.test.cpp +++ b/tests/beman/execution/exec-affine-on.test.cpp @@ -1,6 +1,10 @@ // tests/beman/execution/exec-affine-on.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -23,12 +27,6 @@ import beman.execution; #include #endif -#include -#include -#include - -#include - // ---------------------------------------------------------------------------- namespace { diff --git a/tests/beman/execution/exec-bulk.test.cpp b/tests/beman/execution/exec-bulk.test.cpp index 99647066..0678f288 100644 --- a/tests/beman/execution/exec-bulk.test.cpp +++ b/tests/beman/execution/exec-bulk.test.cpp @@ -7,6 +7,8 @@ #ifdef BEMAN_HAS_MODULES import beman.execution; #else +#include "beman/execution/detail/bulk.hpp" +#include "beman/execution/detail/just.hpp" #include "beman/execution/detail/get_completion_signatures.hpp" #include "beman/execution/detail/get_env.hpp" #include "beman/execution/detail/sync_wait.hpp" diff --git a/tests/beman/execution/exec-env.test.cpp b/tests/beman/execution/exec-env.test.cpp index 2cf8569f..40c9b9d8 100644 --- a/tests/beman/execution/exec-env.test.cpp +++ b/tests/beman/execution/exec-env.test.cpp @@ -1,6 +1,9 @@ // tests/beman/execution/exec-env.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -10,8 +13,6 @@ import beman.execution; #include #include #endif -#include -#include namespace {} diff --git a/tests/beman/execution/exec-snd-expos.test.cpp b/tests/beman/execution/exec-snd-expos.test.cpp index 1f3bdedf..ee604b79 100644 --- a/tests/beman/execution/exec-snd-expos.test.cpp +++ b/tests/beman/execution/exec-snd-expos.test.cpp @@ -70,14 +70,14 @@ struct env { struct env1 { int value{}; - auto query(custom_query_t<0>, int a) const { return this->value + a; } - auto query(custom_query_t<1>, int a) const { return this->value + a; } + auto query(custom_query_t<0>, int a) const noexcept { return this->value + a; } + auto query(custom_query_t<1>, int a) const noexcept { return this->value + a; } }; struct env2 { int value{}; - auto query(custom_query_t<0>, int a) const { return this->value + a; } - auto query(custom_query_t<2>, int a) const { return this->value + a; } + auto query(custom_query_t<0>, int a) const noexcept { return this->value + a; } + auto query(custom_query_t<2>, int a) const noexcept { return this->value + a; } }; struct test_sender { diff --git a/tests/beman/execution/exec-sync-wait.test.cpp b/tests/beman/execution/exec-sync-wait.test.cpp index 924e0b76..d0238f41 100644 --- a/tests/beman/execution/exec-sync-wait.test.cpp +++ b/tests/beman/execution/exec-sync-wait.test.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; diff --git a/tests/beman/execution/exec-when-all.test.cpp b/tests/beman/execution/exec-when-all.test.cpp index 3998081c..d0f6daca 100644 --- a/tests/beman/execution/exec-when-all.test.cpp +++ b/tests/beman/execution/exec-when-all.test.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include // #include #ifdef BEMAN_HAS_MODULES diff --git a/tests/beman/execution/issue-174.test.cpp b/tests/beman/execution/issue-174.test.cpp index dcdc3340..aa462d0d 100644 --- a/tests/beman/execution/issue-174.test.cpp +++ b/tests/beman/execution/issue-174.test.cpp @@ -1,14 +1,14 @@ // tests/beman/execution/issue-174.test.cpp *-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include namespace ex = beman::execution; diff --git a/tests/beman/execution/stopsource-mem.test.cpp b/tests/beman/execution/stopsource-mem.test.cpp index 1aefb6b0..5a2e4e28 100644 --- a/tests/beman/execution/stopsource-mem.test.cpp +++ b/tests/beman/execution/stopsource-mem.test.cpp @@ -1,12 +1,13 @@ // src/beman/execution/tests/stopsource-mem.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include namespace { auto test_stopsource_swap() -> void { From 0f54aac339d3522b572b5fadd9ace43d6f93e978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 1 Feb 2026 22:29:25 +0000 Subject: [PATCH 5/9] fixed more test errors when using a module --- .../beman/execution/detail/simple_allocator.hpp | 2 +- src/beman/execution/execution.cppm | 12 ++++++------ tests/beman/execution/CMakeLists.txt | 2 +- tests/beman/execution/exec-fwd-env.test.cpp | 4 ++-- tests/beman/execution/exec-general.test.cpp | 12 ++++++------ tests/beman/execution/exec-get-allocator.test.cpp | 6 +++++- .../beman/execution/exec-get-compl-sched.test.cpp | 4 ++-- .../exec-get-delegation-scheduler.test.cpp | 4 ++-- tests/beman/execution/exec-get-domain.test.cpp | 4 ++-- tests/beman/execution/exec-get-env.test.cpp | 6 +++--- tests/beman/execution/exec-get-scheduler.test.cpp | 4 ++-- tests/beman/execution/exec-get-stop-token.test.cpp | 4 ++-- tests/beman/execution/exec-getcomplsigs.test.cpp | 4 ++-- tests/beman/execution/exec-let.test.cpp | 14 +++++++------- tests/beman/execution/exec-opstate-start.test.cpp | 5 ++--- tests/beman/execution/exec-opstate.test.cpp | 2 +- tests/beman/execution/exec-prop.test.cpp | 6 +++--- tests/beman/execution/exec-read-env.test.cpp | 4 ++-- .../beman/execution/exec-run-loop-general.test.cpp | 6 +++--- tests/beman/execution/exec-run-loop-types.test.cpp | 6 +++--- tests/beman/execution/exec-sched.test.cpp | 2 +- tests/beman/execution/exec-schedule-from.test.cpp | 4 ++-- tests/beman/execution/exec-schedule.test.cpp | 6 +++--- tests/beman/execution/exec-scope-concepts.test.cpp | 6 +++--- tests/beman/execution/exec-set-error.test.cpp | 6 +++--- tests/beman/execution/exec-set-stopped.test.cpp | 6 +++--- tests/beman/execution/exec-set-value.test.cpp | 4 ++-- tests/beman/execution/exec-snd-transform.test.cpp | 6 +++--- tests/beman/execution/exec-starts-on.test.cpp | 4 ++-- tests/beman/execution/exec-sync-wait.test.cpp | 1 - tests/beman/execution/exec-then.test.cpp | 9 ++++++--- .../execution/exec-with-awaitable-senders.test.cpp | 5 ++--- tests/beman/execution/function-objects.test.cpp | 2 +- tests/beman/execution/include/test/stop_token.hpp | 10 +++++----- tests/beman/execution/issue-144.test.cpp | 2 +- tests/beman/execution/issue-186.test.cpp | 2 +- tests/beman/execution/stopcallback-cons.test.cpp | 6 +++--- .../beman/execution/stopcallback-general.test.cpp | 6 +++--- .../execution/stopcallback-inplace-cons.test.cpp | 3 ++- .../stopcallback-inplace-general.test.cpp | 6 +++--- .../beman/execution/stopcallback-inplace.test.cpp | 2 +- tests/beman/execution/stopcallback.test.cpp | 2 +- tests/beman/execution/stopsource-cons.test.cpp | 10 +++++----- tests/beman/execution/stopsource-general.test.cpp | 8 ++++---- .../execution/stopsource-inplace-cons.test.cpp | 4 ++-- .../execution/stopsource-inplace-general.test.cpp | 6 +++++- .../execution/stopsource-inplace-mem.test.cpp | 2 +- tests/beman/execution/stopsource-inplace.test.cpp | 5 +++++ tests/beman/execution/stopsource.test.cpp | 5 +++++ tests/beman/execution/stoptoken-concepts.test.cpp | 2 +- tests/beman/execution/stoptoken-general.test.cpp | 2 +- .../execution/stoptoken-inplace-general.test.cpp | 6 +++--- .../execution/stoptoken-inplace-members.test.cpp | 2 +- tests/beman/execution/stoptoken-inplace.test.cpp | 5 +++++ tests/beman/execution/stoptoken-mem.test.cpp | 2 +- .../execution/stoptoken-never-general.test.cpp | 2 +- tests/beman/execution/stoptoken-never.test.cpp | 5 +++++ tests/beman/execution/stoptoken.test.cpp | 5 +++++ .../execution/thread-stoptoken-intro.test.cpp | 2 +- .../thread-stoptoken-syn.compile.test.cpp | 2 +- tests/beman/execution/thread-stoptoken.test.cpp | 5 +++++ tests/beman/execution/thread.test.cpp | 5 +++++ tests/beman/execution/utilities.test.cpp | 3 +++ 63 files changed, 173 insertions(+), 126 deletions(-) diff --git a/include/beman/execution/detail/simple_allocator.hpp b/include/beman/execution/detail/simple_allocator.hpp index 90bde1c0..eab53f60 100644 --- a/include/beman/execution/detail/simple_allocator.hpp +++ b/include/beman/execution/detail/simple_allocator.hpp @@ -11,7 +11,7 @@ // ---------------------------------------------------------------------------- namespace beman::execution::detail { -template +BEMAN_EXECUTION_EXPORT template //-dk:TODO detail export concept simple_allocator = requires(::std::remove_cvref_t alloc, ::std::size_t n) { { *alloc.allocate(n) } -> ::std::same_as::value_type&>; diff --git a/src/beman/execution/execution.cppm b/src/beman/execution/execution.cppm index 26473729..830b7994 100644 --- a/src/beman/execution/execution.cppm +++ b/src/beman/execution/execution.cppm @@ -328,7 +328,7 @@ struct beman::execution::detail::non_assignable { #line 13 "include/beman/execution/detail/simple_allocator.hpp" namespace beman::execution::detail { -template +export /* --------- */ template concept simple_allocator = requires(::std::remove_cvref_t alloc, ::std::size_t n) { { *alloc.allocate(n) } -> ::std::same_as::value_type&>; @@ -5777,10 +5777,10 @@ struct affine_on_env { template affine_on_env(const Ev&) -> affine_on_env; -#line 60 "include/beman/execution/detail/affine_on.hpp" +#line 59 "include/beman/execution/detail/affine_on.hpp" struct affine_on_t : ::beman::execution::sender_adaptor_closure { -#line 68 "include/beman/execution/detail/affine_on.hpp" +#line 67 "include/beman/execution/detail/affine_on.hpp" template <::beman::execution::sender Sender> auto operator()(Sender&& sender) const { return ::beman::execution::detail::transform_sender( @@ -5788,10 +5788,10 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { ::beman::execution::detail::make_sender( *this, ::beman::execution::env<>{}, ::std::forward(sender))); } -#line 81 "include/beman/execution/detail/affine_on.hpp" +#line 80 "include/beman/execution/detail/affine_on.hpp" auto operator()() const { return ::beman::execution::detail::sender_adaptor{*this}; } -#line 102 "include/beman/execution/detail/affine_on.hpp" +#line 100 "include/beman/execution/detail/affine_on.hpp" template <::beman::execution::sender Sender, typename Env> requires ::beman::execution::detail::sender_for && requires(const Env& env) { { ::beman::execution::get_scheduler(env) } -> ::beman::execution::scheduler; @@ -5826,7 +5826,7 @@ struct affine_on_t : ::beman::execution::sender_adaptor_closure { namespace beman::execution { -#line 139 "include/beman/execution/detail/affine_on.hpp" +#line 137 "include/beman/execution/detail/affine_on.hpp" export /* --------- */ using affine_on_t = beman::execution::detail::affine_on_t; export /* --------- */ inline constexpr affine_on_t affine_on{}; } // namespace beman::execution diff --git a/tests/beman/execution/CMakeLists.txt b/tests/beman/execution/CMakeLists.txt index 421c6792..fb2da4eb 100644 --- a/tests/beman/execution/CMakeLists.txt +++ b/tests/beman/execution/CMakeLists.txt @@ -102,7 +102,7 @@ list( thread.test utilities.test ) -#set(execution_tests exec-affine-on.test) +#set(execution_tests stopsource-general.test) set(TODO exec-scope-simple-counting.test exec-scope-counting.test diff --git a/tests/beman/execution/exec-fwd-env.test.cpp b/tests/beman/execution/exec-fwd-env.test.cpp index a64bb658..72a0860b 100644 --- a/tests/beman/execution/exec-fwd-env.test.cpp +++ b/tests/beman/execution/exec-fwd-env.test.cpp @@ -1,13 +1,13 @@ // src/beman/execution/tests/exec-fwd-env.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-general.test.cpp b/tests/beman/execution/exec-general.test.cpp index d2a0167f..05d5bb5c 100644 --- a/tests/beman/execution/exec-general.test.cpp +++ b/tests/beman/execution/exec-general.test.cpp @@ -1,18 +1,18 @@ // src/beman/execution/tests/exec-general.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifdef BEMAN_HAS_MODULES -import beman.execution; -#else -#include -#endif +#include #include #include #include -#include #include #include #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-get-allocator.test.cpp b/tests/beman/execution/exec-get-allocator.test.cpp index 60ec4657..89608040 100644 --- a/tests/beman/execution/exec-get-allocator.test.cpp +++ b/tests/beman/execution/exec-get-allocator.test.cpp @@ -1,9 +1,13 @@ // src/beman/execution/tests/exec-get-allocator.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-get-compl-sched.test.cpp b/tests/beman/execution/exec-get-compl-sched.test.cpp index 9829335e..2ffb7c11 100644 --- a/tests/beman/execution/exec-get-compl-sched.test.cpp +++ b/tests/beman/execution/exec-get-compl-sched.test.cpp @@ -1,6 +1,8 @@ // src/beman/execution/tests/exec-get-compl-sched.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -13,8 +15,6 @@ import beman.execution; #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-get-delegation-scheduler.test.cpp b/tests/beman/execution/exec-get-delegation-scheduler.test.cpp index e0dc7909..22fffb5f 100644 --- a/tests/beman/execution/exec-get-delegation-scheduler.test.cpp +++ b/tests/beman/execution/exec-get-delegation-scheduler.test.cpp @@ -1,6 +1,8 @@ // src/beman/execution/tests/exec-get-delegation-scheduler.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -10,8 +12,6 @@ import beman.execution; #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-get-domain.test.cpp b/tests/beman/execution/exec-get-domain.test.cpp index cb49e744..89c10c3d 100644 --- a/tests/beman/execution/exec-get-domain.test.cpp +++ b/tests/beman/execution/exec-get-domain.test.cpp @@ -1,13 +1,13 @@ // src/beman/execution/tests/exec-get-domain.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-get-env.test.cpp b/tests/beman/execution/exec-get-env.test.cpp index cdec72c3..feb1b61a 100644 --- a/tests/beman/execution/exec-get-env.test.cpp +++ b/tests/beman/execution/exec-get-env.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-get-env.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-get-scheduler.test.cpp b/tests/beman/execution/exec-get-scheduler.test.cpp index f940ff53..b4c54c8d 100644 --- a/tests/beman/execution/exec-get-scheduler.test.cpp +++ b/tests/beman/execution/exec-get-scheduler.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-get-scheduler.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-get-stop-token.test.cpp b/tests/beman/execution/exec-get-stop-token.test.cpp index 03fa880c..52c8d0e9 100644 --- a/tests/beman/execution/exec-get-stop-token.test.cpp +++ b/tests/beman/execution/exec-get-stop-token.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-get-stop-token.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-getcomplsigs.test.cpp b/tests/beman/execution/exec-getcomplsigs.test.cpp index 459f8870..5cfd2515 100644 --- a/tests/beman/execution/exec-getcomplsigs.test.cpp +++ b/tests/beman/execution/exec-getcomplsigs.test.cpp @@ -1,13 +1,13 @@ // src/beman/execution/tests/exec-getcomplsigs.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-let.test.cpp b/tests/beman/execution/exec-let.test.cpp index 650d4d47..a0be5e79 100644 --- a/tests/beman/execution/exec-let.test.cpp +++ b/tests/beman/execution/exec-let.test.cpp @@ -1,6 +1,13 @@ // src/beman/execution/tests/exec-let.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -11,13 +18,6 @@ import beman.execution; #include #include #endif -#include -#include -#include -#include -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-opstate-start.test.cpp b/tests/beman/execution/exec-opstate-start.test.cpp index 5a087a9d..681a0e4e 100644 --- a/tests/beman/execution/exec-opstate-start.test.cpp +++ b/tests/beman/execution/exec-opstate-start.test.cpp @@ -1,14 +1,13 @@ // src/beman/execution/tests/exec-opstate-start.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include - -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-opstate.test.cpp b/tests/beman/execution/exec-opstate.test.cpp index fa0c7ff9..4d7a4811 100644 --- a/tests/beman/execution/exec-opstate.test.cpp +++ b/tests/beman/execution/exec-opstate.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/exec-opstate.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-prop.test.cpp b/tests/beman/execution/exec-prop.test.cpp index 9d4c198c..e3920cf3 100644 --- a/tests/beman/execution/exec-prop.test.cpp +++ b/tests/beman/execution/exec-prop.test.cpp @@ -1,15 +1,15 @@ // tests/beman/execution/exec-prop.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-read-env.test.cpp b/tests/beman/execution/exec-read-env.test.cpp index 2e6b7ed9..5748a67a 100644 --- a/tests/beman/execution/exec-read-env.test.cpp +++ b/tests/beman/execution/exec-read-env.test.cpp @@ -1,6 +1,8 @@ // src/beman/execution/tests/exec-read-env.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -14,8 +16,6 @@ import beman.execution; #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-run-loop-general.test.cpp b/tests/beman/execution/exec-run-loop-general.test.cpp index 0b21ced8..d322e1c0 100644 --- a/tests/beman/execution/exec-run-loop-general.test.cpp +++ b/tests/beman/execution/exec-run-loop-general.test.cpp @@ -1,15 +1,15 @@ // src/beman/execution/tests/exec-run-loop-general.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-run-loop-types.test.cpp b/tests/beman/execution/exec-run-loop-types.test.cpp index 67f5252a..2f0be8e6 100644 --- a/tests/beman/execution/exec-run-loop-types.test.cpp +++ b/tests/beman/execution/exec-run-loop-types.test.cpp @@ -1,6 +1,9 @@ // src/beman/execution/tests/exec-run-loop-types.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -16,9 +19,6 @@ import beman.execution; #include #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-sched.test.cpp b/tests/beman/execution/exec-sched.test.cpp index ee1e1164..363791a9 100644 --- a/tests/beman/execution/exec-sched.test.cpp +++ b/tests/beman/execution/exec-sched.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/exec-sched.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-schedule-from.test.cpp b/tests/beman/execution/exec-schedule-from.test.cpp index ae75b983..d16e338d 100644 --- a/tests/beman/execution/exec-schedule-from.test.cpp +++ b/tests/beman/execution/exec-schedule-from.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-schedule-from.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-schedule.test.cpp b/tests/beman/execution/exec-schedule.test.cpp index 82c1568e..b786e074 100644 --- a/tests/beman/execution/exec-schedule.test.cpp +++ b/tests/beman/execution/exec-schedule.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-schedule.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-scope-concepts.test.cpp b/tests/beman/execution/exec-scope-concepts.test.cpp index b216f647..0947b738 100644 --- a/tests/beman/execution/exec-scope-concepts.test.cpp +++ b/tests/beman/execution/exec-scope-concepts.test.cpp @@ -1,6 +1,9 @@ // tests/beman/execution/exec-scope-concepts.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -10,9 +13,6 @@ import beman.execution; #include #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-set-error.test.cpp b/tests/beman/execution/exec-set-error.test.cpp index dbfbe573..8d446fcb 100644 --- a/tests/beman/execution/exec-set-error.test.cpp +++ b/tests/beman/execution/exec-set-error.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-set-error.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-set-stopped.test.cpp b/tests/beman/execution/exec-set-stopped.test.cpp index a78ebc94..01e6929c 100644 --- a/tests/beman/execution/exec-set-stopped.test.cpp +++ b/tests/beman/execution/exec-set-stopped.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-set-stopped.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include namespace { struct receiver { diff --git a/tests/beman/execution/exec-set-value.test.cpp b/tests/beman/execution/exec-set-value.test.cpp index bb79061e..d47dfa06 100644 --- a/tests/beman/execution/exec-set-value.test.cpp +++ b/tests/beman/execution/exec-set-value.test.cpp @@ -1,13 +1,13 @@ // src/beman/execution/tests/exec-set-value.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-snd-transform.test.cpp b/tests/beman/execution/exec-snd-transform.test.cpp index 814e92df..168700ea 100644 --- a/tests/beman/execution/exec-snd-transform.test.cpp +++ b/tests/beman/execution/exec-snd-transform.test.cpp @@ -1,6 +1,9 @@ // src/beman/execution/tests/exec-snd-transform.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -9,9 +12,6 @@ import beman.execution; #include #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-starts-on.test.cpp b/tests/beman/execution/exec-starts-on.test.cpp index 78d3ea49..af325ecb 100644 --- a/tests/beman/execution/exec-starts-on.test.cpp +++ b/tests/beman/execution/exec-starts-on.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/exec-starts-on.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #include #endif -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-sync-wait.test.cpp b/tests/beman/execution/exec-sync-wait.test.cpp index d0238f41..489bb0a7 100644 --- a/tests/beman/execution/exec-sync-wait.test.cpp +++ b/tests/beman/execution/exec-sync-wait.test.cpp @@ -6,7 +6,6 @@ #include #include #include - #ifdef BEMAN_HAS_MODULES import beman.execution; #else diff --git a/tests/beman/execution/exec-then.test.cpp b/tests/beman/execution/exec-then.test.cpp index 9e9e8234..4a285478 100644 --- a/tests/beman/execution/exec-then.test.cpp +++ b/tests/beman/execution/exec-then.test.cpp @@ -1,6 +1,12 @@ // src/beman/execution/tests/exec-then.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else @@ -15,9 +21,6 @@ import beman.execution; #include #include #endif -#include -#include -#include // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/exec-with-awaitable-senders.test.cpp b/tests/beman/execution/exec-with-awaitable-senders.test.cpp index 2b34a2c7..083e0d7a 100644 --- a/tests/beman/execution/exec-with-awaitable-senders.test.cpp +++ b/tests/beman/execution/exec-with-awaitable-senders.test.cpp @@ -1,14 +1,13 @@ // src/beman/execution/tests/exec-with-awaitable-senders.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include - -#include // This examples shows how to await on senders // but also how to use awaitables with sender algorithms diff --git a/tests/beman/execution/function-objects.test.cpp b/tests/beman/execution/function-objects.test.cpp index 4cb5b873..bbce2161 100644 --- a/tests/beman/execution/function-objects.test.cpp +++ b/tests/beman/execution/function-objects.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/function-objects.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include TEST(function_objects) { // section [function.objects] is empty diff --git a/tests/beman/execution/include/test/stop_token.hpp b/tests/beman/execution/include/test/stop_token.hpp index 2c573fe3..cb93287c 100644 --- a/tests/beman/execution/include/test/stop_token.hpp +++ b/tests/beman/execution/include/test/stop_token.hpp @@ -5,11 +5,6 @@ #ifndef INCLUDED_TEST_STOP_TOKEN #define INCLUDED_TEST_STOP_TOKEN -#ifdef BEMAN_HAS_MODULES -import beman.execution; -#else -#include -#endif #include #include @@ -25,6 +20,11 @@ import beman.execution; #include #include #include +#if false && defined(BEMAN_HAS_MODULES) +import beman.execution; +#else +#include +#endif // ---------------------------------------------------------------------------- diff --git a/tests/beman/execution/issue-144.test.cpp b/tests/beman/execution/issue-144.test.cpp index ecf2343a..a58086aa 100644 --- a/tests/beman/execution/issue-144.test.cpp +++ b/tests/beman/execution/issue-144.test.cpp @@ -1,12 +1,12 @@ // tests/beman/execution/issue-144.test.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include namespace bex = beman::execution; diff --git a/tests/beman/execution/issue-186.test.cpp b/tests/beman/execution/issue-186.test.cpp index 0233584f..623f1826 100644 --- a/tests/beman/execution/issue-186.test.cpp +++ b/tests/beman/execution/issue-186.test.cpp @@ -1,12 +1,12 @@ // tests/beman/execution/issue-186.test.cpp *-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include namespace ex = beman::execution; diff --git a/tests/beman/execution/stopcallback-cons.test.cpp b/tests/beman/execution/stopcallback-cons.test.cpp index 02095ec7..4212f735 100644 --- a/tests/beman/execution/stopcallback-cons.test.cpp +++ b/tests/beman/execution/stopcallback-cons.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/stopcallback-cons.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include TEST(stopcallback_cons) { // Reference: [stopcallback.cons] p1 diff --git a/tests/beman/execution/stopcallback-general.test.cpp b/tests/beman/execution/stopcallback-general.test.cpp index 6998b924..7bd73d7c 100644 --- a/tests/beman/execution/stopcallback-general.test.cpp +++ b/tests/beman/execution/stopcallback-general.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/stopcallback-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include namespace { auto test_stop_callback_interface() -> void { diff --git a/tests/beman/execution/stopcallback-inplace-cons.test.cpp b/tests/beman/execution/stopcallback-inplace-cons.test.cpp index bde56e70..d0010e45 100644 --- a/tests/beman/execution/stopcallback-inplace-cons.test.cpp +++ b/tests/beman/execution/stopcallback-inplace-cons.test.cpp @@ -1,12 +1,13 @@ // src/beman/execution/tests/stopcallback-inplace-cons.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include namespace { auto test_inplace_stopcallback_ctor() -> void { diff --git a/tests/beman/execution/stopcallback-inplace-general.test.cpp b/tests/beman/execution/stopcallback-inplace-general.test.cpp index ea738fd4..49816ff9 100644 --- a/tests/beman/execution/stopcallback-inplace-general.test.cpp +++ b/tests/beman/execution/stopcallback-inplace-general.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/stopcallback-inplace-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include TEST(stopcallback_inplace_general) { // Reference: [stopcallback.inplace.general] diff --git a/tests/beman/execution/stopcallback-inplace.test.cpp b/tests/beman/execution/stopcallback-inplace.test.cpp index 7b6026a2..87124880 100644 --- a/tests/beman/execution/stopcallback-inplace.test.cpp +++ b/tests/beman/execution/stopcallback-inplace.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/stopcallback-inplace.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include TEST(stopcallback_inplace) { // section [stopcallback.inplace] is empty diff --git a/tests/beman/execution/stopcallback.test.cpp b/tests/beman/execution/stopcallback.test.cpp index 827398ac..bafe64af 100644 --- a/tests/beman/execution/stopcallback.test.cpp +++ b/tests/beman/execution/stopcallback.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/stopcallback.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include TEST(stopcallback) { // section [stopcallback] is empty diff --git a/tests/beman/execution/stopsource-cons.test.cpp b/tests/beman/execution/stopsource-cons.test.cpp index be7808de..0b364bb7 100644 --- a/tests/beman/execution/stopsource-cons.test.cpp +++ b/tests/beman/execution/stopsource-cons.test.cpp @@ -1,17 +1,17 @@ // src/beman/execution/tests/stopsource-cons.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifdef BEMAN_HAS_MODULES -import beman.execution; -#else -#include -#endif #include #include #include #include #include #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif namespace { bool fail{}; diff --git a/tests/beman/execution/stopsource-general.test.cpp b/tests/beman/execution/stopsource-general.test.cpp index cc7710be..c181f05e 100644 --- a/tests/beman/execution/stopsource-general.test.cpp +++ b/tests/beman/execution/stopsource-general.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/stopsource-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#ifdef BEMAN_HAS_MODULES +#include +#include +#include +#if false && defined(BEMAN_HAS_MODULES) import beman.execution; #else #include #endif -#include -#include -#include TEST(stopsource_general) { try { diff --git a/tests/beman/execution/stopsource-inplace-cons.test.cpp b/tests/beman/execution/stopsource-inplace-cons.test.cpp index 2bd293aa..786bab4e 100644 --- a/tests/beman/execution/stopsource-inplace-cons.test.cpp +++ b/tests/beman/execution/stopsource-inplace-cons.test.cpp @@ -1,13 +1,13 @@ // src/beman/execution/tests/stopsource-inplace-cons.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include TEST(stopsource_inplace_cons) { // Plan: diff --git a/tests/beman/execution/stopsource-inplace-general.test.cpp b/tests/beman/execution/stopsource-inplace-general.test.cpp index 34950122..e7f813a1 100644 --- a/tests/beman/execution/stopsource-inplace-general.test.cpp +++ b/tests/beman/execution/stopsource-inplace-general.test.cpp @@ -1,9 +1,13 @@ // src/beman/execution/tests/stopsource-inplace-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include #include +#if false && defined(BEMAN_HAS_MODULES) +import beman.execution; +#else +#include +#endif TEST(stopsource_inplace_general) { // Reference: [stopsource.inplace.general] diff --git a/tests/beman/execution/stopsource-inplace-mem.test.cpp b/tests/beman/execution/stopsource-inplace-mem.test.cpp index 086f7f41..b5ca35b4 100644 --- a/tests/beman/execution/stopsource-inplace-mem.test.cpp +++ b/tests/beman/execution/stopsource-inplace-mem.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/stopsource-inplace-mem.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include namespace { auto test_inplace_stop_source_get_token() -> void { diff --git a/tests/beman/execution/stopsource-inplace.test.cpp b/tests/beman/execution/stopsource-inplace.test.cpp index 91f2b1a8..7dab8cdf 100644 --- a/tests/beman/execution/stopsource-inplace.test.cpp +++ b/tests/beman/execution/stopsource-inplace.test.cpp @@ -2,6 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif TEST(stopsource_inplace) { // section [stopsource.inplace] is empty diff --git a/tests/beman/execution/stopsource.test.cpp b/tests/beman/execution/stopsource.test.cpp index 21e24362..74882c42 100644 --- a/tests/beman/execution/stopsource.test.cpp +++ b/tests/beman/execution/stopsource.test.cpp @@ -2,6 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif TEST(stopsource) { // section [thread] is empty diff --git a/tests/beman/execution/stoptoken-concepts.test.cpp b/tests/beman/execution/stoptoken-concepts.test.cpp index 732f4c70..748d1552 100644 --- a/tests/beman/execution/stoptoken-concepts.test.cpp +++ b/tests/beman/execution/stoptoken-concepts.test.cpp @@ -1,9 +1,9 @@ // src/beman/execution/tests/stoptoken-concepts.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include #include +#include namespace { namespace detail_stopppable_callback_for { diff --git a/tests/beman/execution/stoptoken-general.test.cpp b/tests/beman/execution/stoptoken-general.test.cpp index fb679493..40a59e7b 100644 --- a/tests/beman/execution/stoptoken-general.test.cpp +++ b/tests/beman/execution/stoptoken-general.test.cpp @@ -3,7 +3,7 @@ #include #include -#ifdef BEMAN_HAS_MODULES +#if false && defined(BEMAN_HAS_MODULES) import beman.execution; #else #include diff --git a/tests/beman/execution/stoptoken-inplace-general.test.cpp b/tests/beman/execution/stoptoken-inplace-general.test.cpp index bd883d78..241455bb 100644 --- a/tests/beman/execution/stoptoken-inplace-general.test.cpp +++ b/tests/beman/execution/stoptoken-inplace-general.test.cpp @@ -1,14 +1,14 @@ // src/beman/execution/tests/stoptoken-inplace-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include +#include +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include -#include -#include TEST(stoptoken_inplace_general) { // Reference [stoptoken.inplace.general] diff --git a/tests/beman/execution/stoptoken-inplace-members.test.cpp b/tests/beman/execution/stoptoken-inplace-members.test.cpp index bd77ca2d..4d7e7a7c 100644 --- a/tests/beman/execution/stoptoken-inplace-members.test.cpp +++ b/tests/beman/execution/stoptoken-inplace-members.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/stoptoken-inplace-members.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include namespace { auto test_inplace_stop_token_swap() -> void { diff --git a/tests/beman/execution/stoptoken-inplace.test.cpp b/tests/beman/execution/stoptoken-inplace.test.cpp index 05d8a475..3adc807b 100644 --- a/tests/beman/execution/stoptoken-inplace.test.cpp +++ b/tests/beman/execution/stoptoken-inplace.test.cpp @@ -2,6 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif TEST(stoptoken_inplace) { // section [stoptoken.inplace] is empty diff --git a/tests/beman/execution/stoptoken-mem.test.cpp b/tests/beman/execution/stoptoken-mem.test.cpp index 796274c2..1939d3a3 100644 --- a/tests/beman/execution/stoptoken-mem.test.cpp +++ b/tests/beman/execution/stoptoken-mem.test.cpp @@ -5,7 +5,7 @@ #include #include #include -#ifdef BEMAN_HAS_MODULES +#if false && defined(BEMAN_HAS_MODULES) import beman.execution; #else #include diff --git a/tests/beman/execution/stoptoken-never-general.test.cpp b/tests/beman/execution/stoptoken-never-general.test.cpp index 8335300c..c3c62a56 100644 --- a/tests/beman/execution/stoptoken-never-general.test.cpp +++ b/tests/beman/execution/stoptoken-never-general.test.cpp @@ -1,12 +1,12 @@ // src/beman/execution/tests/stoptoken-never-general.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #ifdef BEMAN_HAS_MODULES import beman.execution; #else #include #endif -#include TEST(stoptoken_never_general) { // Reference: [stoptoken.never.general] diff --git a/tests/beman/execution/stoptoken-never.test.cpp b/tests/beman/execution/stoptoken-never.test.cpp index 8036f98e..e4fe5c72 100644 --- a/tests/beman/execution/stoptoken-never.test.cpp +++ b/tests/beman/execution/stoptoken-never.test.cpp @@ -2,6 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif TEST(stoptoken_never) { // section [stoptoken.never] is empty diff --git a/tests/beman/execution/stoptoken.test.cpp b/tests/beman/execution/stoptoken.test.cpp index 09f7b7a8..0518e6aa 100644 --- a/tests/beman/execution/stoptoken.test.cpp +++ b/tests/beman/execution/stoptoken.test.cpp @@ -2,6 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif TEST(stoptoken) { // section [stoptoken] is empty diff --git a/tests/beman/execution/thread-stoptoken-intro.test.cpp b/tests/beman/execution/thread-stoptoken-intro.test.cpp index 37cc7e5d..7d68b80c 100644 --- a/tests/beman/execution/thread-stoptoken-intro.test.cpp +++ b/tests/beman/execution/thread-stoptoken-intro.test.cpp @@ -5,7 +5,7 @@ #include #include #include -#ifdef BEMAN_HAS_MODULES +#if false && defined(BEMAN_HAS_MODULES) import beman.execution; #else #include diff --git a/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp b/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp index 91336d62..0e2b36ad 100644 --- a/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp +++ b/tests/beman/execution/thread-stoptoken-syn.compile.test.cpp @@ -1,8 +1,8 @@ // src/beman/execution/tests/thread-stoptoken-syn.compile.test.cpp // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include +#include namespace { template diff --git a/tests/beman/execution/thread-stoptoken.test.cpp b/tests/beman/execution/thread-stoptoken.test.cpp index 71cddaca..fe257c21 100644 --- a/tests/beman/execution/thread-stoptoken.test.cpp +++ b/tests/beman/execution/thread-stoptoken.test.cpp @@ -2,6 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif TEST(thread_stoptoken) { // section [thread.stoptoken] is empty diff --git a/tests/beman/execution/thread.test.cpp b/tests/beman/execution/thread.test.cpp index 073066f5..d57184e9 100644 --- a/tests/beman/execution/thread.test.cpp +++ b/tests/beman/execution/thread.test.cpp @@ -2,6 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif TEST(thread) { // section [thread] is empty diff --git a/tests/beman/execution/utilities.test.cpp b/tests/beman/execution/utilities.test.cpp index e670ade4..1cdf019e 100644 --- a/tests/beman/execution/utilities.test.cpp +++ b/tests/beman/execution/utilities.test.cpp @@ -2,6 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#endif TEST(utilities) { // section [utilities] is empty From f146282fdcbda185dacb845ce5d9df8c1d63a68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Sun, 1 Feb 2026 23:57:55 +0000 Subject: [PATCH 6/9] also changed the examples to use modules --- examples/CMakeLists.txt | 2 +- examples/allocator.cpp | 9 +- examples/doc-just.cpp | 6 +- examples/doc-just_error.cpp | 6 +- examples/doc-just_stopped.cpp | 7 +- examples/inspect.cpp | 126 +++++++++++++++++- examples/intro-1-hello-world.cpp | 23 ++-- examples/intro-2-hello-async.cpp | 10 +- examples/intro-5-consumer.cpp | 6 +- examples/intro-timer.hpp | 8 -- examples/just_stopped.cpp | 3 + examples/meta.hpp | 5 - examples/playground.cpp | 7 +- examples/sender-demo.cpp | 20 ++- examples/stackoverflow.cpp | 10 +- examples/stop_token.cpp | 6 +- examples/stopping.cpp | 8 +- examples/when_all-cancel.cpp | 12 +- include/beman/execution/detail/associate.hpp | 5 +- .../beman/execution/detail/env_promise.hpp | 2 +- include/beman/execution/detail/make_env.hpp | 2 +- .../beman/execution/detail/sender_adaptor.hpp | 2 +- src/beman/execution/execution.cppm | 14 +- tests/beman/execution/CMakeLists.txt | 48 ++++--- tests/beman/execution/exec-associate.test.cpp | 10 +- .../execution/exec-scope-counting.test.cpp | 3 +- .../exec-scope-simple-counting.test.cpp | 3 +- .../include/test/inline_scheduler.hpp | 4 +- 28 files changed, 276 insertions(+), 91 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 6cf3246d..3c709cae 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -37,7 +37,7 @@ set(EXAMPLES if(BEMAN_USE_MODULES) list(APPEND EXAMPLES modules) # modules.cpp endif() -set(EXAMPLES) +# set(EXAMPLES) foreach(EXAMPLE ${EXAMPLES}) set(EXAMPLE_TARGET ${PROJECT_NAME}.${EXAMPLE}) diff --git a/examples/allocator.cpp b/examples/allocator.cpp index 845275ff..3c00ed07 100644 --- a/examples/allocator.cpp +++ b/examples/allocator.cpp @@ -1,10 +1,17 @@ -#include +// examples/allocator.cpp -*-C++-*- +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + #include #include #include #include #include #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif namespace ex = beman::execution; diff --git a/examples/doc-just.cpp b/examples/doc-just.cpp index a63c2d59..d25ded01 100644 --- a/examples/doc-just.cpp +++ b/examples/doc-just.cpp @@ -1,9 +1,13 @@ // examples/doc-just.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif namespace ex = beman::execution; using namespace std::string_literals; diff --git a/examples/doc-just_error.cpp b/examples/doc-just_error.cpp index c347485b..7acba327 100644 --- a/examples/doc-just_error.cpp +++ b/examples/doc-just_error.cpp @@ -1,9 +1,13 @@ // examples/doc-just_error.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include #include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif namespace ex = beman::execution; namespace { diff --git a/examples/doc-just_stopped.cpp b/examples/doc-just_stopped.cpp index 60c854e9..b4fe76f0 100644 --- a/examples/doc-just_stopped.cpp +++ b/examples/doc-just_stopped.cpp @@ -1,10 +1,13 @@ // examples/doc-just_stopped.cpp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include #include #include -#include //-dk:TODO remove +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif namespace ex = beman::execution; namespace { diff --git a/examples/inspect.cpp b/examples/inspect.cpp index e6fcd470..366a6be1 100644 --- a/examples/inspect.cpp +++ b/examples/inspect.cpp @@ -1,16 +1,138 @@ // examples/inspectc.pp -*-C++-*- // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include -#include "meta.hpp" #include +#include #include +#include #include +#include +#include +#ifdef BEMAN_HAS_MODULES +import beman.execution; +#else +#include +#endif namespace ex = beman::execution; // ---------------------------------------------------------------------------- +namespace meta { +// The code in this namespace is a fairly basic way to print types. It can +// almost certainly be done better, in particular using reflection. However, +// that's beside the point of this example. The important part for the +// example is that meta::type::name() yields a string representing the +// type T in some reasonable way +template