From c4b217a9c791dd518f11a93482e0ef02b1733f26 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sat, 6 Dec 2025 11:26:19 +0100 Subject: [PATCH 01/57] assumed version 1.37.0 --- README | 4 +-- include/asio/version.hpp | 2 +- src/doc/history.qbk | 76 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/README b/README index 0512937f12..b9a7a98b2a 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -asio version 1.36.0 -Released Saturday, 16 August 2025. +asio version 1.37.0 +Released Saturday, 5 November 2025. Visit https://think-async.com/ or see packaged doc/index.html for API documentation and a tutorial. diff --git a/include/asio/version.hpp b/include/asio/version.hpp index ccc1171c72..69a26fd92e 100644 --- a/include/asio/version.hpp +++ b/include/asio/version.hpp @@ -18,6 +18,6 @@ // ASIO_VERSION % 100 is the sub-minor version // ASIO_VERSION / 100 % 1000 is the minor version // ASIO_VERSION / 100000 is the major version -#define ASIO_VERSION 103600 // 1.36.0 +#define ASIO_VERSION 103700 // 1.37.0 #endif // ASIO_VERSION_HPP diff --git a/src/doc/history.qbk b/src/doc/history.qbk index 75799ea875..e022743c4f 100644 --- a/src/doc/history.qbk +++ b/src/doc/history.qbk @@ -7,6 +7,82 @@ [section:history Revision History] +[heading Asio 1.37.0] + +* Added the `execution::inline_exception_handling` property. This property is + used to describe what guarantees an executor makes about the treatment of + exceptions that are thrown by a submitted function, when that function is + executed inline within `execute`. +* Added `inline_executor`, an executor that always executes the function object + inline. An `inline_executor` is suitable as a completion executor, but cannot + be used as an I/O executor. +* Changed the default candidate executor for `associated_executor` from + `system_executor` to `inline_executor`. +* Added `inline_or_executor<>` and the `inline_or()` helper function. The + `inline_or_executor<>` template is an executor adapter. It attempts to execute + submitted function objects inline when permitted, and otherwise posts the + function object to the wrapped executor. +* Added overloads of `dispatch`, `post` and `defer` that take a function object + to be run on the target executor, and deliver the result to the completion + handler:[br] + `` + asio::post( + []{ + // ... perform long running computation ... + return result; + }, + my_thread_pool, + asio::bind_executor(my_io_context, + [](int result) + { + // ... + })); + ``[br] + Or, if called from a coroutine using the default `asio::deferred` completion + token:[br] + `` + int result = co_await asio::post( + []{ + // perform long running computation + return result; + }, my_thread_pool); + `` +* Added the `redirect_disposition` completion token adapter, as a generic + counterpart for `redirect_error`. The `redirect_disposition` adapter is used + to capture the disposition (such as an `error_code`) that is produced by an + asynchronous operation into a variable:[br] + `` + std::exception_ptr my_exception; + // ... + my_socket.async_read_some(my_buffer, + asio::redirect_disposition( + [](std::size_t bytes_transferred) + { + // ... + }, my_exception)); + `` +* Annotated deprecated items with the `[[deprecated]]` attribute. +* Added a new configuration parameter "reactor" / "reset_edge_on_partial_read". + When true, a partial read on a stream-oriented socket is treated as consuming + the edge-triggered readiness notification, requiring a new readiness event + before further reads. (Partial writes always consume the edge.) This avoids + unnecessary speculative reads. Defaults to `false`. +* Added a new configuration parameter "reactor" / "use_eventfd" that is used + to determine whether the [^epoll] reactor backend uses `eventfd`. Defaults + to `true`. +* Added a new configuration parameter "reactor" / "use_timerfd" that is used + to determine whether the [^epoll] reactor backend uses `timerfd`. Defaults + to `true`. +* Implemented a compile-time feature check for standard library support for + `std::source_location`, in addition to `std::experimental::source_location`. +* Stopped using the deprecated function `boost::array::c_array()`. +* Added a missing preprocessor check for `ASIO_DISABLE_TIMERFD`. +* Fixed a resource leak in `asio::awaitable` move assignment. +* Fixed a memory leak in `ssl` stream move assignment. +* Fixed a thread sanitizer issue in the [^kqueue] reactor. +* Fixed handler tracking arguments passed in the `io_uring` backend. +* Fixed an unused parameter warning `boost::asio::detail::null_thread`. + [heading Asio 1.36.0] * Fixed an issue, introduced in Asio 1.35.0, that prevented the creation of From af74aed56849189178fd9bbef64b776cf56e6589 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sat, 6 Dec 2025 14:07:31 +0100 Subject: [PATCH 02/57] assumed version 1.38.0 --- include/asio/async_result.hpp | 37 +++++++++++++++++- include/asio/coroutine.hpp | 38 +++++++++++++++---- include/asio/defer.hpp | 34 +++++++++++++++++ include/asio/detail/config.hpp | 35 +++++++++++------ .../detail/impl/win_iocp_file_service.ipp | 25 +++++++++++- .../detail/coro_promise_allocator.hpp | 2 +- include/asio/experimental/parallel_group.hpp | 16 ++++++++ include/asio/inline_or_executor.hpp | 5 ++- include/asio/ip/basic_resolver_results.hpp | 22 +++++++---- include/asio/ip/detail/endpoint.hpp | 12 ++---- include/asio/post.hpp | 34 +++++++++++++++++ .../asio/ssl/detail/buffered_handshake_op.hpp | 4 ++ include/asio/ssl/detail/handshake_op.hpp | 4 ++ include/asio/ssl/detail/io.hpp | 3 ++ include/asio/ssl/detail/read_op.hpp | 4 ++ include/asio/ssl/detail/shutdown_op.hpp | 11 ++++++ include/asio/ssl/detail/write_op.hpp | 4 ++ include/asio/version.hpp | 2 +- src/doc/history.qbk | 20 ++++++++++ 19 files changed, 269 insertions(+), 43 deletions(-) diff --git a/include/asio/async_result.hpp b/include/asio/async_result.hpp index f2426f5357..c7681d30a6 100644 --- a/include/asio/async_result.hpp +++ b/include/asio/async_result.hpp @@ -378,6 +378,9 @@ class completion_handler_async_result * * In general, implementers of asynchronous operations should use the * async_initiate function rather than using the async_result trait directly. + * + * For a more detailed discussion of the role of async_result and + * async_initiate, see the overview documentation for @ref completion_token. */ template @@ -451,8 +454,8 @@ class async_result #endif // defined(GENERATING_DOCUMENTATION) -/// Helper template to deduce the handler type from a CompletionToken, capture -/// a local copy of the handler, and then create an async_result for the +/// (Legacy.) Helper template to deduce the handler type from a CompletionToken, +/// capture a local copy of the handler, and then create an async_result for the /// handler. template @@ -620,6 +623,36 @@ struct async_result_has_initiate_memfn #if defined(GENERATING_DOCUMENTATION) +/// Helper function for implementing an asynchronous operation's initiating +/// function. +/** + * The async_initiate function wraps the async_result trait. It automatically + * performs the necessary decay and forward of the completion token, and also + * enables backwards compatibility with legacy completion token implementations. + * + * @param initiation A function object that will be called to launch the + * asynchronous operation. It receives the concrete completion handler as its + * first argument, followed by any additional arguments passed to + * async_initiate. + * + * @param token The @ref completion_token provided by the user. This will be + * transformed into a concrete completion handler by the async_result trait. + * + * @param args Additional arguments to be forwarded to the initiation function + * object. + * + * @returns The return value is determined by the async_result specialisation + * for the completion token type. For callback-based tokens, returns @c void. + * For other tokens such as use_future or use_awaitable, returns the + * corresponding future or awaitable type. + * + * @note Asynchronous operation implementations should use this function rather + * than directly using the async_result trait, or the legacy async_completion + * helper template. + * + * For a more detailed discussion of the role of async_result and + * async_initiate, see the overview documentation for @ref completion_token. + */ template diff --git a/include/asio/coroutine.hpp b/include/asio/coroutine.hpp index a9340d00c5..c4bc693d1d 100644 --- a/include/asio/coroutine.hpp +++ b/include/asio/coroutine.hpp @@ -275,11 +275,33 @@ class coroutine_ref bool modified_; }; +class coroutine_base_value +{ +public: + constexpr coroutine_base_value(int value) : value_(value) {} + constexpr operator bool() const { return false; } + constexpr int get() const { return value_; } +private: + int value_; +}; + } // namespace detail } // namespace asio +#if !defined(ASIO_CORO_VALUE_INIT) +# if defined(_MSC_VER) +# define ASIO_CORO_VALUE_INIT __COUNTER__ +# else // defined(_MSC_VER) +# define ASIO_CORO_VALUE_INIT __LINE__ +# endif // defined(_MSC_VER) +#endif // !defined(ASIO_CORO_VALUE_INIT) + #define ASIO_CORO_REENTER(c) \ - switch (::asio::detail::coroutine_ref _coro_value = c) \ + if (constexpr ::asio::detail::coroutine_base_value \ + _coro_base_value = ASIO_CORO_VALUE_INIT) \ + { \ + } \ + else switch (::asio::detail::coroutine_ref _coro_value = c) \ case -1: if (_coro_value) \ { \ goto terminate_coroutine; \ @@ -317,12 +339,12 @@ class coroutine_ref } \ else -#if defined(_MSC_VER) -# define ASIO_CORO_YIELD ASIO_CORO_YIELD_IMPL(__COUNTER__ + 1) -# define ASIO_CORO_FORK ASIO_CORO_FORK_IMPL(__COUNTER__ + 1) -#else // defined(_MSC_VER) -# define ASIO_CORO_YIELD ASIO_CORO_YIELD_IMPL(__LINE__) -# define ASIO_CORO_FORK ASIO_CORO_FORK_IMPL(__LINE__) -#endif // defined(_MSC_VER) +# define ASIO_CORO_YIELD \ + ASIO_CORO_YIELD_IMPL( \ + ASIO_CORO_VALUE_INIT + 1 - _coro_base_value.get()) + +# define ASIO_CORO_FORK \ + ASIO_CORO_FORK_IMPL( \ + ASIO_CORO_VALUE_INIT + 1 - _coro_base_value.get()) #endif // ASIO_COROUTINE_HPP diff --git a/include/asio/defer.hpp b/include/asio/defer.hpp index b58abf9538..b17fb4027b 100644 --- a/include/asio/defer.hpp +++ b/include/asio/defer.hpp @@ -301,6 +301,23 @@ inline auto defer(ExecutionContext& ctx, * exception to propagate to the caller that runs the @c io_context, whereas * asio::thread_pool will call @c std::terminate. * + * @par Example + * This @c defer overload may be used to submit long running work to a thread + * pool and, once complete, continue execution on an associated completion + * executor, such as a coroutine's associated executor: + * @code asio::awaitable my_coroutine() + * { + * // ... + * + * co_await asio::defer( + * []{ + * perform_expensive_computation(); + * }, + * my_thread_pool); + * + * // handle result on the coroutine's associated executor + * } @endcode + * * @par Completion Signature * @code void() @endcode */ @@ -414,6 +431,23 @@ inline auto defer(Function&& function, const Executor& ex, * exception to propagate to the caller that runs the @c io_context, whereas * asio::thread_pool will call @c std::terminate. * + * @par Example + * This @c defer overload may be used to submit long running work to a thread + * pool and, once complete, continue execution on an associated completion + * executor, such as a coroutine's associated executor: + * @code asio::awaitable my_coroutine() + * { + * // ... + * + * int result = co_await asio::defer( + * []{ + * return perform_expensive_computation(); + * }, + * my_thread_pool); + * + * // handle result on the coroutine's associated executor + * } @endcode + * * @par Completion Signature * @code void(decay_t()>>) @endcode */ diff --git a/include/asio/detail/config.hpp b/include/asio/detail/config.hpp index 3c4c8e46c9..bdc01a6da2 100644 --- a/include/asio/detail/config.hpp +++ b/include/asio/detail/config.hpp @@ -398,10 +398,20 @@ # if (__cplusplus >= 201703) # if defined(__clang__) # if defined(ASIO_HAS_CLANG_LIBCXX) -# if (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) \ - && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) -# if defined(__ANDROID__) && (__ANDROID_API__ >= 28) +# if (_LIBCPP_STD_VER > 14) +# if defined(__FreeBSD__) || defined(__Fuchsia__) || defined(__wasi__) \ + || defined(__NetBSD__) || defined(__OpenBSD__) +# define ASIO_HAS_STD_ALIGNED_ALLOC 1 +# elif defined(__linux__) +# if defined(_LIBCPP_HAS_MUSL_LIBC) # define ASIO_HAS_STD_ALIGNED_ALLOC 1 +# else // !defined(_LIBCPP_HAS_MUSL_LIBC) +# if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) +# define ASIO_HAS_STD_ALIGNED_ALLOC 1 +# endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) +# endif // !defined(_LIBCPP_HAS_MUSL_LIBC) +# elif defined(__ANDROID__) && (__ANDROID_API__ >= 28) +# define ASIO_HAS_STD_ALIGNED_ALLOC 1 # elif defined(__APPLE__) # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) # if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) @@ -420,11 +430,8 @@ # define ASIO_HAS_STD_ALIGNED_ALLOC 1 # endif // (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000) # endif // defined(__WATCH_OS_X_VERSION_MIN_REQUIRED) -# else // defined(__APPLE__) -# define ASIO_HAS_STD_ALIGNED_ALLOC 1 # endif // defined(__APPLE__) -# endif // (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) - // && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) +# endif // (_LIBCPP_STD_VER > 14) # elif defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) # define ASIO_HAS_STD_ALIGNED_ALLOC 1 # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) @@ -1393,11 +1400,15 @@ // Compiler support for the the [[deprecated(msg)]] attribute. #if !defined(ASIO_DEPRECATED_MSG) # if !defined(ASIO_DISABLE_DEPRECATED_MSG) -# if defined(__has_cpp_attribute) -# if __has_cpp_attribute(deprecated) -# define ASIO_DEPRECATED_MSG(msg) [[deprecated(msg)]] -# endif // __has_cpp_attribute(deprecated) -# endif // defined(__has_cpp_attribute) +# if defined(ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400) +# define ASIO_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +# elif (__cplusplus >= 201402) +# if defined(__has_cpp_attribute) +# if __has_cpp_attribute(deprecated) +# define ASIO_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif // __has_cpp_attribute(deprecated) +# endif // defined(__has_cpp_attribute) +# endif // __cplusplus >= 201402 # endif // !defined(ASIO_DISABLE_DEPRECATED_MSG) #endif // !defined(ASIO_DEPRECATED_MSG) #if !defined(ASIO_DEPRECATED_MSG) diff --git a/include/asio/detail/impl/win_iocp_file_service.ipp b/include/asio/detail/impl/win_iocp_file_service.ipp index 9ac64e61c7..2c9c93bfa0 100644 --- a/include/asio/detail/impl/win_iocp_file_service.ipp +++ b/include/asio/detail/impl/win_iocp_file_service.ipp @@ -22,6 +22,7 @@ #include #include +#include "asio/detail/memory.hpp" #include "asio/detail/win_iocp_file_service.hpp" #include "asio/detail/push_options.hpp" @@ -60,6 +61,27 @@ asio::error_code win_iocp_file_service::open( return ec; } + int required_path_length = ::MultiByteToWideChar( + CP_UTF8, MB_ERR_INVALID_CHARS, path, -1, 0, 0); + if (required_path_length == 0) + { + DWORD last_error = ::GetLastError(); + ec.assign(last_error, asio::error::get_system_category()); + ASIO_ERROR_LOCATION(ec); + return ec; + } + + std::unique_ptr wide_path(new wchar_t[required_path_length]); + int result = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, + path, -1, wide_path.get(), required_path_length); + if (result == 0) + { + DWORD last_error = ::GetLastError(); + ec.assign(last_error, asio::error::get_system_category()); + ASIO_ERROR_LOCATION(ec); + return ec; + } + DWORD access = 0; if ((open_flags & file_base::read_only) != 0) access = GENERIC_READ; @@ -95,7 +117,8 @@ asio::error_code win_iocp_file_service::open( flags |= FILE_FLAG_WRITE_THROUGH; impl.offset_ = 0; - HANDLE handle = ::CreateFileA(path, access, share, 0, disposition, flags, 0); + HANDLE handle = ::CreateFileW(wide_path.get(), + access, share, 0, disposition, flags, 0); if (handle != INVALID_HANDLE_VALUE) { if (disposition == OPEN_ALWAYS) diff --git a/include/asio/experimental/detail/coro_promise_allocator.hpp b/include/asio/experimental/detail/coro_promise_allocator.hpp index 2961ac2451..07a6379306 100644 --- a/include/asio/experimental/detail/coro_promise_allocator.hpp +++ b/include/asio/experimental/detail/coro_promise_allocator.hpp @@ -62,7 +62,7 @@ void deallocate_coroutine(void* raw_, const std::size_t size) template constexpr std::size_t variadic_first(std::size_t = 0u) { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } template diff --git a/include/asio/experimental/parallel_group.hpp b/include/asio/experimental/parallel_group.hpp index abbfeb146c..09a75ef988 100644 --- a/include/asio/experimental/parallel_group.hpp +++ b/include/asio/experimental/parallel_group.hpp @@ -20,6 +20,7 @@ #include "asio/async_result.hpp" #include "asio/detail/array.hpp" #include "asio/detail/memory.hpp" +#include "asio/detail/throw_exception.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/utility.hpp" #include "asio/experimental/cancellation_condition.hpp" @@ -156,6 +157,9 @@ class parallel_group std::tuple ops_; public: + static_assert(sizeof...(Ops) >= 1, + "parallel_group requires at least one operation"); + /// Constructor. explicit parallel_group(Ops... ops) : ops_(std::move(ops)...) @@ -303,11 +307,19 @@ class ranged_parallel_group public: /// Constructor. + /** + * @throws std::logic_error Thrown if the range is empty. + */ explicit ranged_parallel_group(Range range, const Allocator& allocator = Allocator()) : range_(std::move(range)), allocator_(allocator) { + if (range_.empty()) + { + std::logic_error e("ranged_parallel_group must be non-empty"); + asio::detail::throw_exception(e); + } } /// The completion signature for the group of operations. @@ -360,6 +372,8 @@ class ranged_parallel_group /** * @param range A range containing the operations to be launched. * + * @throws std::logic_error Thrown if the range is empty. + * * For example: * @code * using op_type = @@ -403,6 +417,8 @@ make_parallel_group(Range&& range, * * @param range A range containing the operations to be launched. * + * @throws std::logic_error Thrown if the range is empty. + * * For example: * @code * using op_type = diff --git a/include/asio/inline_or_executor.hpp b/include/asio/inline_or_executor.hpp index d866604e2a..3f35674f67 100644 --- a/include/asio/inline_or_executor.hpp +++ b/include/asio/inline_or_executor.hpp @@ -30,10 +30,11 @@ namespace asio { /// Adapts an executor to add inline invocation of the submitted function. /** - * The @inline_or_executor class template adapts an existing executor such that: + * The @c inline_or_executor class template adapts an existing executor such + * that: * * @li posted function objects (or when the @c blocking property is set to - * @c blocking.never) are submitted to the wrapped executor; and + * @c blocking.never) are submitted to the wrapped executor; and * * @li dispatched function objects (or when @c blocking is @c blocking.always or * @c blocking.possibly) are executed inline. diff --git a/include/asio/ip/basic_resolver_results.hpp b/include/asio/ip/basic_resolver_results.hpp index 3b68fd55a9..0bbbb799ab 100644 --- a/include/asio/ip/basic_resolver_results.hpp +++ b/include/asio/ip/basic_resolver_results.hpp @@ -132,14 +132,20 @@ class basic_resolver_results if (address_info->ai_family == ASIO_OS_DEF(AF_INET) || address_info->ai_family == ASIO_OS_DEF(AF_INET6)) { - using namespace std; // For memcpy. - typename InternetProtocol::endpoint endpoint; - endpoint.resize(static_cast(address_info->ai_addrlen)); - memcpy(endpoint.data(), address_info->ai_addr, - address_info->ai_addrlen); - results.values_->push_back( - basic_resolver_entry(endpoint, - actual_host_name, service_name)); + const std::size_t expected_size = + address_info->ai_family == ASIO_OS_DEF(AF_INET) + ? sizeof(asio::detail::sockaddr_in4_type) + : sizeof(asio::detail::sockaddr_in6_type); + if (address_info->ai_addrlen >= expected_size) + { + using namespace std; // For memcpy. + typename InternetProtocol::endpoint endpoint; + endpoint.resize(expected_size); + memcpy(endpoint.data(), address_info->ai_addr, expected_size); + results.values_->push_back( + basic_resolver_entry(endpoint, + actual_host_name, service_name)); + } } address_info = address_info->ai_next; } diff --git a/include/asio/ip/detail/endpoint.hpp b/include/asio/ip/detail/endpoint.hpp index 82fbf7678b..85e4023288 100644 --- a/include/asio/ip/detail/endpoint.hpp +++ b/include/asio/ip/detail/endpoint.hpp @@ -59,13 +59,13 @@ class endpoint // Get the underlying endpoint in the native type. asio::detail::socket_addr_type* data() noexcept { - return &data_.base[0]; + return &data_.base; } // Get the underlying endpoint in the native type. const asio::detail::socket_addr_type* data() const noexcept { - return &data_.base[0]; + return &data_.base; } // Get the underlying size of the endpoint in the native type. @@ -110,7 +110,7 @@ class endpoint // Determine whether the endpoint is IPv4. bool is_v4() const noexcept { - return data_.base[0].sa_family == ASIO_OS_DEF(AF_INET); + return data_.base.sa_family == ASIO_OS_DEF(AF_INET); } #if !defined(ASIO_NO_IOSTREAM) @@ -122,11 +122,7 @@ class endpoint // The underlying IP socket address. union data_union { -#if defined(_FORTIFY_SOURCE) - asio::detail::socket_addr_type base[8]; -#else // defined(_FORTIFY_SOURCE) - asio::detail::socket_addr_type base[1]; -#endif // defined(_FORTIFY_SOURCE) + asio::detail::socket_addr_type base; asio::detail::sockaddr_in4_type v4; asio::detail::sockaddr_in6_type v6; } data_; diff --git a/include/asio/post.hpp b/include/asio/post.hpp index aa1a76c26d..f11ee681d0 100644 --- a/include/asio/post.hpp +++ b/include/asio/post.hpp @@ -294,6 +294,23 @@ inline auto post(ExecutionContext& ctx, * exception to propagate to the caller that runs the @c io_context, whereas * asio::thread_pool will call @c std::terminate. * + * @par Example + * This @c post overload may be used to submit long running work to a thread + * pool and, once complete, continue execution on an associated completion + * executor, such as a coroutine's associated executor: + * @code asio::awaitable my_coroutine() + * { + * // ... + * + * co_await asio::post( + * []{ + * perform_expensive_computation(); + * }, + * my_thread_pool); + * + * // handle result on the coroutine's associated executor + * } @endcode + * * @par Completion Signature * @code void() @endcode */ @@ -405,6 +422,23 @@ inline auto post(Function&& function, const Executor& ex, * exception to propagate to the caller that runs the @c io_context, whereas * asio::thread_pool will call @c std::terminate. * + * @par Example + * This @c post overload may be used to submit long running work to a thread + * pool and, once complete, continue execution on an associated completion + * executor, such as a coroutine's associated executor: + * @code asio::awaitable my_coroutine() + * { + * // ... + * + * int result = co_await asio::post( + * []{ + * return perform_expensive_computation(); + * }, + * my_thread_pool); + * + * // handle result on the coroutine's associated executor + * } @endcode + * * @par Completion Signature * @code void(decay_t()>>) @endcode */ diff --git a/include/asio/ssl/detail/buffered_handshake_op.hpp b/include/asio/ssl/detail/buffered_handshake_op.hpp index 1ced3ce8e9..44084b60ca 100644 --- a/include/asio/ssl/detail/buffered_handshake_op.hpp +++ b/include/asio/ssl/detail/buffered_handshake_op.hpp @@ -51,6 +51,10 @@ class buffered_handshake_op asio::buffer_sequence_end(buffers_)); } + void complete_sync(asio::error_code&) const + { + } + template void call_handler(Handler& handler, const asio::error_code& ec, diff --git a/include/asio/ssl/detail/handshake_op.hpp b/include/asio/ssl/detail/handshake_op.hpp index cd4a57f6a8..7cabc56491 100644 --- a/include/asio/ssl/detail/handshake_op.hpp +++ b/include/asio/ssl/detail/handshake_op.hpp @@ -46,6 +46,10 @@ class handshake_op return eng.handshake(type_, ec); } + void complete_sync(asio::error_code&) const + { + } + template void call_handler(Handler& handler, const asio::error_code& ec, diff --git a/include/asio/ssl/detail/io.hpp b/include/asio/ssl/detail/io.hpp index fc9ae655a7..2ed521bb3a 100644 --- a/include/asio/ssl/detail/io.hpp +++ b/include/asio/ssl/detail/io.hpp @@ -78,18 +78,21 @@ std::size_t io(Stream& next_layer, stream_core& core, // Operation is complete. Return result to caller. core.engine_.map_error_code(ec); + op.complete_sync(ec); return bytes_transferred; default: // Operation is complete. Return result to caller. core.engine_.map_error_code(ec); + op.complete_sync(ec); return bytes_transferred; } while (!ec); // Operation failed. Return result to caller. core.engine_.map_error_code(ec); + op.complete_sync(ec); return 0; } diff --git a/include/asio/ssl/detail/read_op.hpp b/include/asio/ssl/detail/read_op.hpp index 36b623fc29..c1a8239957 100644 --- a/include/asio/ssl/detail/read_op.hpp +++ b/include/asio/ssl/detail/read_op.hpp @@ -51,6 +51,10 @@ class read_op return eng.read(buffer, ec, bytes_transferred); } + void complete_sync(asio::error_code&) const + { + } + template void call_handler(Handler& handler, const asio::error_code& ec, diff --git a/include/asio/ssl/detail/shutdown_op.hpp b/include/asio/ssl/detail/shutdown_op.hpp index f0e46a4fed..a988ef7ead 100644 --- a/include/asio/ssl/detail/shutdown_op.hpp +++ b/include/asio/ssl/detail/shutdown_op.hpp @@ -41,6 +41,17 @@ class shutdown_op return eng.shutdown(ec); } + void complete_sync(asio::error_code& ec) const + { + if (ec == asio::error::eof) + { + // The engine only generates an eof when the shutdown notification has + // been received from the peer. This indicates that the shutdown has + // completed successfully, and thus need not be returned to the caller. + ec = asio::error_code(); + } + } + template void call_handler(Handler& handler, const asio::error_code& ec, diff --git a/include/asio/ssl/detail/write_op.hpp b/include/asio/ssl/detail/write_op.hpp index f05a179278..93a92c63fd 100644 --- a/include/asio/ssl/detail/write_op.hpp +++ b/include/asio/ssl/detail/write_op.hpp @@ -55,6 +55,10 @@ class write_op return eng.write(buffer, ec, bytes_transferred); } + void complete_sync(asio::error_code&) const + { + } + template void call_handler(Handler& handler, const asio::error_code& ec, diff --git a/include/asio/version.hpp b/include/asio/version.hpp index 69a26fd92e..34d351dcee 100644 --- a/include/asio/version.hpp +++ b/include/asio/version.hpp @@ -18,6 +18,6 @@ // ASIO_VERSION % 100 is the sub-minor version // ASIO_VERSION / 100 % 1000 is the minor version // ASIO_VERSION / 100000 is the major version -#define ASIO_VERSION 103700 // 1.37.0 +#define ASIO_VERSION 103800 // 1.38.0 #endif // ASIO_VERSION_HPP diff --git a/src/doc/history.qbk b/src/doc/history.qbk index e022743c4f..0b420edeab 100644 --- a/src/doc/history.qbk +++ b/src/doc/history.qbk @@ -7,6 +7,26 @@ [section:history Revision History] +[heading Asio 1.38.0] + +* Changed the macro-based coroutine implementation to ensure that case labels + are deterministic when __COUNTER__ is used. +* Fixed synchronous SSL stream `shutdown` to remap `error::eof` as + `async_shutdown` does. +* Fixed a warning caused by the newly added `[[deprecated]]` attribute, when + compiling for C++11. +* Changed `stream_file` and `random_access_file` on Windows to treat the + supplied file path as a UTF-8 encoded string. +* Added checks to `experimental::parallel_group` and + `experimental::ranged_parallel_group` to detect when they are incorrectly + called with an empty set of asynchronous operations. +* Removed the previously added workaround for `_FORTIFY_SOURCE`, and instead + added additional address length checking into `ip::basic_resolver_results`. +* Fixed `experimental::coro` to add protection against `max` as a macro. +* Updated the detection of std::aligned_alloc to work with newer versions of + [^libc++]. +* Various documentation fixes and improvements. + [heading Asio 1.37.0] * Added the `execution::inline_exception_handling` property. This property is From 5c628992d560324296b9c2c2dd48d9f30b343094 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sun, 29 May 2022 07:17:04 +0200 Subject: [PATCH 03/57] Fix missing "C" linkage specifier --- include/asio/detail/impl/signal_set_service.ipp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asio/detail/impl/signal_set_service.ipp b/include/asio/detail/impl/signal_set_service.ipp index 54e7c4436c..874003d7c8 100644 --- a/include/asio/detail/impl/signal_set_service.ipp +++ b/include/asio/detail/impl/signal_set_service.ipp @@ -67,7 +67,7 @@ signal_state* get_signal_state() return &state; } -void asio_signal_handler(int signal_number) +extern "C" void asio_signal_handler(int signal_number) { #if defined(ASIO_WINDOWS) \ || defined(ASIO_WINDOWS_RUNTIME) \ From 8924506a3ccf98b19c35af9a430a9e1f83896743 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Wed, 15 Jun 2022 18:14:24 +0200 Subject: [PATCH 04/57] Workaround for deprecated std::aligned_storage --- include/asio/experimental/impl/promise.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asio/experimental/impl/promise.hpp b/include/asio/experimental/impl/promise.hpp index 03e6e6b8ec..76d7cfbaf7 100644 --- a/include/asio/experimental/impl/promise.hpp +++ b/include/asio/experimental/impl/promise.hpp @@ -58,7 +58,7 @@ struct promise_impl reinterpret_cast(&result)->~result_type(); } - aligned_storage_t result; + alignas(result_type) char result[sizeof(result_type)]; std::atomic done{false}; cancellation_signal cancel; Allocator allocator; From 4fef03a65ad92c3e73299e3bf46d3a3465849385 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Mon, 26 Sep 2022 19:52:25 +0200 Subject: [PATCH 05/57] compile as module, support CMake, create link to 'module' --- CMakeLists.txt | 32 ++++++++ asio/module | 1 + module/.gitignore | 2 + module/asio-gmf.h | 149 ++++++++++++++++++++++++++++++++++++ module/asio.ixx | 53 +++++++++++++ module/asio.slnx | 6 ++ module/asio.vcxproj | 54 +++++++++++++ module/asio.vcxproj.filters | 27 +++++++ 8 files changed, 324 insertions(+) create mode 100644 CMakeLists.txt create mode 120000 asio/module create mode 100644 module/.gitignore create mode 100644 module/asio-gmf.h create mode 100644 module/asio.ixx create mode 100644 module/asio.slnx create mode 100644 module/asio.vcxproj create mode 100644 module/asio.vcxproj.filters diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..6fee5e32f9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.26) + +if (CMAKE_CXX_STANDARD LESS 20) + message(FATAL_ERROR "At least C++20 required but have ${CMAKE_CXX_STANDARD}") +endif() + +project(asio + DESCRIPTION "Modularized Asio for C++20" + HOMEPAGE_URL "https://github.com/DanielaE/asio/tree/module" + LANGUAGES CXX +) + +set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") +set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(asio-sources module/asio.ixx) + +add_library(asio STATIC) +add_library(asio::asio ALIAS asio) +target_sources(asio + PUBLIC + FILE_SET modules TYPE CXX_MODULES + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/module + FILES ${asio-sources} +) +target_compile_features(asio PUBLIC cxx_std_20) +target_include_directories(asio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) +if (MSVC) + target_compile_options(asio PRIVATE /dxifcInlineFunctions-) + target_compile_options(asio PRIVATE /wd5244) +endif() diff --git a/asio/module b/asio/module new file mode 120000 index 0000000000..ad3c990ffb --- /dev/null +++ b/asio/module @@ -0,0 +1 @@ +../module \ No newline at end of file diff --git a/module/.gitignore b/module/.gitignore new file mode 100644 index 0000000000..be102ab7a5 --- /dev/null +++ b/module/.gitignore @@ -0,0 +1,2 @@ +/x64 +/*.user diff --git a/module/asio-gmf.h b/module/asio-gmf.h new file mode 100644 index 0000000000..77f7ec4f5f --- /dev/null +++ b/module/asio-gmf.h @@ -0,0 +1,149 @@ +#pragma once +#define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported + +#if defined(_WIN32) and __has_include() +# include +#endif + +#if defined(ASIO_HEADER_ONLY) +# error "ASIO_HEADER_ONLY" makes no sense with this module +#endif + +#if !defined(ASIO_SEPARATE_COMPILATION) +# define ASIO_SEPARATE_COMPILATION +#endif + +#if !defined(ASIO_DISABLE_BUFFER_DEBUGGING) && !defined(ASIO_ENABLE_BUFFER_DEBUGGING) +# define ASIO_DISABLE_BUFFER_DEBUGGING +#endif + +#define ASIO_NO_DEPRECATED +#define ASIO_MODULE + +#include + +#include +#include + +#if defined(ASIO_WINDOWS_RUNTIME) // expected to not work at all +# include +# include +# include +# include +# include +#elif defined(ASIO_WINDOWS) or defined(__CYGWIN__) +# include +# include +# include +// do not reorder! +# include +# include +#else +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif + +#ifdef ASIO_HAS_PTHREADS +# include +#endif +#if defined(ASIO_HAS_IO_URING) +# include +#endif +#if defined(ASIO_HAS_KQUEUE) +# include +# include +#endif +#if defined(ASIO_HAS_DEV_POLL) +# include +#endif +#if defined(ASIO_HAS_EPOLL) and defined(ASIO_HAS_TIMERFD) +# include +#endif +#if defined(ASIO_HAS_PIPE) and defined(ASIO_HAS_IOCP) +# include +#endif + +#ifdef ASIO_ENABLE_HANDLER_TRACKING +# include +#endif + +#if defined(ASIO_USE_SSL) +# if defined(ASIO_USE_WOLFSSL) +# include +# endif // defined(ASIO_USE_WOLFSSL) + +# include +# include +# if !defined(OPENSSL_NO_ENGINE) +# include +# endif // !defined(OPENSSL_NO_ENGINE) +# include +# include +# include +# include +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/module/asio.ixx b/module/asio.ixx new file mode 100644 index 0000000000..3dcffe024c --- /dev/null +++ b/module/asio.ixx @@ -0,0 +1,53 @@ +module; +#include "asio-gmf.h" + +export module asio; + +#ifdef _MSC_VER +# pragma comment(lib, "asio.lib") +#endif + +#ifdef ASIO_ATTACH_TO_GLOBAL_MODULE +extern "C++" { +#endif + +export { +#include "asio.hpp" + +#include "asio/ts/buffer.hpp" +#include "asio/ts/executor.hpp" +#include "asio/ts/internet.hpp" +#include "asio/ts/io_context.hpp" +#include "asio/ts/net.hpp" +#include "asio/ts/netfwd.hpp" +#include "asio/ts/socket.hpp" +#include "asio/ts/timer.hpp" + +#include "asio/experimental/as_single.hpp" +#include "asio/experimental/awaitable_operators.hpp" +#include "asio/experimental/cancellation_condition.hpp" +#include "asio/experimental/channel.hpp" +#include "asio/experimental/co_composed.hpp" +#include "asio/experimental/co_spawn.hpp" +#include "asio/experimental/concurrent_channel.hpp" +#include "asio/experimental/coro.hpp" +#include "asio/experimental/parallel_group.hpp" +#include "asio/experimental/promise.hpp" +#include "asio/experimental/use_coro.hpp" +#include "asio/experimental/use_promise.hpp" + +#if defined(ASIO_USE_SSL) +# include +#endif +} // export + +#ifdef ASIO_ATTACH_TO_GLOBAL_MODULE +} // extern "C++" +#endif + +module :private; + +#include "asio/impl/src.hpp" +#if defined(ASIO_USE_SSL) +# include "asio/ssl/impl/src.hpp" +#endif diff --git a/module/asio.slnx b/module/asio.slnx new file mode 100644 index 0000000000..6a0735d282 --- /dev/null +++ b/module/asio.slnx @@ -0,0 +1,6 @@ + + + + + + diff --git a/module/asio.vcxproj b/module/asio.vcxproj new file mode 100644 index 0000000000..b2d03fe42b --- /dev/null +++ b/module/asio.vcxproj @@ -0,0 +1,54 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {1569001E-8080-4A44-93FF-CA44C1554BC6} + Win32Proj + $(DefaultWindowsSDKVersion) + + + + StaticLibrary + Unicode + true + true + $(DefaultPlatformToolset) + + + + + + + + + true + ProgramDatabase + 5244 + $(ProjectDir)..\include + + + + + + + + + + \ No newline at end of file diff --git a/module/asio.vcxproj.filters b/module/asio.vcxproj.filters new file mode 100644 index 0000000000..b97b60689e --- /dev/null +++ b/module/asio.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + \ No newline at end of file From d4b11761813951fb49bfa9799ba6db1235c7110f Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sun, 29 May 2022 07:18:20 +0200 Subject: [PATCH 06/57] Don't export definitions with internal linkage (e.g. 'static') --- include/asio/error.hpp | 2 ++ include/asio/experimental/channel_error.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/asio/error.hpp b/include/asio/error.hpp index 596c9b9860..e4f87e3396 100644 --- a/include/asio/error.hpp +++ b/include/asio/error.hpp @@ -288,6 +288,7 @@ inline const asio::error_category& get_addrinfo_category() extern ASIO_DECL const asio::error_category& get_misc_category(); +#ifndef ASIO_MODULE static const asio::error_category& system_category ASIO_UNUSED_VARIABLE = asio::error::get_system_category(); @@ -300,6 +301,7 @@ static const asio::error_category& static const asio::error_category& misc_category ASIO_UNUSED_VARIABLE = asio::error::get_misc_category(); +#endif } // namespace error } // namespace asio diff --git a/include/asio/experimental/channel_error.hpp b/include/asio/experimental/channel_error.hpp index 6492f66469..135a7adf4d 100644 --- a/include/asio/experimental/channel_error.hpp +++ b/include/asio/experimental/channel_error.hpp @@ -36,9 +36,11 @@ enum channel_errors extern ASIO_DECL const asio::error_category& get_channel_category(); +#ifndef ASIO_MODULE static const asio::error_category& channel_category ASIO_UNUSED_VARIABLE = asio::experimental::error::get_channel_category(); +#endif } // namespace error namespace channel_errc { From 4a417e7d876f94a3150d7638f0130fc503802214 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Thu, 7 Aug 2025 17:44:49 +0200 Subject: [PATCH 07/57] make TU-local entities extern --- include/asio/detail/winsock_init.hpp | 2 +- include/asio/placeholders.hpp | 12 ++++++------ include/asio/prefer.hpp | 6 +----- include/asio/query.hpp | 6 +----- include/asio/require.hpp | 6 +----- include/asio/require_concept.hpp | 6 +----- 6 files changed, 11 insertions(+), 27 deletions(-) diff --git a/include/asio/detail/winsock_init.hpp b/include/asio/detail/winsock_init.hpp index b3410f1af7..94b30f23f9 100644 --- a/include/asio/detail/winsock_init.hpp +++ b/include/asio/detail/winsock_init.hpp @@ -112,7 +112,7 @@ winsock_init_base::data winsock_init::data_; // Static variable to ensure that winsock is initialised before main, and // therefore before any other threads can get started. -static const winsock_init<>& winsock_init_instance = winsock_init<>(false); +inline const winsock_init<>& winsock_init_instance = winsock_init<>(false); } // namespace detail } // namespace asio diff --git a/include/asio/placeholders.hpp b/include/asio/placeholders.hpp index bffa795fee..5ec9c7aa3d 100644 --- a/include/asio/placeholders.hpp +++ b/include/asio/placeholders.hpp @@ -58,17 +58,17 @@ unspecified signal_number; #else -static ASIO_INLINE_VARIABLE constexpr auto& error +ASIO_INLINE_VARIABLE constexpr auto& error = std::placeholders::_1; -static ASIO_INLINE_VARIABLE constexpr auto& bytes_transferred +ASIO_INLINE_VARIABLE constexpr auto& bytes_transferred = std::placeholders::_2; -static ASIO_INLINE_VARIABLE constexpr auto& iterator +ASIO_INLINE_VARIABLE constexpr auto& iterator = std::placeholders::_2; -static ASIO_INLINE_VARIABLE constexpr auto& results +ASIO_INLINE_VARIABLE constexpr auto& results = std::placeholders::_2; -static ASIO_INLINE_VARIABLE constexpr auto& endpoint +ASIO_INLINE_VARIABLE constexpr auto& endpoint = std::placeholders::_2; -static ASIO_INLINE_VARIABLE constexpr auto& signal_number +ASIO_INLINE_VARIABLE constexpr auto& signal_number = std::placeholders::_2; #endif diff --git a/include/asio/prefer.hpp b/include/asio/prefer.hpp index 9856e0154a..cf9fa586ae 100644 --- a/include/asio/prefer.hpp +++ b/include/asio/prefer.hpp @@ -517,13 +517,9 @@ const T static_instance::instance = {}; } // namespace asio_prefer_fn namespace asio { -namespace { - -static constexpr const asio_prefer_fn::impl& +inline constexpr const asio_prefer_fn::impl& prefer = asio_prefer_fn::static_instance<>::instance; -} // namespace - typedef asio_prefer_fn::impl prefer_t; template diff --git a/include/asio/query.hpp b/include/asio/query.hpp index d2bc8224a3..f3d1de2383 100644 --- a/include/asio/query.hpp +++ b/include/asio/query.hpp @@ -254,13 +254,9 @@ const T static_instance::instance = {}; } // namespace asio_query_fn namespace asio { -namespace { - -static constexpr const asio_query_fn::impl& +inline constexpr const asio_query_fn::impl& query = asio_query_fn::static_instance<>::instance; -} // namespace - typedef asio_query_fn::impl query_t; template diff --git a/include/asio/require.hpp b/include/asio/require.hpp index 155f6925c1..4ef4e748fe 100644 --- a/include/asio/require.hpp +++ b/include/asio/require.hpp @@ -372,13 +372,9 @@ const T static_instance::instance = {}; } // namespace asio_require_fn namespace asio { -namespace { - -static constexpr const asio_require_fn::impl& +inline constexpr const asio_require_fn::impl& require = asio_require_fn::static_instance<>::instance; -} // namespace - typedef asio_require_fn::impl require_t; template diff --git a/include/asio/require_concept.hpp b/include/asio/require_concept.hpp index ddf7e0ac57..62e560c2e3 100644 --- a/include/asio/require_concept.hpp +++ b/include/asio/require_concept.hpp @@ -282,13 +282,9 @@ const T static_instance::instance = {}; } // namespace asio_require_concept_fn namespace asio { -namespace { - -static constexpr const asio_require_concept_fn::impl& +inline constexpr const asio_require_concept_fn::impl& require_concept = asio_require_concept_fn::static_instance<>::instance; -} // namespace - typedef asio_require_concept_fn::impl require_concept_t; template From 86fc07b22e41c40f6d54c47ae099d41014dfda88 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Mon, 26 Sep 2022 19:28:56 +0200 Subject: [PATCH 08/57] replace concepts emulation with `requires` expressions --- include/asio/async_result.hpp | 36 +--- include/asio/detail/is_buffer_sequence.hpp | 224 +++++---------------- include/asio/detail/is_executor.hpp | 92 +-------- 3 files changed, 65 insertions(+), 287 deletions(-) diff --git a/include/asio/async_result.hpp b/include/asio/async_result.hpp index c7681d30a6..5d488e0b88 100644 --- a/include/asio/async_result.hpp +++ b/include/asio/async_result.hpp @@ -490,39 +490,17 @@ struct async_completion namespace detail { -struct async_result_memfns_base -{ - void initiate(); -}; - -template -struct async_result_memfns_derived - : T, async_result_memfns_base -{ -}; - -template -struct async_result_memfns_check -{ -}; - -template -char (&async_result_initiate_memfn_helper(...))[2]; - -template -char async_result_initiate_memfn_helper( - async_result_memfns_check< - void (async_result_memfns_base::*)(), - &async_result_memfns_derived::initiate>*); +template +constexpr inline bool async_result_has_initiate_memfn_v = + requires(async_result, Signatures...> ar){ + { ar.initate() }; + }; template struct async_result_has_initiate_memfn - : integral_constant, Signatures...> - >(0)) != 1> -{ -}; + : integral_constant> +{}; } // namespace detail diff --git a/include/asio/detail/is_buffer_sequence.hpp b/include/asio/detail/is_buffer_sequence.hpp index 10a0541a9d..98f43cb498 100644 --- a/include/asio/detail/is_buffer_sequence.hpp +++ b/include/asio/detail/is_buffer_sequence.hpp @@ -19,6 +19,7 @@ #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" +#include namespace asio { @@ -29,162 +30,16 @@ class const_registered_buffer; namespace detail { -struct buffer_sequence_memfns_base -{ - void begin(); - void end(); - void size(); - void max_size(); - void capacity(); - void data(); - void prepare(); - void commit(); - void consume(); - void grow(); - void shrink(); -}; - -template -struct buffer_sequence_memfns_derived - : T, buffer_sequence_memfns_base -{ -}; - -template -struct buffer_sequence_memfns_check -{ -}; - -template -char buffer_sequence_begin_helper(...); - -template -char (&buffer_sequence_begin_helper(T* t, - enable_if_t::value>*))[2]; - -template -char buffer_sequence_end_helper(...); - -template -char (&buffer_sequence_end_helper(T* t, - enable_if_t::value>*))[2]; - -template -char (&size_memfn_helper(...))[2]; - -template -char size_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::size>*); - -template -char (&max_size_memfn_helper(...))[2]; - -template -char max_size_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::max_size>*); - -template -char (&capacity_memfn_helper(...))[2]; - -template -char capacity_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::capacity>*); - -template -char (&data_memfn_helper(...))[2]; - -template -char data_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::data>*); - -template -char (&prepare_memfn_helper(...))[2]; - -template -char prepare_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::prepare>*); - -template -char (&commit_memfn_helper(...))[2]; - -template -char commit_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::commit>*); - -template -char (&consume_memfn_helper(...))[2]; - -template -char consume_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::consume>*); - -template -char (&grow_memfn_helper(...))[2]; - -template -char grow_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::grow>*); - -template -char (&shrink_memfn_helper(...))[2]; - -template -char shrink_memfn_helper( - buffer_sequence_memfns_check< - void (buffer_sequence_memfns_base::*)(), - &buffer_sequence_memfns_derived::shrink>*); - -template -char (&buffer_sequence_element_type_helper(...))[2]; - template -char buffer_sequence_element_type_helper(T* t, - enable_if_t::value>*); - -template -char (&const_buffers_type_typedef_helper(...))[2]; - -template -char const_buffers_type_typedef_helper( - typename T::const_buffers_type*); - -template -char (&mutable_buffers_type_typedef_helper(...))[2]; - -template -char mutable_buffers_type_typedef_helper( - typename T::mutable_buffers_type*); +constexpr inline bool is_buffer_sequence_class_v = + requires(T t) { + { *asio::buffer_sequence_begin(t) } -> std::convertible_to; + { *asio::buffer_sequence_end(t) } -> std::convertible_to; + }; template struct is_buffer_sequence_class - : integral_constant(0, 0)) != 1 && - sizeof(buffer_sequence_end_helper(0, 0)) != 1 && - sizeof(buffer_sequence_element_type_helper(0, 0)) == 1> -{ -}; + : integral_constant> {}; template struct is_buffer_sequence @@ -242,20 +97,28 @@ struct is_buffer_sequence { }; +template +constexpr inline bool is_dynamic_buffer_class_v1_v = + requires { + typename T::const_buffers_type; + typename T::mutable_buffers_type; + } && + requires(const T & t) { + { t.size() } -> std::same_as; + { t.max_size() } -> std::same_as; + { t.capacity() } -> std::same_as; + { t.data() }; + } && + requires(T & t, std::size_t n) { + { t.prepare(n) }; + { t.consume(n) }; + { t.commit(n) }; + } +; + template struct is_dynamic_buffer_class_v1 - : integral_constant(0)) != 1 && - sizeof(max_size_memfn_helper(0)) != 1 && - sizeof(capacity_memfn_helper(0)) != 1 && - sizeof(data_memfn_helper(0)) != 1 && - sizeof(consume_memfn_helper(0)) != 1 && - sizeof(prepare_memfn_helper(0)) != 1 && - sizeof(commit_memfn_helper(0)) != 1 && - sizeof(const_buffers_type_typedef_helper(0)) == 1 && - sizeof(mutable_buffers_type_typedef_helper(0)) == 1> -{ -}; + : integral_constant> {}; template struct is_dynamic_buffer_v1 @@ -265,20 +128,29 @@ struct is_dynamic_buffer_v1 { }; +template +constexpr inline bool is_dynamic_buffer_class_v2_v = + requires { + typename T::const_buffers_type; + typename T::mutable_buffers_type; + } && + requires(const T & t, std::size_t n) { + { t.size() } -> std::same_as; + { t.max_size() } -> std::same_as; + { t.capacity() } -> std::same_as; + { t.data(n, n) } -> std::same_as; + } && + requires(T & t, std::size_t n) { + { t.data(n, n) } -> std::same_as; + { t.consume(n) }; + { t.grow(n) }; + { t.shrink(n) }; + } +; + template struct is_dynamic_buffer_class_v2 - : integral_constant(0)) != 1 && - sizeof(max_size_memfn_helper(0)) != 1 && - sizeof(capacity_memfn_helper(0)) != 1 && - sizeof(data_memfn_helper(0)) != 1 && - sizeof(consume_memfn_helper(0)) != 1 && - sizeof(grow_memfn_helper(0)) != 1 && - sizeof(shrink_memfn_helper(0)) != 1 && - sizeof(const_buffers_type_typedef_helper(0)) == 1 && - sizeof(mutable_buffers_type_typedef_helper(0)) == 1> -{ -}; + : integral_constant> {}; template struct is_dynamic_buffer_v2 diff --git a/include/asio/detail/is_executor.hpp b/include/asio/detail/is_executor.hpp index 74ab40e2d3..ba46bc70c6 100644 --- a/include/asio/detail/is_executor.hpp +++ b/include/asio/detail/is_executor.hpp @@ -23,92 +23,20 @@ namespace asio { namespace detail { -struct executor_memfns_base -{ - void context(); - void on_work_started(); - void on_work_finished(); - void dispatch(); - void post(); - void defer(); -}; - -template -struct executor_memfns_derived - : T, executor_memfns_base -{ -}; - -template -struct executor_memfns_check -{ -}; - -template -char (&context_memfn_helper(...))[2]; - -template -char context_memfn_helper( - executor_memfns_check< - void (executor_memfns_base::*)(), - &executor_memfns_derived::context>*); - -template -char (&on_work_started_memfn_helper(...))[2]; - template -char on_work_started_memfn_helper( - executor_memfns_check< - void (executor_memfns_base::*)(), - &executor_memfns_derived::on_work_started>*); - -template -char (&on_work_finished_memfn_helper(...))[2]; - -template -char on_work_finished_memfn_helper( - executor_memfns_check< - void (executor_memfns_base::*)(), - &executor_memfns_derived::on_work_finished>*); - -template -char (&dispatch_memfn_helper(...))[2]; - -template -char dispatch_memfn_helper( - executor_memfns_check< - void (executor_memfns_base::*)(), - &executor_memfns_derived::dispatch>*); - -template -char (&post_memfn_helper(...))[2]; - -template -char post_memfn_helper( - executor_memfns_check< - void (executor_memfns_base::*)(), - &executor_memfns_derived::post>*); - -template -char (&defer_memfn_helper(...))[2]; - -template -char defer_memfn_helper( - executor_memfns_check< - void (executor_memfns_base::*)(), - &executor_memfns_derived::defer>*); +constexpr inline bool is_executor_class_v = + requires(T t) { + { t.context() }; + { t.on_work_started() }; + { t.on_work_finished() }; + { t.dispatch() }; + { t.post() }; + { t.defer() }; + }; template struct is_executor_class - : integral_constant(0)) != 1 && - sizeof(on_work_started_memfn_helper(0)) != 1 && - sizeof(on_work_finished_memfn_helper(0)) != 1 && - sizeof(dispatch_memfn_helper(0)) != 1 && - sizeof(post_memfn_helper(0)) != 1 && - sizeof(defer_memfn_helper(0)) != 1> -{ -}; + : integral_constant> {}; template struct is_executor From bd7954d1e408daf2645d796a8f19e00ba8ee1e61 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sat, 13 May 2023 08:42:15 +0200 Subject: [PATCH 09/57] add GHA to build modules --- .github/workflows/windows.yml | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000000..555cec7754 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,69 @@ +name: windows + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + build: + runs-on: ${{matrix.os}} + strategy: + matrix: + # windows-2022 has MSVC 2022 installed: + # https://github.com/actions/virtual-environments. + os: [windows-2022] + platform: [x64] + toolset: [v143] + standard: [20] + shared: [""] + build_type: [Debug, Release] + + steps: + - uses: actions/checkout@v3 + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure + # Use a bash shell for $GITHUB_WORKSPACE. + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + cmake -A ${{matrix.platform}} -T ${{matrix.toolset}} \ + -DCMAKE_CXX_STANDARD=${{matrix.standard}} \ + ${{matrix.shared}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + $GITHUB_WORKSPACE + + - name: Build + working-directory: ${{runner.workspace}}/build + run: | + $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors + cmake --build . --config ${{matrix.build_type}} --parallel $threads + + mingw: + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + strategy: + matrix: + cxx: [ clang++ ] + lib: [ libc++, libstdc++ ] + steps: + - uses: actions/checkout@v3 + - uses: msys2/setup-msys2@v2 + with: + release: false + msystem: ucrt64 + pacboy: cmake:u ninja:u clang:u libc++:u gcc-libs:u + - name: Configure + run: | + cmake -B ../build -G "Ninja" -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_BUILD_TYPE=Debug + env: + CXX: ${{matrix.cxx}} + CXXFLAGS: ${{format('-stdlib={0}', matrix.lib)}} + + - name: Build + run: cmake --build ../build From 0052fb1bcb0de15c7a5418e94f2da5f4aa2bf2b1 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Fri, 19 May 2023 20:01:53 +0200 Subject: [PATCH 10/57] compiles with Clang in MSYS2 ucrt64 --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fee5e32f9..0ef654ad58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,12 @@ target_sources(asio target_compile_features(asio PUBLIC cxx_std_20) target_include_directories(asio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) if (MSVC) - target_compile_options(asio PRIVATE /dxifcInlineFunctions-) +# right, but please don't complain about #includes in the module purview target_compile_options(asio PRIVATE /wd5244) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +# I do mean C++20 + target_compile_options(asio PUBLIC -fsized-deallocation) endif() +if (MINGW) + target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) +endif() \ No newline at end of file From dd9f7e2b2522ea2227076dc67e251413c2b24433 Mon Sep 17 00:00:00 2001 From: DanielaE Date: Fri, 26 May 2023 08:17:38 +0200 Subject: [PATCH 11/57] Improve CMake support --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ef654ad58..f43e915db3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,13 +26,18 @@ target_sources(asio ) target_compile_features(asio PUBLIC cxx_std_20) target_include_directories(asio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) + if (MSVC) # right, but please don't complain about #includes in the module purview target_compile_options(asio PRIVATE /wd5244) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +# I do mean C++23 + target_compile_options(asio PUBLIC /utf-8 /Zc:__cplusplus /Zc:throwingNew /Zc:inline /Zc:externConstexpr /Zc:templateScope /Zc:checkGwOdr /Zc:enumTypes) + +elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # I do mean C++20 - target_compile_options(asio PUBLIC -fsized-deallocation) + target_compile_options(asio PUBLIC -fsized-deallocation -faligned-allocation -fchar8_t) endif() + if (MINGW) target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) endif() \ No newline at end of file From 5e51704018fe146c81d35d03a9f56db638a4cd12 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Fri, 26 May 2023 19:59:13 +0200 Subject: [PATCH 12/57] Compile with Clang in MSYS2 ucrt64 --- module/asio.ixx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/asio.ixx b/module/asio.ixx index 3dcffe024c..cda72abdf2 100644 --- a/module/asio.ixx +++ b/module/asio.ixx @@ -1,4 +1,8 @@ module; +#ifdef __MINGW64__ +# include // work around ODR problems with the C standard library +#endif + #include "asio-gmf.h" export module asio; From 2e8caded5934a034f870e2a5d3d7973ea0aeaae9 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sat, 27 May 2023 08:23:57 +0200 Subject: [PATCH 13/57] Reorder header inclusion in GMF to keep Clang happy --- module/asio-gmf.h | 106 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/module/asio-gmf.h b/module/asio-gmf.h index 77f7ec4f5f..675edc64f4 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -22,6 +22,57 @@ #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include @@ -37,7 +88,7 @@ # include // do not reorder! # include -# include +# include #else # include # include @@ -73,7 +124,7 @@ # include #endif #if defined(ASIO_HAS_PIPE) and defined(ASIO_HAS_IOCP) -# include +# include #endif #ifdef ASIO_ENABLE_HANDLER_TRACKING @@ -96,54 +147,3 @@ # include # include #endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include From e52baf87fbf019360f913bc7b7575fccd766ff7d Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sun, 27 Aug 2023 19:09:46 +0200 Subject: [PATCH 14/57] Enable CMake 3.27 --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f43e915db3..5df6a62b2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,11 @@ project(asio LANGUAGES CXX ) -set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") +if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27) + set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") +else () + set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") +endif() set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) set(CMAKE_CXX_EXTENSIONS OFF) From 232953f29a98830d9a9fc3b14193f0af6784caff Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Mon, 28 Aug 2023 17:46:17 +0200 Subject: [PATCH 15/57] Fix building the module on 'pthread'-based systems: consistent langage linkage! --- include/asio/detail/impl/posix_thread.ipp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asio/detail/impl/posix_thread.ipp b/include/asio/detail/impl/posix_thread.ipp index 4e39e8725f..d064b5dd58 100644 --- a/include/asio/detail/impl/posix_thread.ipp +++ b/include/asio/detail/impl/posix_thread.ipp @@ -68,7 +68,7 @@ posix_thread::func_base* posix_thread::start_thread(func_base* arg) return arg; } -void* asio_detail_posix_thread_function(void* arg) +extern "C" void* asio_detail_posix_thread_function(void* arg) { static_cast(arg)->run(); return 0; From 63ae4dc25a1120c9e7270d7f049f593cdf16929d Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Thu, 31 Aug 2023 20:00:33 +0200 Subject: [PATCH 16/57] Include sys/epoll.h in the GMF --- module/asio-gmf.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/module/asio-gmf.h b/module/asio-gmf.h index 675edc64f4..c1a1351fd5 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -120,8 +120,11 @@ #if defined(ASIO_HAS_DEV_POLL) # include #endif -#if defined(ASIO_HAS_EPOLL) and defined(ASIO_HAS_TIMERFD) -# include +#if defined(ASIO_HAS_EPOLL) +# include +# if defined(ASIO_HAS_TIMERFD) +# include +# endif #endif #if defined(ASIO_HAS_PIPE) and defined(ASIO_HAS_IOCP) # include From 1915f74538a762a3c8b764abc15c126a4ab9bff8 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Fri, 1 Sep 2023 17:52:22 +0200 Subject: [PATCH 17/57] Include sys/eventfd.h in the GMF --- module/asio-gmf.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/asio-gmf.h b/module/asio-gmf.h index c1a1351fd5..37102a3a71 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported #if defined(_WIN32) and __has_include() @@ -126,6 +126,9 @@ # include # endif #endif +#if defined(ASIO_HAS_EVENTFD) +# include +#endif #if defined(ASIO_HAS_PIPE) and defined(ASIO_HAS_IOCP) # include #endif From 66217b3d1a5eefb30b1ce0c1f3f6c26a4ac43799 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Tue, 5 Sep 2023 20:36:55 +0200 Subject: [PATCH 18/57] drop `-fchar8_t` --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5df6a62b2b..1c968c7bc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ if (MSVC) elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # I do mean C++20 - target_compile_options(asio PUBLIC -fsized-deallocation -faligned-allocation -fchar8_t) + target_compile_options(asio PUBLIC -fsized-deallocation -faligned-allocation) endif() if (MINGW) From 9dc1786290ad76276cd3f4e5dbe0c52a37964bb5 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sun, 29 Oct 2023 14:56:47 +0100 Subject: [PATCH 19/57] Support CMake 3.28 and retain support for earlier versions --- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c968c7bc2..66711968b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,12 +10,16 @@ project(asio LANGUAGES CXX ) -if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27) - set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") -else () - set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") +if (CMAKE_VERSION VERSION_LESS 3.28) + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27) + set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") + else () + set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") + endif() + set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) +else() + cmake_policy(VERSION 3.28) endif() -set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) set(CMAKE_CXX_EXTENSIONS OFF) set(asio-sources module/asio.ixx) From 2d71ab4cc8d023aec4bd793ac43bc2e40260e514 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sat, 27 May 2023 11:44:59 +0200 Subject: [PATCH 20/57] =?UTF-8?q?Work=20around=20the=20"vtable=20in=20name?= =?UTF-8?q?d=20module"=20bug=20in=20Clang=2016=20=F0=9F=98=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/asio/execution/bad_executor.hpp | 10 +++++++++- include/asio/execution/impl/bad_executor.ipp | 4 ++-- include/asio/impl/multiple_exceptions.ipp | 4 +++- include/asio/multiple_exceptions.hpp | 10 ++++++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/asio/execution/bad_executor.hpp b/include/asio/execution/bad_executor.hpp index c2b38c984a..e4d4980a72 100644 --- a/include/asio/execution/bad_executor.hpp +++ b/include/asio/execution/bad_executor.hpp @@ -31,7 +31,15 @@ class bad_executor ASIO_DECL bad_executor() noexcept; /// Obtain message associated with exception. - ASIO_DECL virtual const char* what() const noexcept; + ASIO_DECL virtual const char* what() const + ASIO_NOEXCEPT_OR_NOTHROW +#ifdef ASIO_MODULE + { + return "bad executor"; + } +#else + ; +#endif }; } // namespace execution diff --git a/include/asio/execution/impl/bad_executor.ipp b/include/asio/execution/impl/bad_executor.ipp index a5d927e89c..c360e94fea 100644 --- a/include/asio/execution/impl/bad_executor.ipp +++ b/include/asio/execution/impl/bad_executor.ipp @@ -26,12 +26,12 @@ namespace execution { bad_executor::bad_executor() noexcept { } - +#ifndef ASIO_MODULE const char* bad_executor::what() const noexcept { return "bad executor"; } - +#endif } // namespace execution } // namespace asio diff --git a/include/asio/impl/multiple_exceptions.ipp b/include/asio/impl/multiple_exceptions.ipp index 9ed1d8efd8..21bd4134a4 100644 --- a/include/asio/impl/multiple_exceptions.ipp +++ b/include/asio/impl/multiple_exceptions.ipp @@ -28,10 +28,12 @@ multiple_exceptions::multiple_exceptions( { } -const char* multiple_exceptions::what() const noexcept +#ifndef ASIO_MODULE +const char* multiple_exceptions::what() const ASIO_NOEXCEPT_OR_NOTHROW { return "multiple exceptions"; } +#endif std::exception_ptr multiple_exceptions::first_exception() const { diff --git a/include/asio/multiple_exceptions.hpp b/include/asio/multiple_exceptions.hpp index 43373690c1..e084741d7d 100644 --- a/include/asio/multiple_exceptions.hpp +++ b/include/asio/multiple_exceptions.hpp @@ -32,8 +32,14 @@ class multiple_exceptions /// Obtain message associated with exception. ASIO_DECL virtual const char* what() const - noexcept; - + ASIO_NOEXCEPT_OR_NOTHROW +#ifdef ASIO_MODULE + { + return "multiple exceptions"; + } +#else + ; +#endif /// Obtain a pointer to the first exception. ASIO_DECL std::exception_ptr first_exception() const; From dad2488fb47232de831b02768fcbbbad33083c3f Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Sun, 27 Jul 2025 14:41:38 +0200 Subject: [PATCH 21/57] `if (cond)` -> `if constexpr (cond)` with compiletime-known condition --- include/asio/detail/chrono_time_traits.hpp | 6 +++--- include/asio/impl/io_context.hpp | 4 ++-- include/asio/impl/thread_pool.hpp | 4 ++-- include/asio/io_context.hpp | 10 +++++----- include/asio/thread_pool.hpp | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/asio/detail/chrono_time_traits.hpp b/include/asio/detail/chrono_time_traits.hpp index 5e278fe55f..42ed73ff04 100644 --- a/include/asio/detail/chrono_time_traits.hpp +++ b/include/asio/detail/chrono_time_traits.hpp @@ -162,11 +162,11 @@ struct chrono_time_traits const int64_t num = num1 * den2; const int64_t den = num2 * den1; - if (num == 1 && den == 1) + if constexpr (num == 1 && den == 1) return ticks(); - else if (num != 1 && den == 1) + else if constexpr (num != 1 && den == 1) return ticks() * num; - else if (num == 1 && period_type::den != 1) + else if constexpr (num == 1 && period_type::den != 1) return ticks() / den; else return ticks() * num / den; diff --git a/include/asio/impl/io_context.hpp b/include/asio/impl/io_context.hpp index 511755e506..18b9678630 100644 --- a/include/asio/impl/io_context.hpp +++ b/include/asio/impl/io_context.hpp @@ -156,7 +156,7 @@ io_context::basic_executor_type::operator=( static_cast(*this) = static_cast(other); io_context* old_io_context = context_ptr(); target_ = other.target_; - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) { if (context_ptr()) context_ptr()->impl_.work_started(); @@ -177,7 +177,7 @@ io_context::basic_executor_type::operator=( static_cast(*this) = static_cast(other); io_context* old_io_context = context_ptr(); target_ = other.target_; - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) { other.target_ = 0; if (old_io_context) diff --git a/include/asio/impl/thread_pool.hpp b/include/asio/impl/thread_pool.hpp index ba01b97fb7..2400179037 100644 --- a/include/asio/impl/thread_pool.hpp +++ b/include/asio/impl/thread_pool.hpp @@ -91,7 +91,7 @@ thread_pool::basic_executor_type::operator=( pool_ = other.pool_; allocator_ = other.allocator_; bits_ = other.bits_; - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) { if (pool_) pool_->scheduler_.work_started(); @@ -113,7 +113,7 @@ thread_pool::basic_executor_type::operator=( pool_ = other.pool_; allocator_ = std::move(other.allocator_); bits_ = other.bits_; - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) { other.pool_ = 0; if (old_thread_pool) diff --git a/include/asio/io_context.hpp b/include/asio/io_context.hpp index 5f5d72f73b..9254edb9a5 100644 --- a/include/asio/io_context.hpp +++ b/include/asio/io_context.hpp @@ -538,7 +538,7 @@ class io_context::basic_executor_type : : Allocator(static_cast(other)), target_(other.target_) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) if (context_ptr()) context_ptr()->impl_.work_started(); } @@ -548,14 +548,14 @@ class io_context::basic_executor_type : : Allocator(static_cast(other)), target_(other.target_) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) other.target_ = 0; } /// Destructor. ~basic_executor_type() noexcept { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) if (context_ptr()) context_ptr()->impl_.work_finished(); } @@ -971,7 +971,7 @@ class io_context::basic_executor_type : : Allocator(), target_(reinterpret_cast(&i)) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) context_ptr()->impl_.work_started(); } @@ -981,7 +981,7 @@ class io_context::basic_executor_type : : Allocator(a), target_(reinterpret_cast(i) | bits) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) if (context_ptr()) context_ptr()->impl_.work_started(); } diff --git a/include/asio/thread_pool.hpp b/include/asio/thread_pool.hpp index 54478d1edb..26aee200d2 100644 --- a/include/asio/thread_pool.hpp +++ b/include/asio/thread_pool.hpp @@ -243,7 +243,7 @@ class thread_pool::basic_executor_type : detail::thread_pool_bits allocator_(other.allocator_), bits_(other.bits_) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) if (pool_) pool_->scheduler_.work_started(); } @@ -254,14 +254,14 @@ class thread_pool::basic_executor_type : detail::thread_pool_bits allocator_(static_cast(other.allocator_)), bits_(other.bits_) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) other.pool_ = 0; } /// Destructor. ~basic_executor_type() noexcept { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) if (pool_) pool_->scheduler_.work_finished(); } @@ -724,7 +724,7 @@ class thread_pool::basic_executor_type : detail::thread_pool_bits allocator_(), bits_(0) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) pool_->scheduler_.work_started(); } @@ -735,7 +735,7 @@ class thread_pool::basic_executor_type : detail::thread_pool_bits allocator_(a), bits_(bits) { - if (Bits & outstanding_work_tracked) + if constexpr (Bits & outstanding_work_tracked) if (pool_) pool_->scheduler_.work_started(); } From e8ab8db281c3676df6cc8cbdd2deb20a398e1e51 Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Thu, 7 Aug 2025 12:31:04 +0200 Subject: [PATCH 22/57] fix compile issues from in-house tests --- module/asio.ixx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/asio.ixx b/module/asio.ixx index cda72abdf2..aaebbb88b1 100644 --- a/module/asio.ixx +++ b/module/asio.ixx @@ -5,6 +5,10 @@ module; #include "asio-gmf.h" +#ifdef _MSC_VER +# pragma warning(disable:4180) +#endif + export module asio; #ifdef _MSC_VER From d38f89abd1a339f6e491adf61fa83c956846fe6d Mon Sep 17 00:00:00 2001 From: Daniela Engert Date: Mon, 1 Dec 2025 13:31:30 +0100 Subject: [PATCH 23/57] pick up library customizations from the surrounding environment --- module/asio-gmf.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/asio-gmf.h b/module/asio-gmf.h index 37102a3a71..6de4f7f9a8 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -17,7 +17,14 @@ # define ASIO_DISABLE_BUFFER_DEBUGGING #endif -#define ASIO_NO_DEPRECATED +#if __has_include() +# include +#else +# define ASIO_NO_DEPRECATED +# undef ASIO_DEPRECATED_MSG +# define ASIO_DISABLE_DEPRECATED_MSG +#endif + #define ASIO_MODULE #include From fd810c1600daa0d29241428f795df2903b68c9fa Mon Sep 17 00:00:00 2001 From: yudaichen <250074249@qq.com> Date: Wed, 29 Oct 2025 10:50:50 +0800 Subject: [PATCH 24/57] Fix C++23 module export issue with SSL error categories Changes: - Change 'static const' to 'inline const' for ssl_category and stream_category - Add optional SSL support via ASIO_ENABLE_SSL CMake option (default: OFF) - Resolves 'cannot export symbol with internal linkage' compilation error The inline specifier ensures external linkage while maintaining semantics. --- CMakeLists.txt | 13 +++++++++++++ include/asio/ssl/error.hpp | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66711968b6..48238fa97c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,19 @@ target_sources(asio target_compile_features(asio PUBLIC cxx_std_20) target_include_directories(asio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) +# Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=ON) +option(ASIO_ENABLE_SSL "Enable SSL support for ASIO module" OFF) + +if(ASIO_ENABLE_SSL) + find_package(OpenSSL REQUIRED) + target_compile_definitions(asio PUBLIC ASIO_USE_SSL) + target_include_directories(asio PUBLIC ${OPENSSL_INCLUDE_DIR}) + target_link_libraries(asio PUBLIC OpenSSL::SSL OpenSSL::Crypto) + message(STATUS "ASIO: SSL support enabled") +else() + message(STATUS "ASIO: SSL support disabled (use -DASIO_ENABLE_SSL=ON to enable)") +endif() + if (MSVC) # right, but please don't complain about #includes in the module purview target_compile_options(asio PRIVATE /wd5244) diff --git a/include/asio/ssl/error.hpp b/include/asio/ssl/error.hpp index 6b9221883d..58e315fc69 100644 --- a/include/asio/ssl/error.hpp +++ b/include/asio/ssl/error.hpp @@ -32,7 +32,7 @@ enum ssl_errors extern ASIO_DECL const asio::error_category& get_ssl_category(); -static const asio::error_category& +inline const asio::error_category& ssl_category ASIO_UNUSED_VARIABLE = asio::error::get_ssl_category(); @@ -69,7 +69,7 @@ enum stream_errors extern ASIO_DECL const asio::error_category& get_stream_category(); -static const asio::error_category& +inline const asio::error_category& stream_category ASIO_UNUSED_VARIABLE = asio::ssl::error::get_stream_category(); From 3c60183afefc9abff1a922db21dc9f03284f86b4 Mon Sep 17 00:00:00 2001 From: yudaichen <250074249@qq.com> Date: Wed, 29 Oct 2025 16:42:11 +0800 Subject: [PATCH 25/57] Fix OpenSSL header include and improve CMake configuration - Fix typo in asio-gmf.h: 'openssl / conf.h' -> 'openssl/conf.h' - Add SYSTEM keyword for OpenSSL include directories - Change ASIO_ENABLE_SSL default to ON - Add detailed logging for OpenSSL paths --- CMakeLists.txt | 12 ++++++++---- module/asio-gmf.h | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 48238fa97c..4ce887c1b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,15 +35,19 @@ target_sources(asio target_compile_features(asio PUBLIC cxx_std_20) target_include_directories(asio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) -# Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=ON) -option(ASIO_ENABLE_SSL "Enable SSL support for ASIO module" OFF) +# Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=OFF to disable) +option(ASIO_ENABLE_SSL "Enable SSL support for ASIO module" ON) if(ASIO_ENABLE_SSL) find_package(OpenSSL REQUIRED) target_compile_definitions(asio PUBLIC ASIO_USE_SSL) - target_include_directories(asio PUBLIC ${OPENSSL_INCLUDE_DIR}) + # Add OpenSSL include directories for module compilation + # Use SYSTEM to mark as system headers and PRIVATE for module internal use + target_include_directories(asio SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR}) + # Also add as PUBLIC for consumers + target_include_directories(asio SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR}) target_link_libraries(asio PUBLIC OpenSSL::SSL OpenSSL::Crypto) - message(STATUS "ASIO: SSL support enabled") + message(STATUS "ASIO: SSL support enabled with OpenSSL at ${OPENSSL_INCLUDE_DIR}") else() message(STATUS "ASIO: SSL support disabled (use -DASIO_ENABLE_SSL=ON to enable)") endif() diff --git a/module/asio-gmf.h b/module/asio-gmf.h index 6de4f7f9a8..f11fc553c6 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -150,7 +150,7 @@ # endif // defined(ASIO_USE_WOLFSSL) # include -# include +# include # if !defined(OPENSSL_NO_ENGINE) # include # endif // !defined(OPENSSL_NO_ENGINE) @@ -159,4 +159,4 @@ # include # include # include -#endif +#endif \ No newline at end of file From e04944343e61d2c44b84abc7b092b8606f832de7 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 1 Mar 2026 12:56:57 +0100 Subject: [PATCH 26/57] Feat: Modernize CMakeLists.txt --- .gitignore | 6 + CMakeLists.txt | 180 ++++++++++++++++------ GNUmakefile | 31 ++++ include/asio/detail/impl/posix_thread.ipp | 2 + include/asio/inline_or_executor.hpp | 4 + 5 files changed, 177 insertions(+), 46 deletions(-) create mode 100644 GNUmakefile diff --git a/.gitignore b/.gitignore index 5d4169782b..5bbccb3fcf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +.cache/ +.init +compile_commands.json +CMakeUserPresets.json +stagedir/ +build/ Makefile Makefile.in aclocal.m4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ce887c1b1..ca2dc87448 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,68 +1,156 @@ -cmake_minimum_required(VERSION 3.26) +cmake_minimum_required(VERSION 3.30...4.3) -if (CMAKE_CXX_STANDARD LESS 20) - message(FATAL_ERROR "At least C++20 required but have ${CMAKE_CXX_STANDARD}") +if(CMAKE_CXX_STANDARD LESS 20) + message( + FATAL_ERROR + "At least C++20 required but have ${CMAKE_CXX_STANDARD}" + ) endif() -project(asio - DESCRIPTION "Modularized Asio for C++20" - HOMEPAGE_URL "https://github.com/DanielaE/asio/tree/module" - LANGUAGES CXX +project( + asio + DESCRIPTION "Modularized Asio for C++20" + HOMEPAGE_URL "https://github.com/DanielaE/asio/tree/module" + LANGUAGES CXX ) -if (CMAKE_VERSION VERSION_LESS 3.28) - if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.27) - set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "aa1f7df0-828a-4fcd-9afc-2dc80491aca7") - else () - set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a") - endif() - set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1) -else() - cmake_policy(VERSION 3.28) +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 23) endif() -set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_CXX_EXTENSIONS ON) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_INSTALL_MESSAGE LAZY) +set(CMAKE_SKIP_TEST_ALL_DEPENDENCY OFF) + +# ---- Declare libraries ---- + +file( + GLOB_RECURSE _asio_implementation + "include/asio/*/*.hpp" + "include/asio/*.ipp" +) +list(FILTER _asio_implementation EXCLUDE REGEX [=[.*/experimental/.*]=]) + + +#============================== +# asio interface library +#============================== +add_library(asio_header INTERFACE) +add_library(asio::asio_header ALIAS asio_header) +target_sources( + asio_header + INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${_asio_implementation} +) +target_compile_features(asio_header INTERFACE cxx_std_${CMAKE_CXX_STANDARD}) -set(asio-sources module/asio.ixx) +#============================== +# asio module library +#============================== +file(GLOB_RECURSE _asio_headers "include/asio/*.hpp") +list(FILTER _asio_headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=]) +list(FILTER _asio_headers EXCLUDE REGEX [=[.*/spawn.*\.hpp]=]) + +# FIXME: some header in include/asio/detail fails VERIFY_INTERFACE_HEADER_SETS! +# NOTE: we need them installed, but we used them install with asio_header INTERFACE! CK +set(_public_headers include/asio.hpp ${_asio_headers}) +list(FILTER _public_headers EXCLUDE REGEX [=[.*/detail/.*\.hpp]=]) +list(FILTER _public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=]) +# foreach(header in LISTS ${_public_headers}) +# message(DEBUG "${header}") +# endforeach() add_library(asio STATIC) add_library(asio::asio ALIAS asio) -target_sources(asio - PUBLIC - FILE_SET modules TYPE CXX_MODULES - BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/module - FILES ${asio-sources} +target_sources( + asio + PUBLIC + FILE_SET modules + TYPE CXX_MODULES + BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/module + FILES module/asio.ixx + FILE_SET HEADERS BASE_DIRS include FILES ${_public_headers} +) +target_compile_features(asio PUBLIC cxx_std_${CMAKE_CXX_STANDARD}) +set_target_properties( + asio + PROPERTIES VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL} ) -target_compile_features(asio PUBLIC cxx_std_20) -target_include_directories(asio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) + +target_link_libraries(asio PUBLIC asio_header) # Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=OFF to disable) option(ASIO_ENABLE_SSL "Enable SSL support for ASIO module" ON) if(ASIO_ENABLE_SSL) - find_package(OpenSSL REQUIRED) - target_compile_definitions(asio PUBLIC ASIO_USE_SSL) - # Add OpenSSL include directories for module compilation - # Use SYSTEM to mark as system headers and PRIVATE for module internal use - target_include_directories(asio SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR}) - # Also add as PUBLIC for consumers - target_include_directories(asio SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR}) - target_link_libraries(asio PUBLIC OpenSSL::SSL OpenSSL::Crypto) - message(STATUS "ASIO: SSL support enabled with OpenSSL at ${OPENSSL_INCLUDE_DIR}") + find_package(OpenSSL REQUIRED) + target_compile_definitions(asio PUBLIC ASIO_USE_SSL) + # Add OpenSSL include directories for module compilation + # Use SYSTEM to mark as system headers and PRIVATE for module internal use + target_include_directories(asio SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR}) + # Also add as PUBLIC for consumers + target_include_directories(asio SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR}) + target_link_libraries(asio PUBLIC OpenSSL::SSL OpenSSL::Crypto) + message( + STATUS + "ASIO: SSL support enabled with OpenSSL at ${OPENSSL_INCLUDE_DIR}" + ) else() - message(STATUS "ASIO: SSL support disabled (use -DASIO_ENABLE_SSL=ON to enable)") + message( + STATUS + "ASIO: SSL support disabled (use -DASIO_ENABLE_SSL=ON to enable)" + ) endif() -if (MSVC) -# right, but please don't complain about #includes in the module purview - target_compile_options(asio PRIVATE /wd5244) -# I do mean C++23 - target_compile_options(asio PUBLIC /utf-8 /Zc:__cplusplus /Zc:throwingNew /Zc:inline /Zc:externConstexpr /Zc:templateScope /Zc:checkGwOdr /Zc:enumTypes) +if(MSVC) + # right, but please don't complain about #includes in the module purview + target_compile_options(asio PRIVATE /wd5244) + # I do mean C++23 + target_compile_options( + asio + PUBLIC + /utf-8 + /Zc:__cplusplus + /Zc:throwingNew + /Zc:inline + /Zc:externConstexpr + /Zc:templateScope + /Zc:checkGwOdr + /Zc:enumTypes + ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # I do mean C++20 + target_compile_options( + asio + PUBLIC + -fsized-deallocation + -faligned-allocation + -Wno-include-angled-in-module-purview + ) +endif() -elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") -# I do mean C++20 - target_compile_options(asio PUBLIC -fsized-deallocation -faligned-allocation) +if(MINGW) + target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) endif() -if (MINGW) - target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) -endif() \ No newline at end of file +# +# Install the libraries and its FILE_SET's. +# +include(GNUInstallDirs) + +set(package_install_dir ${CMAKE_INSTALL_LIBDIR}/cmake/asio) + +install( + TARGETS asio asio_header + # EXPORT ${targets_export_name} + COMPONENT asio_Development + FILE_SET HEADERS + FILE_SET CXX_MODULES + CXX_MODULES_BMI + DESTINATION + ${package_install_dir}/bmi-${CMAKE_CXX_COMPILER_ID}_$ + FILE_SET asio_header +) + +# TODO(CK): install the cmake config packages too diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000000..2646b73214 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,31 @@ +# Standard stuff + +.SUFFIXES: + +MAKEFLAGS+= --no-builtin-rules # Disable the built-in implicit rules. +# MAKEFLAGS+= --warn-undefined-variables # Warn when an undefined variable is referenced. + +.PHONY: all test install check clean + +all: build + ninja -C build all all_verify_interface_header_sets + +build: GNUmakefile CMakeLists.txt + cmake --version + CXX=clang++ cmake -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=23 -D CMAKE_BUILD_TYPE=Release --fresh -Wdev + ln -fs build/compile_commands.json . + +clean: + rm -rf build .cache compile_commands.json + find . -name .DS_Store -delete + find . -name '*~' -delete + +check: build + run-clang-tidy src/examples/cpp20 + +install test: build + ninja -C build $(@) + +# Anything we don't know how to build will use this rule. +% :: + ninja -C build $(@) diff --git a/include/asio/detail/impl/posix_thread.ipp b/include/asio/detail/impl/posix_thread.ipp index d064b5dd58..5df7adec15 100644 --- a/include/asio/detail/impl/posix_thread.ipp +++ b/include/asio/detail/impl/posix_thread.ipp @@ -25,6 +25,8 @@ #include "asio/detail/push_options.hpp" +#include // for std::terminate(); + namespace asio { namespace detail { diff --git a/include/asio/inline_or_executor.hpp b/include/asio/inline_or_executor.hpp index 3f35674f67..d497b0b9d8 100644 --- a/include/asio/inline_or_executor.hpp +++ b/include/asio/inline_or_executor.hpp @@ -26,6 +26,10 @@ #include "asio/detail/push_options.hpp" +#if !defined(ASIO_NO_EXCEPTIONS) +# include // for std::terminate(); +#endif + namespace asio { /// Adapts an executor to add inline invocation of the submitted function. From 5627530e776f5182018daba24f1f61ff4e058205 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 1 Mar 2026 16:24:23 +0100 Subject: [PATCH 27/57] Prepare build with import std; --- CMakeLists.txt | 55 +++++++++++++++++++++++++++++++++++++---------- GNUmakefile | 47 ++++++++++++++++++++++++++++++++++++---- module/asio-gmf.h | 10 ++++----- module/asio.ixx | 5 +++++ 4 files changed, 97 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca2dc87448..c051c14710 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,19 @@ cmake_minimum_required(VERSION 3.30...4.3) +# gersemi: off if(CMAKE_CXX_STANDARD LESS 20) - message( - FATAL_ERROR - "At least C++20 required but have ${CMAKE_CXX_STANDARD}" - ) + message( FATAL_ERROR "At least C++20 required but have ${CMAKE_CXX_STANDARD}") +endif() + +# --------------------------------------------------------------------------- +# check if import std; is supported by CMAKE_CXX_COMPILER +# --------------------------------------------------------------------------- +if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.3 AND CMAKE_VERSION VERSION_LESS 4.4) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") +elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.3) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") endif() +# gersemi: on project( asio @@ -24,6 +32,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_INSTALL_MESSAGE LAZY) set(CMAKE_SKIP_TEST_ALL_DEPENDENCY OFF) +message( + STATUS + "Cmake is: ${CMAKE_VERSION} modules scan: ${CMAKE_CXX_SCAN_FOR_MODULES}" +) + # ---- Declare libraries ---- file( @@ -33,7 +46,6 @@ file( ) list(FILTER _asio_implementation EXCLUDE REGEX [=[.*/experimental/.*]=]) - #============================== # asio interface library #============================== @@ -66,10 +78,7 @@ add_library(asio::asio ALIAS asio) target_sources( asio PUBLIC - FILE_SET modules - TYPE CXX_MODULES - BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/module - FILES module/asio.ixx + FILE_SET modules TYPE CXX_MODULES BASE_DIRS module FILES module/asio.ixx FILE_SET HEADERS BASE_DIRS include FILES ${_public_headers} ) target_compile_features(asio PUBLIC cxx_std_${CMAKE_CXX_STANDARD}) @@ -77,12 +86,36 @@ set_target_properties( asio PROPERTIES VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL} ) - target_link_libraries(asio PUBLIC asio_header) +option(ASIO_IMPORT_STD "Enable 'import std;' support for ASIO module" OFF) +if(ASIO_IMPORT_STD) + message( + STATUS + "CMAKE_CXX_COMPILER_IMPORT_STD=${CMAKE_CXX_COMPILER_IMPORT_STD}" + ) + if(${CMAKE_CXX_STANDARD} IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) + option( + ASIO_HAS_IMPORT_STD + "Build with import std; is possible and used!" + ON + ) + message(STATUS "CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}") + endif() + message(STATUS "ASIO_HAS_IMPORT_STD=${ASIO_HAS_IMPORT_STD}") +endif() +if(ASIO_HAS_IMPORT_STD) + # ------------------------------------------------------------------------- + # Tell CMake that we explicitly want `import std`. + # This will initialize the property CXX_MODULE_STD of asio targets to 1 + # ------------------------------------------------------------------------- + target_compile_definitions(asio PUBLIC ASIO_HAS_IMPORT_STD) + set_target_properties(asio PROPERTIES CXX_MODULE_STD ON) + message(STATUS "Build asio with target PROPERRY CXX_MODULE_STD ON") +endif() + # Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=OFF to disable) option(ASIO_ENABLE_SSL "Enable SSL support for ASIO module" ON) - if(ASIO_ENABLE_SSL) find_package(OpenSSL REQUIRED) target_compile_definitions(asio PUBLIC ASIO_USE_SSL) diff --git a/GNUmakefile b/GNUmakefile index 2646b73214..df858b3d51 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,16 +3,53 @@ .SUFFIXES: MAKEFLAGS+= --no-builtin-rules # Disable the built-in implicit rules. -# MAKEFLAGS+= --warn-undefined-variables # Warn when an undefined variable is referenced. +MAKEFLAGS+= --warn-undefined-variables # Warn when an undefined variable is referenced. -.PHONY: all test install check clean +export hostSystemName=$(shell uname) + +ifeq (${hostSystemName},Darwin) + export LLVM_PREFIX:=$(shell brew --prefix llvm) + export LLVM_DIR:=$(shell realpath ${LLVM_PREFIX}) + export PATH:=${LLVM_DIR}/bin:${PATH} + #XXX CMAKE=${HOME}/.local/bin/cmake # cmake v4.4-rc1 + CMAKE?=/usr/local/bin/cmake + + export CMAKE_CXX_STDLIB_MODULES_JSON:=${LLVM_DIR}/lib/c++/libc++.modules.json + export CXXFLAGS:=-stdlib=libc++ + export LDFLAGS:=-L$(LLVM_DIR)/lib/c++ -lc++abi # XXX -lc++ + export CXX:=clang++ + export GCOV:="llvm-cov gcov" + + ### FIXME: to test g++-15: + # include/asio/detail/posix_thread.hpp error: conflicting declaration of 'void* asio::detail::asio_detail_posix_thread_function(void*)' in module 'asio' + # friend void* asio_detail_posix_thread_function(void* arg); + export GCC_PREFIX:=$(shell brew --prefix gcc) + export GCC_DIR:=$(shell realpath ${GCC_PREFIX}) + + # # XXX NOT need! export CMAKE_CXX_STDLIB_MODULES_JSON:=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json + # # XXX NOT need! export CXXFLAGS:=-stdlib=libstdc++ + # export LDFLAGS:=-L$(GCC_DIR)/libgcc/current # XXX -lstdc++ + # export CXX:=g++-15 + # export GCOV:="gcov" +else ifeq (${hostSystemName},Linux) + export LLVM_DIR:=/usr/lib/llvm-22 + export PATH:=${LLVM_DIR}/bin:${PATH} + export CXX:=clang++-22 + CMAKE=cmake +endif + +############################################################# +.PHONY: all test check install clean +############################################################# all: build ninja -C build all all_verify_interface_header_sets build: GNUmakefile CMakeLists.txt - cmake --version - CXX=clang++ cmake -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=23 -D CMAKE_BUILD_TYPE=Release --fresh -Wdev + ${CMAKE} --version + CXX=$(CXX) ${CMAKE} -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=26 -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ + -D ASIO_IMPORT_STD=ON --fresh -Wdev ln -fs build/compile_commands.json . clean: @@ -26,6 +63,8 @@ check: build install test: build ninja -C build $(@) +############################################################# # Anything we don't know how to build will use this rule. +############################################################# % :: ninja -C build $(@) diff --git a/module/asio-gmf.h b/module/asio-gmf.h index f11fc553c6..f339d439f8 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -80,6 +80,10 @@ #include #include +#ifdef ASIO_ENABLE_HANDLER_TRACKING +# include +#endif + #include #include @@ -140,10 +144,6 @@ # include #endif -#ifdef ASIO_ENABLE_HANDLER_TRACKING -# include -#endif - #if defined(ASIO_USE_SSL) # if defined(ASIO_USE_WOLFSSL) # include @@ -159,4 +159,4 @@ # include # include # include -#endif \ No newline at end of file +#endif diff --git a/module/asio.ixx b/module/asio.ixx index aaebbb88b1..62350ecb9b 100644 --- a/module/asio.ixx +++ b/module/asio.ixx @@ -9,6 +9,10 @@ module; # pragma warning(disable:4180) #endif +#ifdef ASIO_HAS_IMPORT_STD +import std; +#endif + export module asio; #ifdef _MSC_VER @@ -53,6 +57,7 @@ export { } // extern "C++" #endif +// FIXME: g++-15 error: sorry, unimplemented: private module fragment module :private; #include "asio/impl/src.hpp" From 3b8ab7aaa8721963f3dd278156bbe3c79143fb91 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 1 Mar 2026 17:16:53 +0100 Subject: [PATCH 28/57] Check more header fix missing includes --- CMakeLists.txt | 4 +--- include/asio/detail/impl/posix_thread.ipp | 3 +-- include/asio/experimental/channel_traits.hpp | 1 + include/asio/experimental/impl/use_promise.hpp | 2 +- include/asio/inline_or_executor.hpp | 7 +++---- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c051c14710..9241cf115f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,10 +41,9 @@ message( file( GLOB_RECURSE _asio_implementation - "include/asio/*/*.hpp" + "include/asio/*.hpp" "include/asio/*.ipp" ) -list(FILTER _asio_implementation EXCLUDE REGEX [=[.*/experimental/.*]=]) #============================== # asio interface library @@ -61,7 +60,6 @@ target_compile_features(asio_header INTERFACE cxx_std_${CMAKE_CXX_STANDARD}) # asio module library #============================== file(GLOB_RECURSE _asio_headers "include/asio/*.hpp") -list(FILTER _asio_headers EXCLUDE REGEX [=[.*/experimental/.*\.hpp]=]) list(FILTER _asio_headers EXCLUDE REGEX [=[.*/spawn.*\.hpp]=]) # FIXME: some header in include/asio/detail fails VERIFY_INTERFACE_HEADER_SETS! diff --git a/include/asio/detail/impl/posix_thread.ipp b/include/asio/detail/impl/posix_thread.ipp index 5df7adec15..15a4b96992 100644 --- a/include/asio/detail/impl/posix_thread.ipp +++ b/include/asio/detail/impl/posix_thread.ipp @@ -19,14 +19,13 @@ #if defined(ASIO_HAS_PTHREADS) +#include // use std::terminate(); #include "asio/detail/posix_thread.hpp" #include "asio/detail/throw_error.hpp" #include "asio/error.hpp" #include "asio/detail/push_options.hpp" -#include // for std::terminate(); - namespace asio { namespace detail { diff --git a/include/asio/experimental/channel_traits.hpp b/include/asio/experimental/channel_traits.hpp index 55e07af7b6..a5438c6d6a 100644 --- a/include/asio/experimental/channel_traits.hpp +++ b/include/asio/experimental/channel_traits.hpp @@ -16,6 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" +#include // use std::exception_ptr #include #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" diff --git a/include/asio/experimental/impl/use_promise.hpp b/include/asio/experimental/impl/use_promise.hpp index 259edb394b..a1aeb5bfe6 100644 --- a/include/asio/experimental/impl/use_promise.hpp +++ b/include/asio/experimental/impl/use_promise.hpp @@ -36,7 +36,7 @@ struct promise_handler; } // namespace detail } // namespace experimental -#if !defined(GENERATING_DOCUMENTATION) +#if !defined(GENERATING_DOCUMENTATION) && defined(ASIO_HAS_EXPERIMENTAL_PROMISE) template struct async_result, R(Args...)> diff --git a/include/asio/inline_or_executor.hpp b/include/asio/inline_or_executor.hpp index d497b0b9d8..86c315ff1e 100644 --- a/include/asio/inline_or_executor.hpp +++ b/include/asio/inline_or_executor.hpp @@ -16,6 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" +#if !defined(ASIO_NO_EXCEPTIONS) +# include // use std::terminate(); +#endif #include "asio/detail/non_const_lvalue.hpp" #include "asio/detail/type_traits.hpp" #include "asio/execution/blocking.hpp" @@ -26,10 +29,6 @@ #include "asio/detail/push_options.hpp" -#if !defined(ASIO_NO_EXCEPTIONS) -# include // for std::terminate(); -#endif - namespace asio { /// Adapts an executor to add inline invocation of the submitted function. From af2ae1c67b3946d59deddd41372f6c63dbd21870 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 1 Mar 2026 23:00:54 +0100 Subject: [PATCH 29/57] Add more CI workflows --- .github/workflows/ci.yml | 48 +++++++++++++++++----------------- .github/workflows/clang.yml | 49 +++++++++++++++++++++++++++++++++++ .github/workflows/gcc.yml | 48 ++++++++++++++++++++++++++++++++++ .github/workflows/windows.yml | 8 +++++- CMakeLists.txt | 1 + GNUmakefile | 7 ++--- module/asio-gmf.h | 8 ++++-- 7 files changed, 139 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/clang.yml create mode 100644 .github/workflows/gcc.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cd416fc53..6934e345b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -310,27 +310,27 @@ jobs: CXX: ${{ matrix.compiler }} CXXFLAGS: -std=${{ matrix.cxx-std }} ${{ matrix.cxx-stdlib }} ${{ matrix.optim-level }} -Wall -Wextra ${{ matrix.no-deprecated }} ${{ matrix.select-reactor }} ${{ matrix.handler-tracking }} steps: - - uses: actions/checkout@v4 - - name: Install autotools - if: startsWith(matrix.runs-on, 'macos') - run: brew install automake - - name: Install compiler - if: startsWith(matrix.runs-on, 'ubuntu') - run: sudo apt-get install -y ${{ matrix.compiler }} - - name: Install boost - if: startsWith(matrix.with-boost, '--with-boost=$GITHUB_WORKSPACE') - run: | - wget --quiet -O - ${{ matrix.boost-url }} | tar -xj - - name: Configure - run: | - ./autogen.sh - ./configure ${{ matrix.separate-compilation }} ${{ matrix.with-boost }} - - name: Line length check - run: perl ./boostify.pl --includes-only - - name: Sanity check - if: startsWith(matrix.build-type, 'sanity') - working-directory: src/tests - run: make unit/io_context.log unit/ip/tcp.log unit/ts/net.log - - name: Build - if: startsWith(matrix.build-type, 'full') - run: make && make check + - uses: actions/checkout@v4 + - name: Install autotools + if: startsWith(matrix.runs-on, 'macos') + run: brew install automake + - name: Install compiler + if: startsWith(matrix.runs-on, 'ubuntu') + run: sudo apt-get install -y ${{ matrix.compiler }} + - name: Install boost + if: startsWith(matrix.with-boost, '--with-boost=$GITHUB_WORKSPACE') + run: | + wget --quiet -O - ${{ matrix.boost-url }} | tar -xj + - name: Configure + run: | + ./autogen.sh + ./configure ${{ matrix.separate-compilation }} ${{ matrix.with-boost }} + - name: Line length check + run: perl ./boostify.pl --includes-only + - name: Sanity check + if: startsWith(matrix.build-type, 'sanity') + working-directory: src/tests + run: make unit/io_context.log unit/ip/tcp.log unit/ts/net.log + - name: Build + if: startsWith(matrix.build-type, 'full') + run: make && make check diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml new file mode 100644 index 0000000000..8e7c3b609a --- /dev/null +++ b/.github/workflows/clang.yml @@ -0,0 +1,49 @@ +name: Clang + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ develop ] + workflow_dispatch: + schedule: + - cron: "30 15 * * 0" # Every Sunday at 15:30 UTC + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + clang: + strategy: + fail-fast: false + matrix: + version: [21, 22] + + runs-on: ubuntu-latest + + container: + image: ghcr.io/mattkretz/cplusplus-ci/clang${{ matrix.version }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: { python-version: "3.13" } + + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + # compiler: llvm-${{ matrix.version }} + cmake: 4.2.3 + ninja: 1.13.0 + gcovr: true + + - name: Run test suite + env: + # CXX: clang++-${{ matrix.version }} + CXX: clang++ + PATH: $HOME/.local/bin:$PATH + run: | + # export PATH=$HOME/.local/bin:$PATH + make all diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml new file mode 100644 index 0000000000..e9331b0f87 --- /dev/null +++ b/.github/workflows/gcc.yml @@ -0,0 +1,48 @@ +name: GCC + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ develop ] + workflow_dispatch: + schedule: + - cron: "30 15 * * 0" # Every Sunday at 15:30 UTC + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + gcc: + strategy: + fail-fast: false + matrix: + version: [15, 16] + + runs-on: ubuntu-latest + + container: + image: ghcr.io/mattkretz/cplusplus-ci/gcc${{ matrix.version }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: { python-version: "3.13" } + + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + cmake: 4.2.3 + ninja: 1.13.0 + gcovr: true + + - name: Run test suite + env: + # CXX: g++-${{ matrix.version }} + CXX: g++ + PATH: $HOME/.local/bin:$PATH + run: | + # export PATH=$HOME/.local/bin:$PATH + make all diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 555cec7754..f358a990d0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -5,10 +5,15 @@ on: [push, pull_request] permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ${{matrix.os}} strategy: + fail-fast: false matrix: # windows-2022 has MSVC 2022 installed: # https://github.com/actions/virtual-environments. @@ -47,6 +52,7 @@ jobs: run: shell: msys2 {0} strategy: + fail-fast: false matrix: cxx: [ clang++ ] lib: [ libc++, libstdc++ ] @@ -61,7 +67,7 @@ jobs: run: | cmake -B ../build -G "Ninja" -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_BUILD_TYPE=Debug - env: + env: CXX: ${{matrix.cxx}} CXXFLAGS: ${{format('-stdlib={0}', matrix.lib)}} diff --git a/CMakeLists.txt b/CMakeLists.txt index 9241cf115f..c87a64fdf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ target_sources( INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${_asio_implementation} ) target_compile_features(asio_header INTERFACE cxx_std_${CMAKE_CXX_STANDARD}) +target_compile_definitions(asio_header INTERFACE ASIO_DISABLE_BOOST_CONTEXT_FIBER ASIO_STANDALONE ASIO_NO_DEPRECATED) #============================== # asio module library diff --git a/GNUmakefile b/GNUmakefile index df858b3d51..10c0aa2a8b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -32,9 +32,10 @@ ifeq (${hostSystemName},Darwin) # export CXX:=g++-15 # export GCOV:="gcov" else ifeq (${hostSystemName},Linux) - export LLVM_DIR:=/usr/lib/llvm-22 - export PATH:=${LLVM_DIR}/bin:${PATH} - export CXX:=clang++-22 + # TODO(CK): commented out for CI! + # export LLVM_DIR:=/usr/lib/llvm-22 + # export PATH:=${LLVM_DIR}/bin:${PATH} + # export CXX:=clang++22 CMAKE=cmake endif diff --git a/module/asio-gmf.h b/module/asio-gmf.h index f339d439f8..8511562e37 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -1,5 +1,7 @@ #pragma once -#define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported +#ifndef ASIO_STANDALONE +# define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported +#endif #if defined(_WIN32) and __has_include() # include @@ -20,7 +22,9 @@ #if __has_include() # include #else -# define ASIO_NO_DEPRECATED +# ifndef ASIO_NO_DEPRECATED +# define ASIO_NO_DEPRECATED +# endif # undef ASIO_DEPRECATED_MSG # define ASIO_DISABLE_DEPRECATED_MSG #endif From 5c3778db426ec141b82d098615a431de56c9f735 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 1 Mar 2026 23:36:57 +0100 Subject: [PATCH 30/57] Add example too --- CMakeLists.txt | 3 +++ src/examples/CMakeLists.txt | 6 ++++++ src/examples/cpp20/invocation/completion_executor.cpp | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 src/examples/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index c87a64fdf5..7e4ef4d5e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,6 +166,9 @@ if(MINGW) target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) endif() +enable_testing() +add_subdirectory(src/examples) + # # Install the libraries and its FILE_SET's. # diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt new file mode 100644 index 0000000000..711ed28c04 --- /dev/null +++ b/src/examples/CMakeLists.txt @@ -0,0 +1,6 @@ +add_executable( + example.completion_executor + cpp20/invocation/completion_executor.cpp +) +target_link_libraries(example.completion_executor PRIVATE asio::asio) +add_test(NAME example.completion_executor COMMAND example.completion_executor) diff --git a/src/examples/cpp20/invocation/completion_executor.cpp b/src/examples/cpp20/invocation/completion_executor.cpp index 54ba2b5fee..203f59e45e 100644 --- a/src/examples/cpp20/invocation/completion_executor.cpp +++ b/src/examples/cpp20/invocation/completion_executor.cpp @@ -8,9 +8,14 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // +#ifdef ASIO_HAS_IMPORT_STD +import std; +import asio; +#else #include "asio.hpp" #include #include +#endif using asio::ip::tcp; From 579d43b6456f65770c7a33020006ebf4ca5ac374 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Sun, 1 Mar 2026 23:55:18 +0100 Subject: [PATCH 31/57] Install libssl-dev on CI too --- .github/workflows/clang.yml | 4 ++++ .github/workflows/gcc.yml | 4 ++++ src/examples/cpp20/invocation/completion_executor.cpp | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 8e7c3b609a..8179a6958f 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -31,6 +31,9 @@ jobs: - uses: actions/setup-python@v5 with: { python-version: "3.13" } + - name: Install libssl-dev + run: apt-get update -qq && apt-get install -y -qq libssl-dev + - name: Setup Cpp uses: aminya/setup-cpp@v1 with: @@ -47,3 +50,4 @@ jobs: run: | # export PATH=$HOME/.local/bin:$PATH make all + make test diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index e9331b0f87..37bfee1fdb 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -31,6 +31,9 @@ jobs: - uses: actions/setup-python@v5 with: { python-version: "3.13" } + - name: Install libssl-dev + run: apt-get update -qq && apt-get install -y -qq libssl-dev + - name: Setup Cpp uses: aminya/setup-cpp@v1 with: @@ -46,3 +49,4 @@ jobs: run: | # export PATH=$HOME/.local/bin:$PATH make all + make test diff --git a/src/examples/cpp20/invocation/completion_executor.cpp b/src/examples/cpp20/invocation/completion_executor.cpp index 203f59e45e..85a1baa42b 100644 --- a/src/examples/cpp20/invocation/completion_executor.cpp +++ b/src/examples/cpp20/invocation/completion_executor.cpp @@ -12,9 +12,9 @@ import std; import asio; #else -#include "asio.hpp" -#include -#include +# include "asio.hpp" +# include +# include #endif using asio::ip::tcp; From 402bebecb52fe52be95444add3ffc128844b65bc Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 2 Mar 2026 14:23:54 +0100 Subject: [PATCH 32/57] Add short introduction and example module too --- GNUmakefile | 2 +- src/examples/CMakeLists.txt | 12 ++ src/examples/Impl.cpp | 11 ++ src/examples/M.cppm | 11 ++ src/examples/Transitioning-to-modules.md | 224 +++++++++++++++++++++++ src/examples/User.cpp | 8 + src/examples/cpp11/allocation/server.cpp | 2 +- src/examples/impl_part.cppm | 15 ++ src/examples/interface_part.cppm | 5 + 9 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 src/examples/Impl.cpp create mode 100644 src/examples/M.cppm create mode 100644 src/examples/Transitioning-to-modules.md create mode 100644 src/examples/User.cpp create mode 100644 src/examples/impl_part.cppm create mode 100644 src/examples/interface_part.cppm diff --git a/GNUmakefile b/GNUmakefile index 10c0aa2a8b..435fae5d57 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -28,7 +28,7 @@ ifeq (${hostSystemName},Darwin) # # XXX NOT need! export CMAKE_CXX_STDLIB_MODULES_JSON:=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json # # XXX NOT need! export CXXFLAGS:=-stdlib=libstdc++ - # export LDFLAGS:=-L$(GCC_DIR)/libgcc/current # XXX -lstdc++ + # export LDFLAGS:=-L$(GCC_DIR)/lib/gcc/current # XXX -lstdc++ # export CXX:=g++-15 # export GCOV:="gcov" else ifeq (${hostSystemName},Linux) diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 711ed28c04..f282e053bc 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -4,3 +4,15 @@ add_executable( ) target_link_libraries(example.completion_executor PRIVATE asio::asio) add_test(NAME example.completion_executor COMMAND example.completion_executor) + +add_library(M STATIC) +target_sources( + M + PRIVATE Impl.cpp + PUBLIC FILE_SET CXX_MODULES FILES M.cppm interface_part.cppm impl_part.cppm +) +target_compile_features(M PUBLIC cxx_std_${CMAKE_CXX_STANDARD}) + +add_executable(example.User User.cpp) +target_link_libraries(example.User PRIVATE M) +add_test(NAME example.User COMMAND example.User) diff --git a/src/examples/Impl.cpp b/src/examples/Impl.cpp new file mode 100644 index 0000000000..9aea18075b --- /dev/null +++ b/src/examples/Impl.cpp @@ -0,0 +1,11 @@ +// Impl.cpp +// Module implementation unit +// Module implementation unit files should use .cpp as a file extension. + +module; +#include + +module M; +void Hello() { + std::cout << "Hello "; +} diff --git a/src/examples/M.cppm b/src/examples/M.cppm new file mode 100644 index 0000000000..b2e75e21a8 --- /dev/null +++ b/src/examples/M.cppm @@ -0,0 +1,11 @@ +// M.cppm +// Primary module interface unit +// importable module unit files should use .cppm (or .ccm, .cxxm, or .c++m) as a file extension. + +export module M; +export import :interface_part; + +// warning: importing an implementation partition unit in a module interface is not recommended. +// NOTE: not needed! import :impl_part; + +export void Hello(); diff --git a/src/examples/Transitioning-to-modules.md b/src/examples/Transitioning-to-modules.md new file mode 100644 index 0000000000..47bc46e98e --- /dev/null +++ b/src/examples/Transitioning-to-modules.md @@ -0,0 +1,224 @@ +# Transitioning to [StandardCPlusPlusModules](https://clang.llvm.org/docs/StandardCPlusPlusModules.html#transitioning-to-modules) + +## Transitioning to modules + +It is best for new code and libraries to use modules from the start if +possible. However, it may be a breaking change for existing code or +libraries to switch to modules. As a result, many existing libraries +need to provide both _headers_ and _module interfaces_ for a while to not +break existing users. + +This section provides some suggestions on how to ease the transition +process for existing libraries. + +**NOTE:** that this information is only intended as guidance, rather than as +requirements to use modules in Clang. It presumes the project is starting with +no module-based dependencies. + +### ABI non-breaking styles + +#### export-using style + +```cpp +module; +#include "header_1.h" +#include "header_2.h" +... +#include "header_n.h" +export module your_library; +export namespace your_namespace { + using decl_1; + using decl_2; + ... + using decl_n; +} +``` + +This example shows how to include all the headers containing +declarations which need to be exported, and uses **using declarations** in +an _export block_ to produce the _module interface_. + +#### export extern-C++ style + +```cpp +module; +#include "third_party/A/headers.h" +#include "third_party/B/headers.h" +... +#include "third_party/Z/headers.h" +export module your_library; +#define IN_MODULE_INTERFACE +extern "C++" { + #include "header_1.h" + #include "header_2.h" + ... + #include "header_n.h" +} +``` + +Headers (from `header_1.h` to `header_n.h`) need to define the macro: + +```c +#ifdef IN_MODULE_INTERFACE +#define EXPORT export +#else +#define EXPORT +#endif +``` + +It is also recommended to refactor headers to include third-party +headers conditionally: + +```c +#ifndef IN_MODULE_INTERFACE +#include "third_party/A/headers.h" +#endif + +#include "header_x.h" +... +``` + +This approach works because the declarations with _language linkage_ are +attached to the _global module_. Thus, the **ABI** of the modular form of the +library does not change. + +**NOTE:** that the _private module fragment_ can only be in the _primary module +interface unit_ and the _primary module interface unit_ containing the +_private module fragment_ should be the only _module unit_ of the +corresponding module. + +In this case, source files (.cpp files) must be converted to _module +implementation units_: + +```cpp +#ifndef IN_MODULE_INTERFACE +// List all the includes here. +#include "third_party/A/headers.h" +... +#include "header.h" +#endif + +module your_library; + +// Following off should be unchanged. +... +``` + +The _module implementation unit_ will import the _primary module_ +implicitly. + +**HINT:** Do not include any headers in the _module implementation units_ as it +avoids duplicated declarations between _translation units_. + +This is why **non-exported using declarations** should be added from +third-party libraries in the _primary module interface unit_. + +If the library is provided as `libyour_library.so`, a modular library +(e.g., `libyour_library_modules.so`) may also need to be provided for +**ABI** compatibility. + +### Importing modules + +When there are library dependencies providing modules, the module +dependencies should be imported in your module as well. Many existing +libraries will fall into this category once the `std` module is more +widely available. + +#### All library dependencies providing modules + +Headers need to be converted to include third-party headers +conditionally. Then, for the export-using style: + +```cpp +module; +import modules_from_third_party; +#define IN_MODULE_INTERFACE +#include "header_1.h" +#include "header_2.h" +... +#include "header_n.h" +export module your_library; +export namespace your_namespace { + using decl_1; + using decl_2; + ... + using decl_n; +} +``` + +or, for the export **extern-C++ style**: + +```cpp +export module your_library; +import modules_from_third_party; +#define IN_MODULE_INTERFACE +extern "C++" { + #include "header_1.h" + #include "header_2.h" + ... + #include "header_n.h" +} +``` + +or, for the **ABI-breaking style**, + +```cpp +export module your_library; +import modules_from_third_party; +#define IN_MODULE_INTERFACE +#include "header_1.h" +#include "header_2.h" +... +#include "header_n.h" + +#if the number of .cpp files in your project are small +module :private; +#include "source_1.cpp" +#include "source_2.cpp" +... +#include "source_n.cpp" +#endif +``` + +**Non-exported** `using` declarations are unnecessary if using +_implementation module units_. Instead, third-party modules can be +imported directly in _implementation module units_. + +#### Partial library dependencies providing modules + +If the library has to mix the use of `include` and `import` in its +module, the primary goal is still the removal of duplicated declarations +in _translation units_ as much as possible. + +**HINT:** If the imported modules provide headers to skip parsing their headers, +those should be included after the import: + +```cpp +// a.cpp +import B; +int main() +{ + g(); +} + +// b.cppm +export module B; +import :C; +export template inline void g() noexcept +{ + return f(); +} + +// c.cppm +module B:C; +template inline void f() noexcept {} +``` + +The _internal partition unit_ `c.cppm` is not necessarily reachable by +`a.cpp` because `c.cppm` is not a _module interface unit_ and `a.cpp` +doesn't import `c.cppm`. This leaves it up to the compiler to decide if +`c.cppm` is reachable by `a.cpp` or not. Clang's behavior is that +indirectly imported _internal partition units_ are not reachable. + +The suggested approach for using an _internal partition unit_ in Clang is +to only import them in the _implementation unit_. diff --git a/src/examples/User.cpp b/src/examples/User.cpp new file mode 100644 index 0000000000..78cfb53744 --- /dev/null +++ b/src/examples/User.cpp @@ -0,0 +1,8 @@ +// User.cpp +import M; + +int main() { + Hello(); + World(); + return 0; +} diff --git a/src/examples/cpp11/allocation/server.cpp b/src/examples/cpp11/allocation/server.cpp index 449e350170..78adc495d7 100644 --- a/src/examples/cpp11/allocation/server.cpp +++ b/src/examples/cpp11/allocation/server.cpp @@ -46,7 +46,7 @@ class context_memory { // Since this program is single-threaded there is no need to perform any // synchronisation when modifying next_allocation_. Use an atomic or other - // form of synchronisation when using an exeution context from multiple + // form of synchronisation when using an execution context from multiple // threads. std::size_t space = size + align; if (next_allocation_ + space < preallocated_) diff --git a/src/examples/impl_part.cppm b/src/examples/impl_part.cppm new file mode 100644 index 0000000000..8d0e283830 --- /dev/null +++ b/src/examples/impl_part.cppm @@ -0,0 +1,15 @@ +// impl_part.cppm +// Internal module partition unit + +module; + +#include +#include + +module M:impl_part; +import :interface_part; + +constexpr std::string_view W{"World."}; +void World() { + std::cout << W << '\n'; +} diff --git a/src/examples/interface_part.cppm b/src/examples/interface_part.cppm new file mode 100644 index 0000000000..5560f7d1f9 --- /dev/null +++ b/src/examples/interface_part.cppm @@ -0,0 +1,5 @@ +// interface_part.cppm +// Module partition interface unit + +export module M:interface_part; +export void World(); From af31753521ce7654ac42a18499c72852bc7e8186 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 2 Mar 2026 16:04:53 +0100 Subject: [PATCH 33/57] Quickfix for MSVC? --- module/asio.ixx | 2 ++ src/examples/M.cppm | 5 ++--- src/examples/impl_part.cppm | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/module/asio.ixx b/module/asio.ixx index 62350ecb9b..10a8dd1542 100644 --- a/module/asio.ixx +++ b/module/asio.ixx @@ -58,7 +58,9 @@ export { #endif // FIXME: g++-15 error: sorry, unimplemented: private module fragment +#ifndef __GNUC__ module :private; +#endif #include "asio/impl/src.hpp" #if defined(ASIO_USE_SSL) diff --git a/src/examples/M.cppm b/src/examples/M.cppm index b2e75e21a8..20195cf8ab 100644 --- a/src/examples/M.cppm +++ b/src/examples/M.cppm @@ -5,7 +5,6 @@ export module M; export import :interface_part; -// warning: importing an implementation partition unit in a module interface is not recommended. -// NOTE: not needed! import :impl_part; - +// clang warning: importing an implementation partition unit in a module interface is not recommended. +// FIXME: is not needed for clang and gcc and does not work wit MSVC! import :impl_part; export void Hello(); diff --git a/src/examples/impl_part.cppm b/src/examples/impl_part.cppm index 8d0e283830..93c9f3fde8 100644 --- a/src/examples/impl_part.cppm +++ b/src/examples/impl_part.cppm @@ -1,5 +1,6 @@ // impl_part.cppm // Internal module partition unit +// is this a module partition implementations? CK module; @@ -10,6 +11,7 @@ module M:impl_part; import :interface_part; constexpr std::string_view W{"World."}; +// MSVC error C7619: cannot export 'World' as module partition 'impl_part' does not contribute to the exported interface of module unit 'M' void World() { std::cout << W << '\n'; } From 3ee88ed57441d421fa76b36201288fed9dbc5163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Mon, 2 Mar 2026 19:51:30 +0300 Subject: [PATCH 34/57] fix module example --- src/examples/CMakeLists.txt | 4 ++-- src/examples/{impl_part.cppm => impl_part.cpp} | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) rename src/examples/{impl_part.cppm => impl_part.cpp} (89%) diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index f282e053bc..ff0be12e71 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -8,8 +8,8 @@ add_test(NAME example.completion_executor COMMAND example.completion_executor) add_library(M STATIC) target_sources( M - PRIVATE Impl.cpp - PUBLIC FILE_SET CXX_MODULES FILES M.cppm interface_part.cppm impl_part.cppm + PRIVATE Impl.cpp impl_part.cpp + PUBLIC FILE_SET CXX_MODULES FILES M.cppm interface_part.cppm ) target_compile_features(M PUBLIC cxx_std_${CMAKE_CXX_STANDARD}) diff --git a/src/examples/impl_part.cppm b/src/examples/impl_part.cpp similarity index 89% rename from src/examples/impl_part.cppm rename to src/examples/impl_part.cpp index 93c9f3fde8..395e2f8a3d 100644 --- a/src/examples/impl_part.cppm +++ b/src/examples/impl_part.cpp @@ -7,8 +7,7 @@ module; #include #include -module M:impl_part; -import :interface_part; +module M; constexpr std::string_view W{"World."}; // MSVC error C7619: cannot export 'World' as module partition 'impl_part' does not contribute to the exported interface of module unit 'M' From f859d345095967cee1cce0a0e25782f8be68d5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Mon, 2 Mar 2026 22:31:13 +0300 Subject: [PATCH 35/57] fix gcc bug: false error regarding redeclaration of friend functions with c linkage specification --- include/asio/detail/impl/posix_thread.ipp | 7 ++++++- include/asio/detail/posix_thread.hpp | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/asio/detail/impl/posix_thread.ipp b/include/asio/detail/impl/posix_thread.ipp index 15a4b96992..0480b9e9a0 100644 --- a/include/asio/detail/impl/posix_thread.ipp +++ b/include/asio/detail/impl/posix_thread.ipp @@ -69,9 +69,14 @@ posix_thread::func_base* posix_thread::start_thread(func_base* arg) return arg; } -extern "C" void* asio_detail_posix_thread_function(void* arg) +void asio_detail_posix_thread_function_wrapper(void* arg) { static_cast(arg)->run(); +} + +extern "C" void* asio_detail_posix_thread_function(void* arg) +{ + asio_detail_posix_thread_function_wrapper(arg); return 0; } diff --git a/include/asio/detail/posix_thread.hpp b/include/asio/detail/posix_thread.hpp index c29e25aa74..4161d75c92 100644 --- a/include/asio/detail/posix_thread.hpp +++ b/include/asio/detail/posix_thread.hpp @@ -88,7 +88,7 @@ class posix_thread ASIO_DECL static std::size_t hardware_concurrency(); private: - friend void* asio_detail_posix_thread_function(void* arg); + friend void asio_detail_posix_thread_function_wrapper(void* arg); class func_base { @@ -98,7 +98,6 @@ class posix_thread virtual void destroy() = 0; ::pthread_t thread_; }; - template class func : public func_base From 7be955b946730ca8ba2ad2868e36503288fabea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Mon, 2 Mar 2026 22:50:07 +0300 Subject: [PATCH 36/57] fix import std: enable CXX_MODULE_STD cmake property for example targets --- src/examples/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index ff0be12e71..fa6b905843 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -3,6 +3,9 @@ add_executable( cpp20/invocation/completion_executor.cpp ) target_link_libraries(example.completion_executor PRIVATE asio::asio) +if (ASIO_HAS_IMPORT_STD) + set_property(TARGET example.completion_executor PROPERTY CXX_MODULE_STD ON) +endif() add_test(NAME example.completion_executor COMMAND example.completion_executor) add_library(M STATIC) From 03d5d48b5ac2034495753b8e878db7daf05b933a Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 2 Mar 2026 23:03:39 +0100 Subject: [PATCH 37/57] Be verbose and print path to stdlibc++.module.json file --- GNUmakefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 435fae5d57..3e9cbd37aa 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,6 +6,7 @@ MAKEFLAGS+= --no-builtin-rules # Disable the built-in implicit rules. MAKEFLAGS+= --warn-undefined-variables # Warn when an undefined variable is referenced. export hostSystemName=$(shell uname) +export CTEST_OUTPUT_ON_FAILURE=1 ifeq (${hostSystemName},Darwin) export LLVM_PREFIX:=$(shell brew --prefix llvm) @@ -14,8 +15,9 @@ ifeq (${hostSystemName},Darwin) #XXX CMAKE=${HOME}/.local/bin/cmake # cmake v4.4-rc1 CMAKE?=/usr/local/bin/cmake - export CMAKE_CXX_STDLIB_MODULES_JSON:=${LLVM_DIR}/lib/c++/libc++.modules.json - export CXXFLAGS:=-stdlib=libc++ + STDLIB=libc++ + export CMAKE_CXX_STDLIB_MODULES_JSON:=${LLVM_DIR}/lib/c++/$(STDLIB).modules.json + export CXXFLAGS:=-stdlib=$(STDLIB) export LDFLAGS:=-L$(LLVM_DIR)/lib/c++ -lc++abi # XXX -lc++ export CXX:=clang++ export GCOV:="llvm-cov gcov" @@ -26,8 +28,9 @@ ifeq (${hostSystemName},Darwin) export GCC_PREFIX:=$(shell brew --prefix gcc) export GCC_DIR:=$(shell realpath ${GCC_PREFIX}) - # # XXX NOT need! export CMAKE_CXX_STDLIB_MODULES_JSON:=${GCC_DIR}/lib/gcc/current/libstdc++.modules.json - # # XXX NOT need! export CXXFLAGS:=-stdlib=libstdc++ + # STDLIB=libstdc++ + # # XXX NOT need! export CMAKE_CXX_STDLIB_MODULES_JSON:=${GCC_DIR}/lib/gcc/current/$(STDLIB).modules.json + # # XXX NOT need! export CXXFLAGS:=-stdlib=$(STDLIB) # export LDFLAGS:=-L$(GCC_DIR)/lib/gcc/current # XXX -lstdc++ # export CXX:=g++-15 # export GCOV:="gcov" @@ -48,7 +51,8 @@ all: build build: GNUmakefile CMakeLists.txt ${CMAKE} --version - CXX=$(CXX) ${CMAKE} -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=26 -D CMAKE_BUILD_TYPE=Release \ + ${CXX} -print-file-name=$(STDLIB).modules.json + CXX=${CXX} ${CMAKE} -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=26 -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ -D ASIO_IMPORT_STD=ON --fresh -Wdev ln -fs build/compile_commands.json . From 93a75e6fd43ea365f7d58a40440a2acf7e00b341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Tue, 3 Mar 2026 01:08:12 +0300 Subject: [PATCH 38/57] fix gcc16 ci: set CMAKE_BUILD_RPATH for non-system libstdc++ --- CMakeLists.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e4ef4d5e0..6dde8331f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,26 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_INSTALL_MESSAGE LAZY) set(CMAKE_SKIP_TEST_ALL_DEPENDENCY OFF) +# --------------------------------------------------------------------------- +# Ensure binaries find the correct libstdc++ at runtime when using a +# non-system GCC (e.g. /opt/gcc-16). Without this, CTest fails because the +# dynamic linker finds the system's older libstdc++ which lacks required +# GLIBCXX symbols. +# --------------------------------------------------------------------------- +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++.so + OUTPUT_VARIABLE _gcc_stdcxx_path + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(_gcc_stdcxx_path) + cmake_path(GET _gcc_stdcxx_path PARENT_PATH _gcc_lib_dir) + get_filename_component(_gcc_lib_dir "${_gcc_lib_dir}" REALPATH) + list(APPEND CMAKE_BUILD_RPATH "${_gcc_lib_dir}") + message(STATUS "GCC libstdc++ rpath: ${_gcc_lib_dir}") + endif() +endif() + message( STATUS "Cmake is: ${CMAKE_VERSION} modules scan: ${CMAKE_CXX_SCAN_FOR_MODULES}" From 8fbd8f59e9de9e81db2bc21bb15fe17f2126c6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Wed, 4 Mar 2026 15:15:51 +0300 Subject: [PATCH 39/57] move import std after asio module declaration --- module/asio.ixx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/asio.ixx b/module/asio.ixx index 10a8dd1542..9f656c5a08 100644 --- a/module/asio.ixx +++ b/module/asio.ixx @@ -9,12 +9,11 @@ module; # pragma warning(disable:4180) #endif +export module asio; #ifdef ASIO_HAS_IMPORT_STD import std; #endif -export module asio; - #ifdef _MSC_VER # pragma comment(lib, "asio.lib") #endif From b12e96c5dcc7bcb7ffc9e3308c6276c22ffb8e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Wed, 4 Mar 2026 21:59:52 +0300 Subject: [PATCH 40/57] add std compatibility layer for import std support introduce per-header wrappers (include/asio/detail/std/) and a cmake script (module/module_compat.cmake) to manage them atomically. core invariant: std headers are never reachable in module purview. - without import std: headers included in gmf only - with import std: only macro-providing headers in gmf (types come from import std; macros cannot) - purview: always blocked for std headers asio-gmf.h now owns the ASIO_IN_GMF define lifecycle. all asio includes rewritten via the cmake script. ran module_compat.cmake to generate headers and update existing header files to use generated wrapper headers for std includes. --- include/asio/any_completion_handler.hpp | 8 +- include/asio/append.hpp | 2 +- include/asio/associated_allocator.hpp | 2 +- include/asio/awaitable.hpp | 4 +- include/asio/basic_datagram_socket.hpp | 2 +- include/asio/basic_deadline_timer.hpp | 2 +- include/asio/basic_file.hpp | 4 +- include/asio/basic_random_access_file.hpp | 2 +- include/asio/basic_raw_socket.hpp | 2 +- include/asio/basic_readable_pipe.hpp | 4 +- include/asio/basic_seq_packet_socket.hpp | 2 +- include/asio/basic_serial_port.hpp | 4 +- include/asio/basic_socket.hpp | 2 +- include/asio/basic_socket_acceptor.hpp | 2 +- include/asio/basic_socket_iostream.hpp | 4 +- include/asio/basic_socket_streambuf.hpp | 4 +- include/asio/basic_stream_file.hpp | 2 +- include/asio/basic_stream_socket.hpp | 2 +- include/asio/basic_streambuf.hpp | 10 +- include/asio/basic_streambuf_fwd.hpp | 2 +- include/asio/basic_waitable_timer.hpp | 4 +- include/asio/basic_writable_pipe.hpp | 4 +- include/asio/buffer.hpp | 12 +- include/asio/buffer_registration.hpp | 6 +- include/asio/buffered_read_stream.hpp | 2 +- include/asio/buffered_stream.hpp | 2 +- include/asio/buffered_write_stream.hpp | 2 +- include/asio/buffers_iterator.hpp | 4 +- include/asio/cancellation_signal.hpp | 6 +- include/asio/cancellation_state.hpp | 6 +- include/asio/co_composed.hpp | 8 +- include/asio/completion_condition.hpp | 2 +- include/asio/config.hpp | 4 +- include/asio/consign.hpp | 2 +- include/asio/deferred.hpp | 2 +- include/asio/detached.hpp | 2 +- include/asio/detail/array.hpp | 2 +- include/asio/detail/array_fwd.hpp | 2 +- include/asio/detail/assert.hpp | 2 +- include/asio/detail/atomic_count.hpp | 2 +- .../asio/detail/buffered_stream_storage.hpp | 6 +- include/asio/detail/chrono.hpp | 2 +- include/asio/detail/completion_message.hpp | 2 +- include/asio/detail/completion_payload.hpp | 4 +- include/asio/detail/config.hpp | 6 +- include/asio/detail/consuming_buffers.hpp | 2 +- include/asio/detail/cstddef.hpp | 2 +- include/asio/detail/cstdint.hpp | 2 +- .../asio/detail/deadline_timer_service.hpp | 6 +- include/asio/detail/descriptor_ops.hpp | 2 +- include/asio/detail/dev_poll_reactor.hpp | 4 +- include/asio/detail/exception.hpp | 2 +- include/asio/detail/functional.hpp | 2 +- include/asio/detail/future.hpp | 2 +- include/asio/detail/hash_map.hpp | 4 +- include/asio/detail/impl/descriptor_ops.ipp | 2 +- include/asio/detail/impl/epoll_reactor.ipp | 2 +- include/asio/detail/impl/handler_tracking.ipp | 4 +- .../detail/impl/io_uring_file_service.ipp | 2 +- include/asio/detail/impl/io_uring_service.ipp | 2 +- include/asio/detail/impl/null_event.ipp | 2 +- .../detail/impl/posix_serial_port_service.ipp | 2 +- include/asio/detail/impl/posix_thread.ipp | 2 +- include/asio/detail/impl/service_registry.ipp | 2 +- .../asio/detail/impl/signal_set_service.ipp | 4 +- include/asio/detail/impl/socket_ops.ipp | 18 +- .../detail/impl/socket_select_interrupter.ipp | 2 +- .../detail/impl/win_iocp_file_service.ipp | 2 +- .../impl/win_iocp_serial_port_service.ipp | 2 +- include/asio/detail/impl/win_static_mutex.ipp | 2 +- .../impl/winrt_ssocket_service_base.ipp | 2 +- include/asio/detail/io_control.hpp | 2 +- include/asio/detail/io_object_impl.hpp | 2 +- include/asio/detail/io_uring_file_service.hpp | 2 +- include/asio/detail/is_buffer_sequence.hpp | 2 +- include/asio/detail/kqueue_reactor.hpp | 2 +- include/asio/detail/limits.hpp | 2 +- include/asio/detail/memory.hpp | 8 +- include/asio/detail/posix_event.hpp | 2 +- include/asio/detail/posix_fd_set_adapter.hpp | 2 +- include/asio/detail/posix_global.hpp | 2 +- .../asio/detail/posix_serial_port_service.hpp | 2 +- include/asio/detail/posix_signal_blocker.hpp | 2 +- include/asio/detail/posix_thread.hpp | 2 +- include/asio/detail/select_reactor.hpp | 2 +- include/asio/detail/service_registry.hpp | 2 +- include/asio/detail/signal_init.hpp | 2 +- include/asio/detail/signal_set_service.hpp | 2 +- include/asio/detail/socket_option.hpp | 4 +- include/asio/detail/source_location.hpp | 2 +- include/asio/detail/std/algorithm.hpp | 30 ++ include/asio/detail/std/all.hpp | 61 +++ include/asio/detail/std/any.hpp | 30 ++ include/asio/detail/std/array.hpp | 30 ++ include/asio/detail/std/atomic.hpp | 30 ++ include/asio/detail/std/cassert.hpp | 30 ++ include/asio/detail/std/cctype.hpp | 30 ++ include/asio/detail/std/cerrno.hpp | 30 ++ include/asio/detail/std/chrono.hpp | 30 ++ include/asio/detail/std/climits.hpp | 30 ++ include/asio/detail/std/codecvt.hpp | 30 ++ include/asio/detail/std/concepts.hpp | 30 ++ .../asio/detail/std/condition_variable.hpp | 30 ++ include/asio/detail/std/coroutine.hpp | 30 ++ include/asio/detail/std/csignal.hpp | 30 ++ include/asio/detail/std/cstdarg.hpp | 30 ++ include/asio/detail/std/cstddef.hpp | 30 ++ include/asio/detail/std/cstdint.hpp | 30 ++ include/asio/detail/std/cstdio.hpp | 30 ++ include/asio/detail/std/cstdlib.hpp | 30 ++ include/asio/detail/std/cstring.hpp | 30 ++ include/asio/detail/std/deque.hpp | 30 ++ include/asio/detail/std/exception.hpp | 30 ++ include/asio/detail/std/functional.hpp | 30 ++ include/asio/detail/std/future.hpp | 30 ++ include/asio/detail/std/iosfwd.hpp | 30 ++ include/asio/detail/std/istream.hpp | 30 ++ include/asio/detail/std/iterator.hpp | 30 ++ include/asio/detail/std/limits.hpp | 30 ++ include/asio/detail/std/list.hpp | 30 ++ include/asio/detail/std/locale.hpp | 30 ++ include/asio/detail/std/memory.hpp | 30 ++ include/asio/detail/std/mutex.hpp | 30 ++ include/asio/detail/std/new.hpp | 30 ++ include/asio/detail/std/optional.hpp | 30 ++ include/asio/detail/std/ostream.hpp | 30 ++ include/asio/detail/std/source_location.hpp | 30 ++ include/asio/detail/std/sstream.hpp | 30 ++ include/asio/detail/std/stdexcept.hpp | 30 ++ include/asio/detail/std/streambuf.hpp | 30 ++ include/asio/detail/std/string.hpp | 30 ++ include/asio/detail/std/string_view.hpp | 30 ++ include/asio/detail/std/system_error.hpp | 30 ++ include/asio/detail/std/thread.hpp | 30 ++ include/asio/detail/std/tuple.hpp | 30 ++ include/asio/detail/std/type_traits.hpp | 30 ++ include/asio/detail/std/typeinfo.hpp | 30 ++ include/asio/detail/std/utility.hpp | 30 ++ include/asio/detail/std/variant.hpp | 30 ++ include/asio/detail/std/vector.hpp | 30 ++ include/asio/detail/std/version.hpp | 30 ++ include/asio/detail/std_event.hpp | 4 +- include/asio/detail/std_fenced_block.hpp | 2 +- include/asio/detail/std_global.hpp | 4 +- include/asio/detail/std_mutex.hpp | 2 +- include/asio/detail/std_static_mutex.hpp | 2 +- include/asio/detail/std_thread.hpp | 2 +- include/asio/detail/string_view.hpp | 2 +- include/asio/detail/thread_context.hpp | 4 +- include/asio/detail/thread_info_base.hpp | 6 +- include/asio/detail/timer_queue.hpp | 4 +- include/asio/detail/type_traits.hpp | 2 +- include/asio/detail/utility.hpp | 2 +- include/asio/detail/win_event.hpp | 2 +- include/asio/detail/win_iocp_file_service.hpp | 2 +- .../detail/win_iocp_serial_port_service.hpp | 2 +- .../asio/detail/win_iocp_socket_service.hpp | 2 +- include/asio/detail/win_thread.hpp | 2 +- include/asio/detail/winrt_async_manager.hpp | 2 +- include/asio/detail/winrt_timer_scheduler.hpp | 2 +- include/asio/detail/winrt_utils.hpp | 8 +- include/asio/disposition.hpp | 2 +- include/asio/error.hpp | 2 +- include/asio/error_code.hpp | 2 +- include/asio/execution/any_executor.hpp | 4 +- include/asio/execution/bad_executor.hpp | 2 +- include/asio/execution/context.hpp | 2 +- include/asio/execution_context.hpp | 6 +- include/asio/executor.hpp | 4 +- .../asio/experimental/awaitable_operators.hpp | 8 +- include/asio/experimental/channel_traits.hpp | 4 +- include/asio/experimental/co_spawn.hpp | 2 +- include/asio/experimental/coro_traits.hpp | 4 +- .../detail/coro_promise_allocator.hpp | 2 +- .../experimental/detail/partial_promise.hpp | 2 +- include/asio/experimental/impl/as_single.hpp | 2 +- .../asio/experimental/impl/parallel_group.hpp | 10 +- include/asio/experimental/impl/promise.hpp | 2 +- .../asio/experimental/impl/use_promise.hpp | 2 +- include/asio/experimental/parallel_group.hpp | 2 +- include/asio/experimental/promise.hpp | 2 +- include/asio/experimental/use_coro.hpp | 2 +- include/asio/experimental/use_promise.hpp | 2 +- include/asio/generic/datagram_protocol.hpp | 2 +- include/asio/generic/detail/endpoint.hpp | 2 +- include/asio/generic/detail/impl/endpoint.ipp | 4 +- include/asio/generic/raw_protocol.hpp | 2 +- include/asio/generic/seq_packet_protocol.hpp | 2 +- include/asio/generic/stream_protocol.hpp | 2 +- include/asio/impl/as_tuple.hpp | 2 +- include/asio/impl/awaitable.hpp | 6 +- include/asio/impl/config.hpp | 8 +- include/asio/impl/config.ipp | 12 +- include/asio/impl/connect.hpp | 2 +- include/asio/impl/connect_pipe.ipp | 2 +- include/asio/impl/error.ipp | 2 +- include/asio/impl/error_code.ipp | 6 +- include/asio/impl/execution_context.hpp | 2 +- include/asio/impl/executor.hpp | 2 +- include/asio/impl/read.hpp | 2 +- include/asio/impl/read_at.hpp | 2 +- include/asio/impl/read_until.hpp | 8 +- include/asio/impl/serial_port_base.ipp | 2 +- include/asio/impl/spawn.hpp | 2 +- include/asio/impl/thread_pool.ipp | 2 +- include/asio/impl/use_future.hpp | 2 +- include/asio/inline_or_executor.hpp | 2 +- include/asio/io_context.hpp | 6 +- include/asio/ip/address.hpp | 6 +- include/asio/ip/address_v4.hpp | 6 +- include/asio/ip/address_v6.hpp | 6 +- include/asio/ip/bad_address_cast.hpp | 2 +- include/asio/ip/basic_endpoint.hpp | 4 +- include/asio/ip/basic_resolver.hpp | 4 +- include/asio/ip/basic_resolver_entry.hpp | 2 +- include/asio/ip/basic_resolver_iterator.hpp | 10 +- include/asio/ip/basic_resolver_query.hpp | 2 +- include/asio/ip/basic_resolver_results.hpp | 4 +- include/asio/ip/detail/endpoint.hpp | 2 +- include/asio/ip/detail/impl/endpoint.ipp | 4 +- include/asio/ip/detail/socket_option.hpp | 6 +- include/asio/ip/host_name.hpp | 2 +- include/asio/ip/impl/address.ipp | 2 +- include/asio/ip/impl/address_v4.ipp | 6 +- include/asio/ip/impl/address_v6.ipp | 6 +- include/asio/ip/impl/network_v4.ipp | 8 +- include/asio/ip/impl/network_v6.ipp | 8 +- include/asio/ip/multicast.hpp | 2 +- include/asio/ip/network_v4.hpp | 2 +- include/asio/ip/network_v6.hpp | 2 +- include/asio/ip/unicast.hpp | 2 +- include/asio/is_contiguous_iterator.hpp | 2 +- include/asio/local/basic_endpoint.hpp | 2 +- include/asio/local/detail/endpoint.hpp | 4 +- include/asio/local/detail/impl/endpoint.ipp | 2 +- include/asio/multiple_exceptions.hpp | 2 +- include/asio/posix/basic_descriptor.hpp | 2 +- include/asio/prepend.hpp | 2 +- include/asio/read.hpp | 2 +- include/asio/read_at.hpp | 2 +- include/asio/read_until.hpp | 4 +- include/asio/ssl/context.hpp | 2 +- include/asio/ssl/detail/impl/openssl_init.ipp | 2 +- include/asio/ssl/detail/openssl_init.hpp | 2 +- include/asio/ssl/detail/password_callback.hpp | 4 +- include/asio/ssl/host_name_verification.hpp | 2 +- include/asio/ssl/impl/context.ipp | 2 +- .../asio/ssl/impl/host_name_verification.ipp | 4 +- include/asio/system_error.hpp | 2 +- include/asio/use_future.hpp | 2 +- include/asio/windows/basic_object_handle.hpp | 2 +- .../asio/windows/basic_overlapped_handle.hpp | 4 +- include/asio/write.hpp | 2 +- include/asio/write_at.hpp | 2 +- module/asio-gmf.h | 60 +-- module/asio.ixx | 4 +- module/generate_std_compat.cmake | 394 ++++++++++++++++++ module/module_compat.cmake | 338 +++++++++++++++ 258 files changed, 2629 insertions(+), 384 deletions(-) create mode 100644 include/asio/detail/std/algorithm.hpp create mode 100644 include/asio/detail/std/all.hpp create mode 100644 include/asio/detail/std/any.hpp create mode 100644 include/asio/detail/std/array.hpp create mode 100644 include/asio/detail/std/atomic.hpp create mode 100644 include/asio/detail/std/cassert.hpp create mode 100644 include/asio/detail/std/cctype.hpp create mode 100644 include/asio/detail/std/cerrno.hpp create mode 100644 include/asio/detail/std/chrono.hpp create mode 100644 include/asio/detail/std/climits.hpp create mode 100644 include/asio/detail/std/codecvt.hpp create mode 100644 include/asio/detail/std/concepts.hpp create mode 100644 include/asio/detail/std/condition_variable.hpp create mode 100644 include/asio/detail/std/coroutine.hpp create mode 100644 include/asio/detail/std/csignal.hpp create mode 100644 include/asio/detail/std/cstdarg.hpp create mode 100644 include/asio/detail/std/cstddef.hpp create mode 100644 include/asio/detail/std/cstdint.hpp create mode 100644 include/asio/detail/std/cstdio.hpp create mode 100644 include/asio/detail/std/cstdlib.hpp create mode 100644 include/asio/detail/std/cstring.hpp create mode 100644 include/asio/detail/std/deque.hpp create mode 100644 include/asio/detail/std/exception.hpp create mode 100644 include/asio/detail/std/functional.hpp create mode 100644 include/asio/detail/std/future.hpp create mode 100644 include/asio/detail/std/iosfwd.hpp create mode 100644 include/asio/detail/std/istream.hpp create mode 100644 include/asio/detail/std/iterator.hpp create mode 100644 include/asio/detail/std/limits.hpp create mode 100644 include/asio/detail/std/list.hpp create mode 100644 include/asio/detail/std/locale.hpp create mode 100644 include/asio/detail/std/memory.hpp create mode 100644 include/asio/detail/std/mutex.hpp create mode 100644 include/asio/detail/std/new.hpp create mode 100644 include/asio/detail/std/optional.hpp create mode 100644 include/asio/detail/std/ostream.hpp create mode 100644 include/asio/detail/std/source_location.hpp create mode 100644 include/asio/detail/std/sstream.hpp create mode 100644 include/asio/detail/std/stdexcept.hpp create mode 100644 include/asio/detail/std/streambuf.hpp create mode 100644 include/asio/detail/std/string.hpp create mode 100644 include/asio/detail/std/string_view.hpp create mode 100644 include/asio/detail/std/system_error.hpp create mode 100644 include/asio/detail/std/thread.hpp create mode 100644 include/asio/detail/std/tuple.hpp create mode 100644 include/asio/detail/std/type_traits.hpp create mode 100644 include/asio/detail/std/typeinfo.hpp create mode 100644 include/asio/detail/std/utility.hpp create mode 100644 include/asio/detail/std/variant.hpp create mode 100644 include/asio/detail/std/vector.hpp create mode 100644 include/asio/detail/std/version.hpp create mode 100644 module/generate_std_compat.cmake create mode 100644 module/module_compat.cmake diff --git a/include/asio/any_completion_handler.hpp b/include/asio/any_completion_handler.hpp index 1114a09c61..4ccd8f5eef 100644 --- a/include/asio/any_completion_handler.hpp +++ b/include/asio/any_completion_handler.hpp @@ -12,10 +12,10 @@ #define ASIO_ANY_COMPLETION_HANDLER_HPP #include "asio/detail/config.hpp" -#include -#include -#include -#include +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/functional.hpp" +#include "asio/detail/std/memory.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_completion_executor.hpp" #include "asio/any_io_executor.hpp" #include "asio/associated_allocator.hpp" diff --git a/include/asio/append.hpp b/include/asio/append.hpp index e0167e13b5..63e97be730 100644 --- a/include/asio/append.hpp +++ b/include/asio/append.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/associated_allocator.hpp b/include/asio/associated_allocator.hpp index c15ff6dc5b..d461a3d39b 100644 --- a/include/asio/associated_allocator.hpp +++ b/include/asio/associated_allocator.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/memory.hpp" #include "asio/associator.hpp" #include "asio/detail/functional.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/awaitable.hpp b/include/asio/awaitable.hpp index 9bc5a5960b..92f501d7f8 100644 --- a/include/asio/awaitable.hpp +++ b/include/asio/awaitable.hpp @@ -20,12 +20,12 @@ #if defined(ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) #if defined(ASIO_HAS_STD_COROUTINE) -# include +# include "asio/detail/std/coroutine.hpp" #else // defined(ASIO_HAS_STD_COROUTINE) # include #endif // defined(ASIO_HAS_STD_COROUTINE) -#include +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/basic_datagram_socket.hpp b/include/asio/basic_datagram_socket.hpp index b0764aa9d2..c6e975e333 100644 --- a/include/asio/basic_datagram_socket.hpp +++ b/include/asio/basic_datagram_socket.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/basic_socket.hpp" #include "asio/detail/handler_type_requirements.hpp" #include "asio/detail/non_const_lvalue.hpp" diff --git a/include/asio/basic_deadline_timer.hpp b/include/asio/basic_deadline_timer.hpp index db289be94d..daf55360e7 100644 --- a/include/asio/basic_deadline_timer.hpp +++ b/include/asio/basic_deadline_timer.hpp @@ -22,7 +22,7 @@ #if defined(ASIO_HAS_BOOST_DATE_TIME) \ || defined(GENERATING_DOCUMENTATION) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/any_io_executor.hpp" #include "asio/detail/deadline_timer_service.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/basic_file.hpp b/include/asio/basic_file.hpp index c29b11f6b2..5c2bcc38ca 100644 --- a/include/asio/basic_file.hpp +++ b/include/asio/basic_file.hpp @@ -20,8 +20,8 @@ #if defined(ASIO_HAS_FILE) \ || defined(GENERATING_DOCUMENTATION) -#include -#include +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/cstdint.hpp" diff --git a/include/asio/basic_random_access_file.hpp b/include/asio/basic_random_access_file.hpp index e990704615..cfbbd195eb 100644 --- a/include/asio/basic_random_access_file.hpp +++ b/include/asio/basic_random_access_file.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_FILE) \ || defined(GENERATING_DOCUMENTATION) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/basic_file.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/basic_raw_socket.hpp b/include/asio/basic_raw_socket.hpp index 6e6d8b9724..895039453b 100644 --- a/include/asio/basic_raw_socket.hpp +++ b/include/asio/basic_raw_socket.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/basic_socket.hpp" #include "asio/detail/handler_type_requirements.hpp" #include "asio/detail/non_const_lvalue.hpp" diff --git a/include/asio/basic_readable_pipe.hpp b/include/asio/basic_readable_pipe.hpp index 70bfbad538..d6257bd743 100644 --- a/include/asio/basic_readable_pipe.hpp +++ b/include/asio/basic_readable_pipe.hpp @@ -20,8 +20,8 @@ #if defined(ASIO_HAS_PIPE) \ || defined(GENERATING_DOCUMENTATION) -#include -#include +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/basic_seq_packet_socket.hpp b/include/asio/basic_seq_packet_socket.hpp index 29766fe84d..4cf45805a9 100644 --- a/include/asio/basic_seq_packet_socket.hpp +++ b/include/asio/basic_seq_packet_socket.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/basic_socket.hpp" #include "asio/detail/handler_type_requirements.hpp" #include "asio/detail/throw_error.hpp" diff --git a/include/asio/basic_serial_port.hpp b/include/asio/basic_serial_port.hpp index 22f0c536d6..aa1f2f2eb6 100644 --- a/include/asio/basic_serial_port.hpp +++ b/include/asio/basic_serial_port.hpp @@ -21,8 +21,8 @@ #if defined(ASIO_HAS_SERIAL_PORT) \ || defined(GENERATING_DOCUMENTATION) -#include -#include +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/basic_socket.hpp b/include/asio/basic_socket.hpp index 1ff7ecf25d..b1690be97f 100644 --- a/include/asio/basic_socket.hpp +++ b/include/asio/basic_socket.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/detail/config.hpp" #include "asio/async_result.hpp" diff --git a/include/asio/basic_socket_acceptor.hpp b/include/asio/basic_socket_acceptor.hpp index 04eb3bab53..bb7bcab49b 100644 --- a/include/asio/basic_socket_acceptor.hpp +++ b/include/asio/basic_socket_acceptor.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include +#include "asio/detail/std/utility.hpp" #include "asio/detail/config.hpp" #include "asio/any_io_executor.hpp" #include "asio/basic_socket.hpp" diff --git a/include/asio/basic_socket_iostream.hpp b/include/asio/basic_socket_iostream.hpp index dd0f111b5a..ee51ecaa43 100644 --- a/include/asio/basic_socket_iostream.hpp +++ b/include/asio/basic_socket_iostream.hpp @@ -19,8 +19,8 @@ #if !defined(ASIO_NO_IOSTREAM) -#include -#include +#include "asio/detail/std/istream.hpp" +#include "asio/detail/std/ostream.hpp" #include "asio/basic_socket_streambuf.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/basic_socket_streambuf.hpp b/include/asio/basic_socket_streambuf.hpp index 28cf8f2b27..95783f0301 100644 --- a/include/asio/basic_socket_streambuf.hpp +++ b/include/asio/basic_socket_streambuf.hpp @@ -19,8 +19,8 @@ #if !defined(ASIO_NO_IOSTREAM) -#include -#include +#include "asio/detail/std/streambuf.hpp" +#include "asio/detail/std/vector.hpp" #include "asio/basic_socket.hpp" #include "asio/basic_stream_socket.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" diff --git a/include/asio/basic_stream_file.hpp b/include/asio/basic_stream_file.hpp index 141d26a6b4..4476b03828 100644 --- a/include/asio/basic_stream_file.hpp +++ b/include/asio/basic_stream_file.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_FILE) \ || defined(GENERATING_DOCUMENTATION) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/basic_file.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/basic_stream_socket.hpp b/include/asio/basic_stream_socket.hpp index d045a551df..9c91f80229 100644 --- a/include/asio/basic_stream_socket.hpp +++ b/include/asio/basic_stream_socket.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/basic_socket.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/basic_streambuf.hpp b/include/asio/basic_streambuf.hpp index abddb6e27e..4e14561dde 100644 --- a/include/asio/basic_streambuf.hpp +++ b/include/asio/basic_streambuf.hpp @@ -19,11 +19,11 @@ #if !defined(ASIO_NO_IOSTREAM) -#include -#include -#include -#include -#include +#include "asio/detail/std/algorithm.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/stdexcept.hpp" +#include "asio/detail/std/streambuf.hpp" +#include "asio/detail/std/vector.hpp" #include "asio/basic_streambuf_fwd.hpp" #include "asio/buffer.hpp" #include "asio/detail/limits.hpp" diff --git a/include/asio/basic_streambuf_fwd.hpp b/include/asio/basic_streambuf_fwd.hpp index 2d4279dc89..9a001f5358 100644 --- a/include/asio/basic_streambuf_fwd.hpp +++ b/include/asio/basic_streambuf_fwd.hpp @@ -19,7 +19,7 @@ #if !defined(ASIO_NO_IOSTREAM) -#include +#include "asio/detail/std/memory.hpp" namespace asio { diff --git a/include/asio/basic_waitable_timer.hpp b/include/asio/basic_waitable_timer.hpp index a69370866d..90bd2fa640 100644 --- a/include/asio/basic_waitable_timer.hpp +++ b/include/asio/basic_waitable_timer.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/detail/chrono_time_traits.hpp" #include "asio/detail/deadline_timer_service.hpp" diff --git a/include/asio/basic_writable_pipe.hpp b/include/asio/basic_writable_pipe.hpp index 15e7e66df9..0155b89a47 100644 --- a/include/asio/basic_writable_pipe.hpp +++ b/include/asio/basic_writable_pipe.hpp @@ -20,8 +20,8 @@ #if defined(ASIO_HAS_PIPE) \ || defined(GENERATING_DOCUMENTATION) -#include -#include +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/buffer.hpp b/include/asio/buffer.hpp index 52901449d1..61c2c44a5e 100644 --- a/include/asio/buffer.hpp +++ b/include/asio/buffer.hpp @@ -16,12 +16,12 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/limits.hpp" +#include "asio/detail/std/stdexcept.hpp" +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/vector.hpp" #include "asio/detail/array_fwd.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/string_view.hpp" diff --git a/include/asio/buffer_registration.hpp b/include/asio/buffer_registration.hpp index 739ba14f02..56247207b9 100644 --- a/include/asio/buffer_registration.hpp +++ b/include/asio/buffer_registration.hpp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/iterator.hpp" +#include "asio/detail/std/utility.hpp" +#include "asio/detail/std/vector.hpp" #include "asio/detail/memory.hpp" #include "asio/execution/context.hpp" #include "asio/execution/executor.hpp" diff --git a/include/asio/buffered_read_stream.hpp b/include/asio/buffered_read_stream.hpp index 9ef31e0710..f7d7f4da8c 100644 --- a/include/asio/buffered_read_stream.hpp +++ b/include/asio/buffered_read_stream.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/buffered_read_stream_fwd.hpp" #include "asio/buffer.hpp" diff --git a/include/asio/buffered_stream.hpp b/include/asio/buffered_stream.hpp index 5fb4bdb5fd..39a1b42ede 100644 --- a/include/asio/buffered_stream.hpp +++ b/include/asio/buffered_stream.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/buffered_read_stream.hpp" #include "asio/buffered_write_stream.hpp" diff --git a/include/asio/buffered_write_stream.hpp b/include/asio/buffered_write_stream.hpp index 409bc320b4..23b9b3b768 100644 --- a/include/asio/buffered_write_stream.hpp +++ b/include/asio/buffered_write_stream.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/buffered_write_stream_fwd.hpp" #include "asio/buffer.hpp" #include "asio/completion_condition.hpp" diff --git a/include/asio/buffers_iterator.hpp b/include/asio/buffers_iterator.hpp index 4aa8bf5f2b..b948ce1290 100644 --- a/include/asio/buffers_iterator.hpp +++ b/include/asio/buffers_iterator.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/iterator.hpp" #include "asio/buffer.hpp" #include "asio/detail/assert.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/cancellation_signal.hpp b/include/asio/cancellation_signal.hpp index bbdf8adf66..7e01029b10 100644 --- a/include/asio/cancellation_signal.hpp +++ b/include/asio/cancellation_signal.hpp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/cassert.hpp" +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/cancellation_type.hpp" #include "asio/detail/cstddef.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/cancellation_state.hpp b/include/asio/cancellation_state.hpp index 30cd061eb9..027937bfb2 100644 --- a/include/asio/cancellation_state.hpp +++ b/include/asio/cancellation_state.hpp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/cassert.hpp" +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/cancellation_signal.hpp" #include "asio/detail/cstddef.hpp" diff --git a/include/asio/co_composed.hpp b/include/asio/co_composed.hpp index ea8e4a91a9..e6c054c82e 100644 --- a/include/asio/co_composed.hpp +++ b/include/asio/co_composed.hpp @@ -19,9 +19,9 @@ #if defined(ASIO_HAS_CO_AWAIT) || defined(GENERATING_DOCUMENTATION) -#include -#include -#include +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/tuple.hpp" +#include "asio/detail/std/variant.hpp" #include "asio/associated_cancellation_slot.hpp" #include "asio/associator.hpp" #include "asio/async_result.hpp" @@ -33,7 +33,7 @@ #include "asio/error.hpp" #if defined(ASIO_HAS_STD_COROUTINE) -# include +# include "asio/detail/std/coroutine.hpp" #else // defined(ASIO_HAS_STD_COROUTINE) # include #endif // defined(ASIO_HAS_STD_COROUTINE) diff --git a/include/asio/completion_condition.hpp b/include/asio/completion_condition.hpp index 326c250060..a4bd632fc3 100644 --- a/include/asio/completion_condition.hpp +++ b/include/asio/completion_condition.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error_code.hpp" diff --git a/include/asio/config.hpp b/include/asio/config.hpp index 1af82d5ef3..8a198dbd0b 100644 --- a/include/asio/config.hpp +++ b/include/asio/config.hpp @@ -19,8 +19,8 @@ #include "asio/detail/throw_exception.hpp" #include "asio/detail/type_traits.hpp" #include "asio/execution_context.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/string.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/consign.hpp b/include/asio/consign.hpp index d6a2b56fc9..56ebd21085 100644 --- a/include/asio/consign.hpp +++ b/include/asio/consign.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/deferred.hpp b/include/asio/deferred.hpp index aadf4f3a99..debd3b6774 100644 --- a/include/asio/deferred.hpp +++ b/include/asio/deferred.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/associator.hpp" #include "asio/async_result.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/detached.hpp b/include/asio/detached.hpp index 2966f91d67..86b1a03e8a 100644 --- a/include/asio/detached.hpp +++ b/include/asio/detached.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/memory.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/array.hpp b/include/asio/detail/array.hpp index 32d3032334..4192a9cf26 100644 --- a/include/asio/detail/array.hpp +++ b/include/asio/detail/array.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/array.hpp" namespace asio { namespace detail { diff --git a/include/asio/detail/array_fwd.hpp b/include/asio/detail/array_fwd.hpp index f07a078ef5..5986cf415d 100644 --- a/include/asio/detail/array_fwd.hpp +++ b/include/asio/detail/array_fwd.hpp @@ -27,6 +27,6 @@ class array; // Standard library components can't be forward declared, so we'll have to // include the array header. Fortunately, it's fairly lightweight and doesn't // add significantly to the compile time. -#include +#include "asio/detail/std/array.hpp" #endif // ASIO_DETAIL_ARRAY_FWD_HPP diff --git a/include/asio/detail/assert.hpp b/include/asio/detail/assert.hpp index 9d45c40dde..c53670aaf5 100644 --- a/include/asio/detail/assert.hpp +++ b/include/asio/detail/assert.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_BOOST_ASSERT) # include #else // defined(ASIO_HAS_BOOST_ASSERT) -# include +# include "asio/detail/std/cassert.hpp" #endif // defined(ASIO_HAS_BOOST_ASSERT) #if defined(ASIO_HAS_BOOST_ASSERT) diff --git a/include/asio/detail/atomic_count.hpp b/include/asio/detail/atomic_count.hpp index 030f302219..1047d6bf37 100644 --- a/include/asio/detail/atomic_count.hpp +++ b/include/asio/detail/atomic_count.hpp @@ -20,7 +20,7 @@ #if !defined(ASIO_HAS_THREADS) // Nothing to include. #else // !defined(ASIO_HAS_THREADS) -# include +# include "asio/detail/std/atomic.hpp" #endif // !defined(ASIO_HAS_THREADS) namespace asio { diff --git a/include/asio/detail/buffered_stream_storage.hpp b/include/asio/detail/buffered_stream_storage.hpp index ad67f19757..161bae4109 100644 --- a/include/asio/detail/buffered_stream_storage.hpp +++ b/include/asio/detail/buffered_stream_storage.hpp @@ -18,9 +18,9 @@ #include "asio/detail/config.hpp" #include "asio/buffer.hpp" #include "asio/detail/assert.hpp" -#include -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/vector.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/chrono.hpp b/include/asio/detail/chrono.hpp index 355ef8d05d..a717987c94 100644 --- a/include/asio/detail/chrono.hpp +++ b/include/asio/detail/chrono.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/chrono.hpp" namespace asio { namespace chrono { diff --git a/include/asio/detail/completion_message.hpp b/include/asio/detail/completion_message.hpp index 8769550140..48f5d4b07c 100644 --- a/include/asio/detail/completion_message.hpp +++ b/include/asio/detail/completion_message.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/utility.hpp" diff --git a/include/asio/detail/completion_payload.hpp b/include/asio/detail/completion_payload.hpp index 5da0c98a34..a9e738362b 100644 --- a/include/asio/detail/completion_payload.hpp +++ b/include/asio/detail/completion_payload.hpp @@ -21,9 +21,9 @@ #include "asio/detail/completion_message.hpp" #if defined(ASIO_HAS_STD_VARIANT) -# include +# include "asio/detail/std/variant.hpp" #else // defined(ASIO_HAS_STD_VARIANT) -# include +# include "asio/detail/std/new.hpp" #endif // defined(ASIO_HAS_STD_VARIANT) #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/config.hpp b/include/asio/detail/config.hpp index bdc01a6da2..698dcf5157 100644 --- a/include/asio/detail/config.hpp +++ b/include/asio/detail/config.hpp @@ -27,12 +27,12 @@ // Make standard library feature macros available. #if defined(__has_include) # if __has_include() -# include +# include "asio/detail/std/version.hpp" # else // __has_include() -# include +# include "asio/detail/std/cstddef.hpp" # endif // __has_include() #else // defined(__has_include) -# include +# include "asio/detail/std/cstddef.hpp" #endif // defined(__has_include) // boostify: non-boost code ends here diff --git a/include/asio/detail/consuming_buffers.hpp b/include/asio/detail/consuming_buffers.hpp index a3ee420d73..7826e9ceb3 100644 --- a/include/asio/detail/consuming_buffers.hpp +++ b/include/asio/detail/consuming_buffers.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/buffer.hpp" #include "asio/detail/buffer_sequence_adapter.hpp" #include "asio/detail/limits.hpp" diff --git a/include/asio/detail/cstddef.hpp b/include/asio/detail/cstddef.hpp index 5ea3a7d828..563af76d19 100644 --- a/include/asio/detail/cstddef.hpp +++ b/include/asio/detail/cstddef.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" namespace asio { diff --git a/include/asio/detail/cstdint.hpp b/include/asio/detail/cstdint.hpp index c7405e0126..c39a7b37fd 100644 --- a/include/asio/detail/cstdint.hpp +++ b/include/asio/detail/cstdint.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstdint.hpp" namespace asio { diff --git a/include/asio/detail/deadline_timer_service.hpp b/include/asio/detail/deadline_timer_service.hpp index 59633d1562..0522440cc8 100644 --- a/include/asio/detail/deadline_timer_service.hpp +++ b/include/asio/detail/deadline_timer_service.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/associated_cancellation_slot.hpp" #include "asio/cancellation_type.hpp" #include "asio/config.hpp" @@ -34,8 +34,8 @@ #include "asio/detail/wait_op.hpp" #if defined(ASIO_WINDOWS_RUNTIME) -# include -# include +# include "asio/detail/std/chrono.hpp" +# include "asio/detail/std/thread.hpp" #endif // defined(ASIO_WINDOWS_RUNTIME) #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/descriptor_ops.hpp b/include/asio/detail/descriptor_ops.hpp index 1909c4ec64..9126f0e276 100644 --- a/include/asio/detail/descriptor_ops.hpp +++ b/include/asio/detail/descriptor_ops.hpp @@ -21,7 +21,7 @@ && !defined(ASIO_WINDOWS_RUNTIME) \ && !defined(__CYGWIN__) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/error.hpp" #include "asio/error_code.hpp" #include "asio/detail/cstdint.hpp" diff --git a/include/asio/detail/dev_poll_reactor.hpp b/include/asio/detail/dev_poll_reactor.hpp index 2669a9d32e..d0f26d8c0b 100644 --- a/include/asio/detail/dev_poll_reactor.hpp +++ b/include/asio/detail/dev_poll_reactor.hpp @@ -19,8 +19,8 @@ #if defined(ASIO_HAS_DEV_POLL) -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/vector.hpp" #include #include "asio/detail/hash_map.hpp" #include "asio/detail/limits.hpp" diff --git a/include/asio/detail/exception.hpp b/include/asio/detail/exception.hpp index ea0206bc4a..7a69d6bd77 100644 --- a/include/asio/detail/exception.hpp +++ b/include/asio/detail/exception.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/exception.hpp" namespace asio { diff --git a/include/asio/detail/functional.hpp b/include/asio/detail/functional.hpp index 16f59a7c32..b951c648c6 100644 --- a/include/asio/detail/functional.hpp +++ b/include/asio/detail/functional.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/functional.hpp" namespace asio { namespace detail { diff --git a/include/asio/detail/future.hpp b/include/asio/detail/future.hpp index 71c547bdab..ddc0d59afd 100644 --- a/include/asio/detail/future.hpp +++ b/include/asio/detail/future.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/future.hpp" // Even though the future header is available, libstdc++ may not implement the // std::future class itself. However, we need to have already included the diff --git a/include/asio/detail/hash_map.hpp b/include/asio/detail/hash_map.hpp index e10024d380..71f2cc96b4 100644 --- a/include/asio/detail/hash_map.hpp +++ b/include/asio/detail/hash_map.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/list.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/detail/assert.hpp" #include "asio/detail/noncopyable.hpp" diff --git a/include/asio/detail/impl/descriptor_ops.ipp b/include/asio/detail/impl/descriptor_ops.ipp index 9295110604..865cafb344 100644 --- a/include/asio/detail/impl/descriptor_ops.ipp +++ b/include/asio/detail/impl/descriptor_ops.ipp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cerrno.hpp" #include "asio/detail/descriptor_ops.hpp" #include "asio/error.hpp" diff --git a/include/asio/detail/impl/epoll_reactor.ipp b/include/asio/detail/impl/epoll_reactor.ipp index 1de9a55f52..57b05636ae 100644 --- a/include/asio/detail/impl/epoll_reactor.ipp +++ b/include/asio/detail/impl/epoll_reactor.ipp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_EPOLL) -#include +#include "asio/detail/std/cstddef.hpp" #include #include "asio/config.hpp" #include "asio/detail/epoll_reactor.hpp" diff --git a/include/asio/detail/impl/handler_tracking.ipp b/include/asio/detail/impl/handler_tracking.ipp index e526513889..a75eef04f4 100644 --- a/include/asio/detail/impl/handler_tracking.ipp +++ b/include/asio/detail/impl/handler_tracking.ipp @@ -23,8 +23,8 @@ #elif defined(ASIO_ENABLE_HANDLER_TRACKING) -#include -#include +#include "asio/detail/std/cstdarg.hpp" +#include "asio/detail/std/cstdio.hpp" #include "asio/detail/chrono.hpp" #include "asio/detail/chrono_time_traits.hpp" #include "asio/detail/handler_tracking.hpp" diff --git a/include/asio/detail/impl/io_uring_file_service.ipp b/include/asio/detail/impl/io_uring_file_service.ipp index aac4690a84..3d9a802254 100644 --- a/include/asio/detail/impl/io_uring_file_service.ipp +++ b/include/asio/detail/impl/io_uring_file_service.ipp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_FILE) \ && defined(ASIO_HAS_IO_URING) -#include +#include "asio/detail/std/cstring.hpp" #include #include "asio/detail/io_uring_file_service.hpp" diff --git a/include/asio/detail/impl/io_uring_service.ipp b/include/asio/detail/impl/io_uring_service.ipp index d6c5a39b41..2da13c3943 100644 --- a/include/asio/detail/impl/io_uring_service.ipp +++ b/include/asio/detail/impl/io_uring_service.ipp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_IO_URING) -#include +#include "asio/detail/std/cstddef.hpp" #include #include "asio/detail/io_uring_service.hpp" #include "asio/detail/reactor_op.hpp" diff --git a/include/asio/detail/impl/null_event.ipp b/include/asio/detail/impl/null_event.ipp index f86a520908..5252b74638 100644 --- a/include/asio/detail/impl/null_event.ipp +++ b/include/asio/detail/impl/null_event.ipp @@ -18,7 +18,7 @@ #include "asio/detail/config.hpp" #if defined(ASIO_WINDOWS_RUNTIME) -# include +# include "asio/detail/std/thread.hpp" #elif defined(ASIO_WINDOWS) || defined(__CYGWIN__) # include "asio/detail/socket_types.hpp" #else diff --git a/include/asio/detail/impl/posix_serial_port_service.ipp b/include/asio/detail/impl/posix_serial_port_service.ipp index 2c15493e22..8acedb7308 100644 --- a/include/asio/detail/impl/posix_serial_port_service.ipp +++ b/include/asio/detail/impl/posix_serial_port_service.ipp @@ -21,7 +21,7 @@ #if defined(ASIO_HAS_SERIAL_PORT) #if !defined(ASIO_WINDOWS) && !defined(__CYGWIN__) -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/posix_serial_port_service.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/impl/posix_thread.ipp b/include/asio/detail/impl/posix_thread.ipp index 0480b9e9a0..5ef92d3ab6 100644 --- a/include/asio/detail/impl/posix_thread.ipp +++ b/include/asio/detail/impl/posix_thread.ipp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_PTHREADS) -#include // use std::terminate(); +#include "asio/detail/std/exception.hpp" // use std::terminate(); #include "asio/detail/posix_thread.hpp" #include "asio/detail/throw_error.hpp" #include "asio/error.hpp" diff --git a/include/asio/detail/impl/service_registry.ipp b/include/asio/detail/impl/service_registry.ipp index 90fe04b73a..77dd6b641a 100644 --- a/include/asio/detail/impl/service_registry.ipp +++ b/include/asio/detail/impl/service_registry.ipp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/vector.hpp" #include "asio/detail/service_registry.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/detail/impl/signal_set_service.ipp b/include/asio/detail/impl/signal_set_service.ipp index 874003d7c8..cc84e20530 100644 --- a/include/asio/detail/impl/signal_set_service.ipp +++ b/include/asio/detail/impl/signal_set_service.ipp @@ -17,8 +17,8 @@ #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/stdexcept.hpp" #include "asio/detail/signal_blocker.hpp" #include "asio/detail/signal_set_service.hpp" #include "asio/detail/static_mutex.hpp" diff --git a/include/asio/detail/impl/socket_ops.ipp b/include/asio/detail/impl/socket_ops.ipp index e4699a6b18..7178e1a23b 100644 --- a/include/asio/detail/impl/socket_ops.ipp +++ b/include/asio/detail/impl/socket_ops.ipp @@ -17,20 +17,20 @@ #include "asio/detail/config.hpp" -#include -#include -#include -#include -#include -#include +#include "asio/detail/std/cctype.hpp" +#include "asio/detail/std/cstdio.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/cerrno.hpp" +#include "asio/detail/std/new.hpp" #include "asio/detail/assert.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/error.hpp" #if defined(ASIO_WINDOWS_RUNTIME) -# include -# include -# include +# include "asio/detail/std/codecvt.hpp" +# include "asio/detail/std/locale.hpp" +# include "asio/detail/std/string.hpp" #endif // defined(ASIO_WINDOWS_RUNTIME) #if defined(ASIO_WINDOWS) || defined(__CYGWIN__) \ diff --git a/include/asio/detail/impl/socket_select_interrupter.ipp b/include/asio/detail/impl/socket_select_interrupter.ipp index e22ffb44fb..1e55ddb23f 100644 --- a/include/asio/detail/impl/socket_select_interrupter.ipp +++ b/include/asio/detail/impl/socket_select_interrupter.ipp @@ -23,7 +23,7 @@ || defined(__CYGWIN__) \ || defined(__SYMBIAN32__) -#include +#include "asio/detail/std/cstdlib.hpp" #include "asio/detail/socket_holder.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/socket_select_interrupter.hpp" diff --git a/include/asio/detail/impl/win_iocp_file_service.ipp b/include/asio/detail/impl/win_iocp_file_service.ipp index 2c9c93bfa0..27d2b7af34 100644 --- a/include/asio/detail/impl/win_iocp_file_service.ipp +++ b/include/asio/detail/impl/win_iocp_file_service.ipp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_FILE) \ && defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) -#include +#include "asio/detail/std/cstring.hpp" #include #include "asio/detail/memory.hpp" #include "asio/detail/win_iocp_file_service.hpp" diff --git a/include/asio/detail/impl/win_iocp_serial_port_service.ipp b/include/asio/detail/impl/win_iocp_serial_port_service.ipp index f676ed86c6..b68130f168 100644 --- a/include/asio/detail/impl/win_iocp_serial_port_service.ipp +++ b/include/asio/detail/impl/win_iocp_serial_port_service.ipp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_IOCP) && defined(ASIO_HAS_SERIAL_PORT) -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/win_iocp_serial_port_service.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/impl/win_static_mutex.ipp b/include/asio/detail/impl/win_static_mutex.ipp index 49299a0cb2..6c21827e95 100644 --- a/include/asio/detail/impl/win_static_mutex.ipp +++ b/include/asio/detail/impl/win_static_mutex.ipp @@ -19,7 +19,7 @@ #if defined(ASIO_WINDOWS) -#include +#include "asio/detail/std/cstdio.hpp" #include "asio/detail/throw_error.hpp" #include "asio/detail/win_static_mutex.hpp" #include "asio/error.hpp" diff --git a/include/asio/detail/impl/winrt_ssocket_service_base.ipp b/include/asio/detail/impl/winrt_ssocket_service_base.ipp index 6c5eff628b..30347f7f9c 100644 --- a/include/asio/detail/impl/winrt_ssocket_service_base.ipp +++ b/include/asio/detail/impl/winrt_ssocket_service_base.ipp @@ -19,7 +19,7 @@ #if defined(ASIO_WINDOWS_RUNTIME) -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/winrt_ssocket_service_base.hpp" #include "asio/detail/winrt_async_op.hpp" #include "asio/detail/winrt_utils.hpp" diff --git a/include/asio/detail/io_control.hpp b/include/asio/detail/io_control.hpp index 7c53c9f4c0..e78d085221 100644 --- a/include/asio/detail/io_control.hpp +++ b/include/asio/detail/io_control.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/io_object_impl.hpp b/include/asio/detail/io_object_impl.hpp index df311898b5..9db09fc65f 100644 --- a/include/asio/detail/io_object_impl.hpp +++ b/include/asio/detail/io_object_impl.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include +#include "asio/detail/std/new.hpp" #include "asio/detail/config.hpp" #include "asio/detail/type_traits.hpp" #include "asio/execution/executor.hpp" diff --git a/include/asio/detail/io_uring_file_service.hpp b/include/asio/detail/io_uring_file_service.hpp index dfbb05d828..d1e873760c 100644 --- a/include/asio/detail/io_uring_file_service.hpp +++ b/include/asio/detail/io_uring_file_service.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_FILE) \ && defined(ASIO_HAS_IO_URING) -#include +#include "asio/detail/std/string.hpp" #include "asio/detail/cstdint.hpp" #include "asio/detail/descriptor_ops.hpp" #include "asio/detail/io_uring_descriptor_service.hpp" diff --git a/include/asio/detail/is_buffer_sequence.hpp b/include/asio/detail/is_buffer_sequence.hpp index 98f43cb498..2509108ec3 100644 --- a/include/asio/detail/is_buffer_sequence.hpp +++ b/include/asio/detail/is_buffer_sequence.hpp @@ -19,7 +19,7 @@ #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" -#include +#include "asio/detail/std/concepts.hpp" namespace asio { diff --git a/include/asio/detail/kqueue_reactor.hpp b/include/asio/detail/kqueue_reactor.hpp index 6e3dcd141d..990e75879f 100644 --- a/include/asio/detail/kqueue_reactor.hpp +++ b/include/asio/detail/kqueue_reactor.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_KQUEUE) -#include +#include "asio/detail/std/cstddef.hpp" #include #include #include diff --git a/include/asio/detail/limits.hpp b/include/asio/detail/limits.hpp index 323af22b30..79b76ff158 100644 --- a/include/asio/detail/limits.hpp +++ b/include/asio/detail/limits.hpp @@ -16,6 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/limits.hpp" #endif // ASIO_DETAIL_LIMITS_HPP diff --git a/include/asio/detail/memory.hpp b/include/asio/detail/memory.hpp index dc97e310b5..183962aef5 100644 --- a/include/asio/detail/memory.hpp +++ b/include/asio/detail/memory.hpp @@ -16,10 +16,10 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/memory.hpp" +#include "asio/detail/std/new.hpp" #include "asio/detail/cstdint.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/detail/posix_event.hpp b/include/asio/detail/posix_event.hpp index ddd4ab0c4e..d65b69b838 100644 --- a/include/asio/detail/posix_event.hpp +++ b/include/asio/detail/posix_event.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_PTHREADS) -#include +#include "asio/detail/std/cstddef.hpp" #include #include "asio/detail/assert.hpp" #include "asio/detail/noncopyable.hpp" diff --git a/include/asio/detail/posix_fd_set_adapter.hpp b/include/asio/detail/posix_fd_set_adapter.hpp index 6123c8e467..1dd8dee051 100644 --- a/include/asio/detail/posix_fd_set_adapter.hpp +++ b/include/asio/detail/posix_fd_set_adapter.hpp @@ -21,7 +21,7 @@ && !defined(__CYGWIN__) \ && !defined(ASIO_WINDOWS_RUNTIME) -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/reactor_op_queue.hpp" #include "asio/detail/socket_types.hpp" diff --git a/include/asio/detail/posix_global.hpp b/include/asio/detail/posix_global.hpp index 1fdce532fc..6a448384f2 100644 --- a/include/asio/detail/posix_global.hpp +++ b/include/asio/detail/posix_global.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_PTHREADS) -#include +#include "asio/detail/std/exception.hpp" #include #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/posix_serial_port_service.hpp b/include/asio/detail/posix_serial_port_service.hpp index 1db89dbc92..e94f31906c 100644 --- a/include/asio/detail/posix_serial_port_service.hpp +++ b/include/asio/detail/posix_serial_port_service.hpp @@ -21,7 +21,7 @@ #if defined(ASIO_HAS_SERIAL_PORT) #if !defined(ASIO_WINDOWS) && !defined(__CYGWIN__) -#include +#include "asio/detail/std/string.hpp" #include "asio/error.hpp" #include "asio/execution_context.hpp" #include "asio/serial_port_base.hpp" diff --git a/include/asio/detail/posix_signal_blocker.hpp b/include/asio/detail/posix_signal_blocker.hpp index f3fe0d9ce7..34ccff950c 100644 --- a/include/asio/detail/posix_signal_blocker.hpp +++ b/include/asio/detail/posix_signal_blocker.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_PTHREADS) -#include +#include "asio/detail/std/csignal.hpp" #include #include #include "asio/detail/noncopyable.hpp" diff --git a/include/asio/detail/posix_thread.hpp b/include/asio/detail/posix_thread.hpp index 4161d75c92..98d1e4668c 100644 --- a/include/asio/detail/posix_thread.hpp +++ b/include/asio/detail/posix_thread.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_PTHREADS) -#include +#include "asio/detail/std/cstddef.hpp" #include #include "asio/detail/memory.hpp" diff --git a/include/asio/detail/select_reactor.hpp b/include/asio/detail/select_reactor.hpp index 959446d179..1156a98948 100644 --- a/include/asio/detail/select_reactor.hpp +++ b/include/asio/detail/select_reactor.hpp @@ -23,7 +23,7 @@ && !defined(ASIO_HAS_KQUEUE) \ && !defined(ASIO_WINDOWS_RUNTIME)) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/fd_set_adapter.hpp" #include "asio/detail/limits.hpp" #include "asio/detail/mutex.hpp" diff --git a/include/asio/detail/service_registry.hpp b/include/asio/detail/service_registry.hpp index 936459f5a1..d6657e10f8 100644 --- a/include/asio/detail/service_registry.hpp +++ b/include/asio/detail/service_registry.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/mutex.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/detail/signal_init.hpp b/include/asio/detail/signal_init.hpp index bb4fa26b83..44823d15c8 100644 --- a/include/asio/detail/signal_init.hpp +++ b/include/asio/detail/signal_init.hpp @@ -19,7 +19,7 @@ #if !defined(ASIO_WINDOWS) && !defined(__CYGWIN__) -#include +#include "asio/detail/std/csignal.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/signal_set_service.hpp b/include/asio/detail/signal_set_service.hpp index bb88301c78..b5888e8470 100644 --- a/include/asio/detail/signal_set_service.hpp +++ b/include/asio/detail/signal_set_service.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include #include "asio/associated_cancellation_slot.hpp" #include "asio/cancellation_type.hpp" diff --git a/include/asio/detail/socket_option.hpp b/include/asio/detail/socket_option.hpp index 6f1c46b99b..1088ebfe31 100644 --- a/include/asio/detail/socket_option.hpp +++ b/include/asio/detail/socket_option.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/stdexcept.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/detail/source_location.hpp b/include/asio/detail/source_location.hpp index 79b41fb3b4..553b6bc797 100644 --- a/include/asio/detail/source_location.hpp +++ b/include/asio/detail/source_location.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_SOURCE_LOCATION) #if defined(ASIO_HAS_STD_SOURCE_LOCATION) -# include +# include "asio/detail/std/source_location.hpp" #elif defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION) # include #else // defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION) diff --git a/include/asio/detail/std/algorithm.hpp b/include/asio/detail/std/algorithm.hpp new file mode 100644 index 0000000000..bf7b3bb009 --- /dev/null +++ b/include/asio/detail/std/algorithm.hpp @@ -0,0 +1,30 @@ +// +// detail/std/algorithm.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ALGORITHM_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ALGORITHM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/all.hpp b/include/asio/detail/std/all.hpp new file mode 100644 index 0000000000..2f822f7fac --- /dev/null +++ b/include/asio/detail/std/all.hpp @@ -0,0 +1,61 @@ +// +// detail/std/all.hpp +// ~~~~~~~~~~~~~~~~~~~ +// +// auto-generated by module_compat.cmake + +#ifndef ASIO_DETAIL_STD_ALL_HPP +#define ASIO_DETAIL_STD_ALL_HPP + +#include "asio/detail/std/algorithm.hpp" +#include "asio/detail/std/any.hpp" +#include "asio/detail/std/array.hpp" +#include "asio/detail/std/atomic.hpp" +#include "asio/detail/std/cassert.hpp" +#include "asio/detail/std/cctype.hpp" +#include "asio/detail/std/cerrno.hpp" +#include "asio/detail/std/chrono.hpp" +#include "asio/detail/std/climits.hpp" +#include "asio/detail/std/codecvt.hpp" +#include "asio/detail/std/concepts.hpp" +#include "asio/detail/std/condition_variable.hpp" +#include "asio/detail/std/coroutine.hpp" +#include "asio/detail/std/csignal.hpp" +#include "asio/detail/std/cstdarg.hpp" +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/cstdint.hpp" +#include "asio/detail/std/cstdio.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/deque.hpp" +#include "asio/detail/std/exception.hpp" +#include "asio/detail/std/functional.hpp" +#include "asio/detail/std/future.hpp" +#include "asio/detail/std/iosfwd.hpp" +#include "asio/detail/std/istream.hpp" +#include "asio/detail/std/iterator.hpp" +#include "asio/detail/std/limits.hpp" +#include "asio/detail/std/list.hpp" +#include "asio/detail/std/locale.hpp" +#include "asio/detail/std/memory.hpp" +#include "asio/detail/std/mutex.hpp" +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/optional.hpp" +#include "asio/detail/std/ostream.hpp" +#include "asio/detail/std/source_location.hpp" +#include "asio/detail/std/sstream.hpp" +#include "asio/detail/std/stdexcept.hpp" +#include "asio/detail/std/streambuf.hpp" +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/string_view.hpp" +#include "asio/detail/std/system_error.hpp" +#include "asio/detail/std/thread.hpp" +#include "asio/detail/std/tuple.hpp" +#include "asio/detail/std/type_traits.hpp" +#include "asio/detail/std/typeinfo.hpp" +#include "asio/detail/std/utility.hpp" +#include "asio/detail/std/variant.hpp" +#include "asio/detail/std/vector.hpp" +#include "asio/detail/std/version.hpp" + +#endif // ASIO_DETAIL_STD_ALL_HPP diff --git a/include/asio/detail/std/any.hpp b/include/asio/detail/std/any.hpp new file mode 100644 index 0000000000..387d99f241 --- /dev/null +++ b/include/asio/detail/std/any.hpp @@ -0,0 +1,30 @@ +// +// detail/std/any.hpp +// ~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ANY_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ANY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/array.hpp b/include/asio/detail/std/array.hpp new file mode 100644 index 0000000000..f25e94778e --- /dev/null +++ b/include/asio/detail/std/array.hpp @@ -0,0 +1,30 @@ +// +// detail/std/array.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ARRAY_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ARRAY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/atomic.hpp b/include/asio/detail/std/atomic.hpp new file mode 100644 index 0000000000..968d583af0 --- /dev/null +++ b/include/asio/detail/std/atomic.hpp @@ -0,0 +1,30 @@ +// +// detail/std/atomic.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ATOMIC_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ATOMIC_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cassert.hpp b/include/asio/detail/std/cassert.hpp new file mode 100644 index 0000000000..98eec1eba0 --- /dev/null +++ b/include/asio/detail/std/cassert.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cassert.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CASSERT_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CASSERT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cctype.hpp b/include/asio/detail/std/cctype.hpp new file mode 100644 index 0000000000..5a6cb573f1 --- /dev/null +++ b/include/asio/detail/std/cctype.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cctype.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CCTYPE_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CCTYPE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cerrno.hpp b/include/asio/detail/std/cerrno.hpp new file mode 100644 index 0000000000..4f9f61cbc3 --- /dev/null +++ b/include/asio/detail/std/cerrno.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cerrno.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CERRNO_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CERRNO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/chrono.hpp b/include/asio/detail/std/chrono.hpp new file mode 100644 index 0000000000..724c50fecc --- /dev/null +++ b/include/asio/detail/std/chrono.hpp @@ -0,0 +1,30 @@ +// +// detail/std/chrono.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CHRONO_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CHRONO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/climits.hpp b/include/asio/detail/std/climits.hpp new file mode 100644 index 0000000000..d16ecdcc58 --- /dev/null +++ b/include/asio/detail/std/climits.hpp @@ -0,0 +1,30 @@ +// +// detail/std/climits.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CLIMITS_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CLIMITS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/codecvt.hpp b/include/asio/detail/std/codecvt.hpp new file mode 100644 index 0000000000..83a2f03eea --- /dev/null +++ b/include/asio/detail/std/codecvt.hpp @@ -0,0 +1,30 @@ +// +// detail/std/codecvt.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CODECVT_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CODECVT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/concepts.hpp b/include/asio/detail/std/concepts.hpp new file mode 100644 index 0000000000..8252e2f538 --- /dev/null +++ b/include/asio/detail/std/concepts.hpp @@ -0,0 +1,30 @@ +// +// detail/std/concepts.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONCEPTS_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONCEPTS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/condition_variable.hpp b/include/asio/detail/std/condition_variable.hpp new file mode 100644 index 0000000000..1eb1f13ebf --- /dev/null +++ b/include/asio/detail/std/condition_variable.hpp @@ -0,0 +1,30 @@ +// +// detail/std/condition_variable.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONDITION_VARIABLE_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONDITION_VARIABLE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/coroutine.hpp b/include/asio/detail/std/coroutine.hpp new file mode 100644 index 0000000000..e2058a7be8 --- /dev/null +++ b/include/asio/detail/std/coroutine.hpp @@ -0,0 +1,30 @@ +// +// detail/std/coroutine.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_COROUTINE_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_COROUTINE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/csignal.hpp b/include/asio/detail/std/csignal.hpp new file mode 100644 index 0000000000..7a2b9b5994 --- /dev/null +++ b/include/asio/detail/std/csignal.hpp @@ -0,0 +1,30 @@ +// +// detail/std/csignal.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSIGNAL_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSIGNAL_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cstdarg.hpp b/include/asio/detail/std/cstdarg.hpp new file mode 100644 index 0000000000..0bf09e1549 --- /dev/null +++ b/include/asio/detail/std/cstdarg.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cstdarg.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDARG_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDARG_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cstddef.hpp b/include/asio/detail/std/cstddef.hpp new file mode 100644 index 0000000000..adbed2585c --- /dev/null +++ b/include/asio/detail/std/cstddef.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cstddef.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDDEF_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDDEF_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cstdint.hpp b/include/asio/detail/std/cstdint.hpp new file mode 100644 index 0000000000..dddf6b1d65 --- /dev/null +++ b/include/asio/detail/std/cstdint.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cstdint.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDINT_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDINT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cstdio.hpp b/include/asio/detail/std/cstdio.hpp new file mode 100644 index 0000000000..ad2dfab464 --- /dev/null +++ b/include/asio/detail/std/cstdio.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cstdio.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDIO_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDIO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cstdlib.hpp b/include/asio/detail/std/cstdlib.hpp new file mode 100644 index 0000000000..b87001d210 --- /dev/null +++ b/include/asio/detail/std/cstdlib.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cstdlib.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDLIB_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDLIB_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/cstring.hpp b/include/asio/detail/std/cstring.hpp new file mode 100644 index 0000000000..e1f828b6e1 --- /dev/null +++ b/include/asio/detail/std/cstring.hpp @@ -0,0 +1,30 @@ +// +// detail/std/cstring.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTRING_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTRING_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/deque.hpp b/include/asio/detail/std/deque.hpp new file mode 100644 index 0000000000..0ec6527ece --- /dev/null +++ b/include/asio/detail/std/deque.hpp @@ -0,0 +1,30 @@ +// +// detail/std/deque.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_DEQUE_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_DEQUE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/exception.hpp b/include/asio/detail/std/exception.hpp new file mode 100644 index 0000000000..c479f82f79 --- /dev/null +++ b/include/asio/detail/std/exception.hpp @@ -0,0 +1,30 @@ +// +// detail/std/exception.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_EXCEPTION_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_EXCEPTION_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/functional.hpp b/include/asio/detail/std/functional.hpp new file mode 100644 index 0000000000..3cba31c10a --- /dev/null +++ b/include/asio/detail/std/functional.hpp @@ -0,0 +1,30 @@ +// +// detail/std/functional.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUNCTIONAL_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUNCTIONAL_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/future.hpp b/include/asio/detail/std/future.hpp new file mode 100644 index 0000000000..3f1740070e --- /dev/null +++ b/include/asio/detail/std/future.hpp @@ -0,0 +1,30 @@ +// +// detail/std/future.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUTURE_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUTURE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/iosfwd.hpp b/include/asio/detail/std/iosfwd.hpp new file mode 100644 index 0000000000..280ffef3a8 --- /dev/null +++ b/include/asio/detail/std/iosfwd.hpp @@ -0,0 +1,30 @@ +// +// detail/std/iosfwd.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_IOSFWD_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_IOSFWD_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/istream.hpp b/include/asio/detail/std/istream.hpp new file mode 100644 index 0000000000..44b542e9d7 --- /dev/null +++ b/include/asio/detail/std/istream.hpp @@ -0,0 +1,30 @@ +// +// detail/std/istream.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ISTREAM_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ISTREAM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/iterator.hpp b/include/asio/detail/std/iterator.hpp new file mode 100644 index 0000000000..12077dac3a --- /dev/null +++ b/include/asio/detail/std/iterator.hpp @@ -0,0 +1,30 @@ +// +// detail/std/iterator.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ITERATOR_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ITERATOR_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/limits.hpp b/include/asio/detail/std/limits.hpp new file mode 100644 index 0000000000..1a678ad03d --- /dev/null +++ b/include/asio/detail/std/limits.hpp @@ -0,0 +1,30 @@ +// +// detail/std/limits.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIMITS_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIMITS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/list.hpp b/include/asio/detail/std/list.hpp new file mode 100644 index 0000000000..20f9c91cf9 --- /dev/null +++ b/include/asio/detail/std/list.hpp @@ -0,0 +1,30 @@ +// +// detail/std/list.hpp +// ~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIST_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIST_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/locale.hpp b/include/asio/detail/std/locale.hpp new file mode 100644 index 0000000000..d62adf46c9 --- /dev/null +++ b/include/asio/detail/std/locale.hpp @@ -0,0 +1,30 @@ +// +// detail/std/locale.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LOCALE_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LOCALE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/memory.hpp b/include/asio/detail/std/memory.hpp new file mode 100644 index 0000000000..aa6b17bff8 --- /dev/null +++ b/include/asio/detail/std/memory.hpp @@ -0,0 +1,30 @@ +// +// detail/std/memory.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MEMORY_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MEMORY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/mutex.hpp b/include/asio/detail/std/mutex.hpp new file mode 100644 index 0000000000..e61e981db3 --- /dev/null +++ b/include/asio/detail/std/mutex.hpp @@ -0,0 +1,30 @@ +// +// detail/std/mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MUTEX_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MUTEX_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/new.hpp b/include/asio/detail/std/new.hpp new file mode 100644 index 0000000000..07423e1c55 --- /dev/null +++ b/include/asio/detail/std/new.hpp @@ -0,0 +1,30 @@ +// +// detail/std/new.hpp +// ~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_NEW_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_NEW_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/optional.hpp b/include/asio/detail/std/optional.hpp new file mode 100644 index 0000000000..937ba5e726 --- /dev/null +++ b/include/asio/detail/std/optional.hpp @@ -0,0 +1,30 @@ +// +// detail/std/optional.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OPTIONAL_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OPTIONAL_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/ostream.hpp b/include/asio/detail/std/ostream.hpp new file mode 100644 index 0000000000..9fb2a0adab --- /dev/null +++ b/include/asio/detail/std/ostream.hpp @@ -0,0 +1,30 @@ +// +// detail/std/ostream.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OSTREAM_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OSTREAM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/source_location.hpp b/include/asio/detail/std/source_location.hpp new file mode 100644 index 0000000000..e74459d045 --- /dev/null +++ b/include/asio/detail/std/source_location.hpp @@ -0,0 +1,30 @@ +// +// detail/std/source_location.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SOURCE_LOCATION_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SOURCE_LOCATION_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/sstream.hpp b/include/asio/detail/std/sstream.hpp new file mode 100644 index 0000000000..322bbd864b --- /dev/null +++ b/include/asio/detail/std/sstream.hpp @@ -0,0 +1,30 @@ +// +// detail/std/sstream.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SSTREAM_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SSTREAM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/stdexcept.hpp b/include/asio/detail/std/stdexcept.hpp new file mode 100644 index 0000000000..c8a4f78417 --- /dev/null +++ b/include/asio/detail/std/stdexcept.hpp @@ -0,0 +1,30 @@ +// +// detail/std/stdexcept.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STDEXCEPT_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STDEXCEPT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/streambuf.hpp b/include/asio/detail/std/streambuf.hpp new file mode 100644 index 0000000000..236cd9b116 --- /dev/null +++ b/include/asio/detail/std/streambuf.hpp @@ -0,0 +1,30 @@ +// +// detail/std/streambuf.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STREAMBUF_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STREAMBUF_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/string.hpp b/include/asio/detail/std/string.hpp new file mode 100644 index 0000000000..f9585a2f5a --- /dev/null +++ b/include/asio/detail/std/string.hpp @@ -0,0 +1,30 @@ +// +// detail/std/string.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/string_view.hpp b/include/asio/detail/std/string_view.hpp new file mode 100644 index 0000000000..0bdbb09e50 --- /dev/null +++ b/include/asio/detail/std/string_view.hpp @@ -0,0 +1,30 @@ +// +// detail/std/string_view.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_VIEW_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_VIEW_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/system_error.hpp b/include/asio/detail/std/system_error.hpp new file mode 100644 index 0000000000..a237008f7d --- /dev/null +++ b/include/asio/detail/std/system_error.hpp @@ -0,0 +1,30 @@ +// +// detail/std/system_error.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SYSTEM_ERROR_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SYSTEM_ERROR_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/thread.hpp b/include/asio/detail/std/thread.hpp new file mode 100644 index 0000000000..6ebff541bc --- /dev/null +++ b/include/asio/detail/std/thread.hpp @@ -0,0 +1,30 @@ +// +// detail/std/thread.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_THREAD_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_THREAD_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/tuple.hpp b/include/asio/detail/std/tuple.hpp new file mode 100644 index 0000000000..c3b96ee5c3 --- /dev/null +++ b/include/asio/detail/std/tuple.hpp @@ -0,0 +1,30 @@ +// +// detail/std/tuple.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TUPLE_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TUPLE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/type_traits.hpp b/include/asio/detail/std/type_traits.hpp new file mode 100644 index 0000000000..9e02b6b592 --- /dev/null +++ b/include/asio/detail/std/type_traits.hpp @@ -0,0 +1,30 @@ +// +// detail/std/type_traits.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPE_TRAITS_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPE_TRAITS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/typeinfo.hpp b/include/asio/detail/std/typeinfo.hpp new file mode 100644 index 0000000000..db2250245e --- /dev/null +++ b/include/asio/detail/std/typeinfo.hpp @@ -0,0 +1,30 @@ +// +// detail/std/typeinfo.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPEINFO_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPEINFO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/utility.hpp b/include/asio/detail/std/utility.hpp new file mode 100644 index 0000000000..5860fe474c --- /dev/null +++ b/include/asio/detail/std/utility.hpp @@ -0,0 +1,30 @@ +// +// detail/std/utility.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_UTILITY_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_UTILITY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/variant.hpp b/include/asio/detail/std/variant.hpp new file mode 100644 index 0000000000..ab25f23690 --- /dev/null +++ b/include/asio/detail/std/variant.hpp @@ -0,0 +1,30 @@ +// +// detail/std/variant.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VARIANT_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VARIANT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/vector.hpp b/include/asio/detail/std/vector.hpp new file mode 100644 index 0000000000..f471a8a3c4 --- /dev/null +++ b/include/asio/detail/std/vector.hpp @@ -0,0 +1,30 @@ +// +// detail/std/vector.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VECTOR_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VECTOR_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std/version.hpp b/include/asio/detail/std/version.hpp new file mode 100644 index 0000000000..9da8501252 --- /dev/null +++ b/include/asio/detail/std/version.hpp @@ -0,0 +1,30 @@ +// +// detail/std/version.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VERSION_NO_INCLUDE +# include +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VERSION_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif +# endif +# endif +#endif diff --git a/include/asio/detail/std_event.hpp b/include/asio/detail/std_event.hpp index ca30a2bdba..22f78c4ea2 100644 --- a/include/asio/detail/std_event.hpp +++ b/include/asio/detail/std_event.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/chrono.hpp" +#include "asio/detail/std/condition_variable.hpp" #include "asio/detail/assert.hpp" #include "asio/detail/noncopyable.hpp" diff --git a/include/asio/detail/std_fenced_block.hpp b/include/asio/detail/std_fenced_block.hpp index 2d79656be8..f69fd834de 100644 --- a/include/asio/detail/std_fenced_block.hpp +++ b/include/asio/detail/std_fenced_block.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/atomic.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/std_global.hpp b/include/asio/detail/std_global.hpp index 4b2feb6d74..13ea082939 100644 --- a/include/asio/detail/std_global.hpp +++ b/include/asio/detail/std_global.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/exception.hpp" +#include "asio/detail/std/mutex.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/std_mutex.hpp b/include/asio/detail/std_mutex.hpp index 416c381d6a..deba5d0372 100644 --- a/include/asio/detail/std_mutex.hpp +++ b/include/asio/detail/std_mutex.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/mutex.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/scoped_lock.hpp" diff --git a/include/asio/detail/std_static_mutex.hpp b/include/asio/detail/std_static_mutex.hpp index 745094d54e..faa5cf6ab9 100644 --- a/include/asio/detail/std_static_mutex.hpp +++ b/include/asio/detail/std_static_mutex.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/mutex.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/scoped_lock.hpp" diff --git a/include/asio/detail/std_thread.hpp b/include/asio/detail/std_thread.hpp index 5c79d461e5..8c0ee6515d 100644 --- a/include/asio/detail/std_thread.hpp +++ b/include/asio/detail/std_thread.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/thread.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/string_view.hpp b/include/asio/detail/string_view.hpp index ba44caf9ed..f7130cf503 100644 --- a/include/asio/detail/string_view.hpp +++ b/include/asio/detail/string_view.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_STRING_VIEW) #if defined(ASIO_HAS_STD_STRING_VIEW) -# include +# include "asio/detail/std/string_view.hpp" #elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) # include #else // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) diff --git a/include/asio/detail/thread_context.hpp b/include/asio/detail/thread_context.hpp index f042b670d6..818261e7cb 100644 --- a/include/asio/detail/thread_context.hpp +++ b/include/asio/detail/thread_context.hpp @@ -15,8 +15,8 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include -#include +#include "asio/detail/std/climits.hpp" +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/call_stack.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/detail/thread_info_base.hpp b/include/asio/detail/thread_info_base.hpp index acc591c3ce..7116d061cb 100644 --- a/include/asio/detail/thread_info_base.hpp +++ b/include/asio/detail/thread_info_base.hpp @@ -16,13 +16,13 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/climits.hpp" +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/noncopyable.hpp" #if !defined(ASIO_NO_EXCEPTIONS) -# include +# include "asio/detail/std/exception.hpp" # include "asio/multiple_exceptions.hpp" #endif // !defined(ASIO_NO_EXCEPTIONS) diff --git a/include/asio/detail/timer_queue.hpp b/include/asio/detail/timer_queue.hpp index 2190facecb..fdf773aeba 100644 --- a/include/asio/detail/timer_queue.hpp +++ b/include/asio/detail/timer_queue.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/vector.hpp" #include "asio/detail/cstdint.hpp" #include "asio/detail/date_time_fwd.hpp" #include "asio/detail/limits.hpp" diff --git a/include/asio/detail/type_traits.hpp b/include/asio/detail/type_traits.hpp index 2344a35c42..8a57622279 100644 --- a/include/asio/detail/type_traits.hpp +++ b/include/asio/detail/type_traits.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/type_traits.hpp" namespace asio { diff --git a/include/asio/detail/utility.hpp b/include/asio/detail/utility.hpp index 2da2775cba..2f56ea674c 100644 --- a/include/asio/detail/utility.hpp +++ b/include/asio/detail/utility.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/utility.hpp" namespace asio { namespace detail { diff --git a/include/asio/detail/win_event.hpp b/include/asio/detail/win_event.hpp index 59d47f100a..6386dea49a 100644 --- a/include/asio/detail/win_event.hpp +++ b/include/asio/detail/win_event.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_WINDOWS) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/assert.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/detail/socket_types.hpp" diff --git a/include/asio/detail/win_iocp_file_service.hpp b/include/asio/detail/win_iocp_file_service.hpp index 684e3e1450..a9b83de6d5 100644 --- a/include/asio/detail/win_iocp_file_service.hpp +++ b/include/asio/detail/win_iocp_file_service.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_IOCP) && defined(ASIO_HAS_FILE) -#include +#include "asio/detail/std/string.hpp" #include "asio/detail/cstdint.hpp" #include "asio/detail/win_iocp_handle_service.hpp" #include "asio/error.hpp" diff --git a/include/asio/detail/win_iocp_serial_port_service.hpp b/include/asio/detail/win_iocp_serial_port_service.hpp index 6a137fbbbf..eaca09f372 100644 --- a/include/asio/detail/win_iocp_serial_port_service.hpp +++ b/include/asio/detail/win_iocp_serial_port_service.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_IOCP) && defined(ASIO_HAS_SERIAL_PORT) -#include +#include "asio/detail/std/string.hpp" #include "asio/error.hpp" #include "asio/execution_context.hpp" #include "asio/detail/win_iocp_handle_service.hpp" diff --git a/include/asio/detail/win_iocp_socket_service.hpp b/include/asio/detail/win_iocp_socket_service.hpp index 3c30c15121..e61baffac2 100644 --- a/include/asio/detail/win_iocp_socket_service.hpp +++ b/include/asio/detail/win_iocp_socket_service.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_HAS_IOCP) -#include +#include "asio/detail/std/cstring.hpp" #include "asio/error.hpp" #include "asio/execution_context.hpp" #include "asio/socket_base.hpp" diff --git a/include/asio/detail/win_thread.hpp b/include/asio/detail/win_thread.hpp index 198b1cb533..d468dced58 100644 --- a/include/asio/detail/win_thread.hpp +++ b/include/asio/detail/win_thread.hpp @@ -21,7 +21,7 @@ && !defined(ASIO_WINDOWS_APP) \ && !defined(UNDER_CE) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/socket_types.hpp" diff --git a/include/asio/detail/winrt_async_manager.hpp b/include/asio/detail/winrt_async_manager.hpp index 841ffb4be8..ff7a58b2da 100644 --- a/include/asio/detail/winrt_async_manager.hpp +++ b/include/asio/detail/winrt_async_manager.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_WINDOWS_RUNTIME) -#include +#include "asio/detail/std/future.hpp" #include "asio/detail/atomic_count.hpp" #include "asio/detail/winrt_async_op.hpp" #include "asio/error.hpp" diff --git a/include/asio/detail/winrt_timer_scheduler.hpp b/include/asio/detail/winrt_timer_scheduler.hpp index 3a53833428..20942677dd 100644 --- a/include/asio/detail/winrt_timer_scheduler.hpp +++ b/include/asio/detail/winrt_timer_scheduler.hpp @@ -19,7 +19,7 @@ #if defined(ASIO_WINDOWS_RUNTIME) -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/event.hpp" #include "asio/detail/limits.hpp" #include "asio/detail/mutex.hpp" diff --git a/include/asio/detail/winrt_utils.hpp b/include/asio/detail/winrt_utils.hpp index 6bc2fc4b60..8abe570847 100644 --- a/include/asio/detail/winrt_utils.hpp +++ b/include/asio/detail/winrt_utils.hpp @@ -19,10 +19,10 @@ #if defined(ASIO_WINDOWS_RUNTIME) -#include -#include -#include -#include +#include "asio/detail/std/codecvt.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/future.hpp" +#include "asio/detail/std/locale.hpp" #include #include #include diff --git a/include/asio/disposition.hpp b/include/asio/disposition.hpp index fabbf31d89..290a77dd67 100644 --- a/include/asio/disposition.hpp +++ b/include/asio/disposition.hpp @@ -20,7 +20,7 @@ #include "asio/detail/type_traits.hpp" #include "asio/error_code.hpp" #include "asio/system_error.hpp" -#include +#include "asio/detail/std/exception.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/error.hpp b/include/asio/error.hpp index e4f87e3396..62a1f73c40 100644 --- a/include/asio/error.hpp +++ b/include/asio/error.hpp @@ -23,7 +23,7 @@ || defined(ASIO_WINDOWS_RUNTIME) # include #else -# include +# include "asio/detail/std/cerrno.hpp" # include #endif diff --git a/include/asio/error_code.hpp b/include/asio/error_code.hpp index 74a3af3490..21dd9c171d 100644 --- a/include/asio/error_code.hpp +++ b/include/asio/error_code.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/system_error.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/execution/any_executor.hpp b/include/asio/execution/any_executor.hpp index f043f09f8d..f61b5f789b 100644 --- a/include/asio/execution/any_executor.hpp +++ b/include/asio/execution/any_executor.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/assert.hpp" #include "asio/detail/atomic_count.hpp" #include "asio/detail/cstddef.hpp" diff --git a/include/asio/execution/bad_executor.hpp b/include/asio/execution/bad_executor.hpp index e4d4980a72..6e26577de8 100644 --- a/include/asio/execution/bad_executor.hpp +++ b/include/asio/execution/bad_executor.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/exception.hpp" #include "asio/detail/push_options.hpp" namespace asio { diff --git a/include/asio/execution/context.hpp b/include/asio/execution/context.hpp index 09b1a67336..d046d6ef68 100644 --- a/include/asio/execution/context.hpp +++ b/include/asio/execution/context.hpp @@ -23,7 +23,7 @@ #include "asio/traits/static_query.hpp" #if defined(ASIO_HAS_STD_ANY) -# include +# include "asio/detail/std/any.hpp" #endif // defined(ASIO_HAS_STD_ANY) #include "asio/detail/push_options.hpp" diff --git a/include/asio/execution_context.hpp b/include/asio/execution_context.hpp index 0b5b80e3fe..c93a180588 100644 --- a/include/asio/execution_context.hpp +++ b/include/asio/execution_context.hpp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/stdexcept.hpp" +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/noncopyable.hpp" diff --git a/include/asio/executor.hpp b/include/asio/executor.hpp index 5d803c7661..47765d3c11 100644 --- a/include/asio/executor.hpp +++ b/include/asio/executor.hpp @@ -19,8 +19,8 @@ #if !defined(ASIO_NO_TS_EXECUTORS) -#include -#include +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/cstddef.hpp" #include "asio/detail/executor_function.hpp" #include "asio/detail/memory.hpp" diff --git a/include/asio/experimental/awaitable_operators.hpp b/include/asio/experimental/awaitable_operators.hpp index 76add98269..8196b5b86e 100644 --- a/include/asio/experimental/awaitable_operators.hpp +++ b/include/asio/experimental/awaitable_operators.hpp @@ -16,10 +16,10 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include +#include "asio/detail/std/optional.hpp" +#include "asio/detail/std/stdexcept.hpp" +#include "asio/detail/std/tuple.hpp" +#include "asio/detail/std/variant.hpp" #include "asio/awaitable.hpp" #include "asio/co_spawn.hpp" #include "asio/deferred.hpp" diff --git a/include/asio/experimental/channel_traits.hpp b/include/asio/experimental/channel_traits.hpp index a5438c6d6a..141671a446 100644 --- a/include/asio/experimental/channel_traits.hpp +++ b/include/asio/experimental/channel_traits.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include // use std::exception_ptr -#include +#include "asio/detail/std/exception.hpp" // use std::exception_ptr +#include "asio/detail/std/deque.hpp" #include "asio/detail/type_traits.hpp" #include "asio/error.hpp" #include "asio/experimental/channel_error.hpp" diff --git a/include/asio/experimental/co_spawn.hpp b/include/asio/experimental/co_spawn.hpp index 1bee67e5fe..db35d23576 100644 --- a/include/asio/experimental/co_spawn.hpp +++ b/include/asio/experimental/co_spawn.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/utility.hpp" #include "asio/compose.hpp" #include "asio/deferred.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/experimental/coro_traits.hpp b/include/asio/experimental/coro_traits.hpp index 7da904b127..8bd2fd4784 100644 --- a/include/asio/experimental/coro_traits.hpp +++ b/include/asio/experimental/coro_traits.hpp @@ -17,8 +17,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/optional.hpp" +#include "asio/detail/std/variant.hpp" #include "asio/any_io_executor.hpp" namespace asio { diff --git a/include/asio/experimental/detail/coro_promise_allocator.hpp b/include/asio/experimental/detail/coro_promise_allocator.hpp index 07a6379306..93688a4686 100644 --- a/include/asio/experimental/detail/coro_promise_allocator.hpp +++ b/include/asio/experimental/detail/coro_promise_allocator.hpp @@ -13,7 +13,7 @@ #define ASIO_EXPERIMENTAL_DETAIL_CORO_PROMISE_ALLOCATOR_HPP #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/limits.hpp" #include "asio/experimental/coro_traits.hpp" namespace asio { diff --git a/include/asio/experimental/detail/partial_promise.hpp b/include/asio/experimental/detail/partial_promise.hpp index 5ca2931c5d..568f26e93a 100644 --- a/include/asio/experimental/detail/partial_promise.hpp +++ b/include/asio/experimental/detail/partial_promise.hpp @@ -18,7 +18,7 @@ #include "asio/experimental/coro_traits.hpp" #if defined(ASIO_HAS_STD_COROUTINE) -# include +# include "asio/detail/std/coroutine.hpp" #else // defined(ASIO_HAS_STD_COROUTINE) # include #endif // defined(ASIO_HAS_STD_COROUTINE) diff --git a/include/asio/experimental/impl/as_single.hpp b/include/asio/experimental/impl/as_single.hpp index f978ee7c29..48183b1917 100644 --- a/include/asio/experimental/impl/as_single.hpp +++ b/include/asio/experimental/impl/as_single.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/associator.hpp" #include "asio/async_result.hpp" #include "asio/detail/handler_cont_helpers.hpp" diff --git a/include/asio/experimental/impl/parallel_group.hpp b/include/asio/experimental/impl/parallel_group.hpp index 2022ebcefc..9f71272346 100644 --- a/include/asio/experimental/impl/parallel_group.hpp +++ b/include/asio/experimental/impl/parallel_group.hpp @@ -16,11 +16,11 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include -#include +#include "asio/detail/std/atomic.hpp" +#include "asio/detail/std/deque.hpp" +#include "asio/detail/std/memory.hpp" +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/tuple.hpp" #include "asio/associated_cancellation_slot.hpp" #include "asio/detail/recycling_allocator.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/experimental/impl/promise.hpp b/include/asio/experimental/impl/promise.hpp index 76d7cfbaf7..0dac57c8fe 100644 --- a/include/asio/experimental/impl/promise.hpp +++ b/include/asio/experimental/impl/promise.hpp @@ -20,7 +20,7 @@ #include "asio/detail/utility.hpp" #include "asio/error.hpp" #include "asio/system_error.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/experimental/impl/use_promise.hpp b/include/asio/experimental/impl/use_promise.hpp index a1aeb5bfe6..f7da26a4b2 100644 --- a/include/asio/experimental/impl/use_promise.hpp +++ b/include/asio/experimental/impl/use_promise.hpp @@ -17,7 +17,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/memory.hpp" #include "asio/async_result.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/experimental/parallel_group.hpp b/include/asio/experimental/parallel_group.hpp index 09a75ef988..0e8f5baa68 100644 --- a/include/asio/experimental/parallel_group.hpp +++ b/include/asio/experimental/parallel_group.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/vector.hpp" #include "asio/async_result.hpp" #include "asio/detail/array.hpp" #include "asio/detail/memory.hpp" diff --git a/include/asio/experimental/promise.hpp b/include/asio/experimental/promise.hpp index 3cb788eff3..8608fe61ae 100644 --- a/include/asio/experimental/promise.hpp +++ b/include/asio/experimental/promise.hpp @@ -27,7 +27,7 @@ #include "asio/experimental/impl/promise.hpp" #include "asio/post.hpp" -#include +#include "asio/detail/std/algorithm.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/experimental/use_coro.hpp b/include/asio/experimental/use_coro.hpp index 409bf4b2a9..193627268a 100644 --- a/include/asio/experimental/use_coro.hpp +++ b/include/asio/experimental/use_coro.hpp @@ -17,7 +17,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/memory.hpp" #include "asio/deferred.hpp" #include "asio/detail/source_location.hpp" diff --git a/include/asio/experimental/use_promise.hpp b/include/asio/experimental/use_promise.hpp index 721b89de56..61f36a9e56 100644 --- a/include/asio/experimental/use_promise.hpp +++ b/include/asio/experimental/use_promise.hpp @@ -17,7 +17,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/memory.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/generic/datagram_protocol.hpp b/include/asio/generic/datagram_protocol.hpp index 97a7f59d3b..37861ab113 100644 --- a/include/asio/generic/datagram_protocol.hpp +++ b/include/asio/generic/datagram_protocol.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/typeinfo.hpp" #include "asio/basic_datagram_socket.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/generic/detail/endpoint.hpp b/include/asio/generic/detail/endpoint.hpp index 3f861a55af..1bf20f7337 100644 --- a/include/asio/generic/detail/endpoint.hpp +++ b/include/asio/generic/detail/endpoint.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/generic/detail/impl/endpoint.ipp b/include/asio/generic/detail/impl/endpoint.ipp index 65ecbe8d0b..67154d9b4e 100644 --- a/include/asio/generic/detail/impl/endpoint.ipp +++ b/include/asio/generic/detail/impl/endpoint.ipp @@ -17,8 +17,8 @@ #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/throw_error.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/generic/raw_protocol.hpp b/include/asio/generic/raw_protocol.hpp index ce8d35134d..6637a808a0 100644 --- a/include/asio/generic/raw_protocol.hpp +++ b/include/asio/generic/raw_protocol.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/typeinfo.hpp" #include "asio/basic_raw_socket.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/generic/seq_packet_protocol.hpp b/include/asio/generic/seq_packet_protocol.hpp index 7014b04152..1dcb244da0 100644 --- a/include/asio/generic/seq_packet_protocol.hpp +++ b/include/asio/generic/seq_packet_protocol.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/typeinfo.hpp" #include "asio/basic_seq_packet_socket.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/generic/stream_protocol.hpp b/include/asio/generic/stream_protocol.hpp index 8b2305939f..9005eac239 100644 --- a/include/asio/generic/stream_protocol.hpp +++ b/include/asio/generic/stream_protocol.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/typeinfo.hpp" #include "asio/basic_socket_iostream.hpp" #include "asio/basic_stream_socket.hpp" #include "asio/detail/socket_types.hpp" diff --git a/include/asio/impl/as_tuple.hpp b/include/asio/impl/as_tuple.hpp index a94347d115..d5d9702966 100644 --- a/include/asio/impl/as_tuple.hpp +++ b/include/asio/impl/as_tuple.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/associated_executor.hpp" #include "asio/associator.hpp" #include "asio/async_result.hpp" diff --git a/include/asio/impl/awaitable.hpp b/include/asio/impl/awaitable.hpp index b32223a155..d85a33a03e 100644 --- a/include/asio/impl/awaitable.hpp +++ b/include/asio/impl/awaitable.hpp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/exception.hpp" +#include "asio/detail/std/new.hpp" +#include "asio/detail/std/tuple.hpp" #include "asio/cancellation_signal.hpp" #include "asio/cancellation_state.hpp" #include "asio/detail/memory.hpp" diff --git a/include/asio/impl/config.hpp b/include/asio/impl/config.hpp index ba9bdf8e32..1b496f751c 100644 --- a/include/asio/impl/config.hpp +++ b/include/asio/impl/config.hpp @@ -16,10 +16,10 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include +#include "asio/detail/std/cerrno.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/limits.hpp" +#include "asio/detail/std/stdexcept.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/impl/config.ipp b/include/asio/impl/config.ipp index feaf201e47..73c428bcd9 100644 --- a/include/asio/impl/config.ipp +++ b/include/asio/impl/config.ipp @@ -17,12 +17,12 @@ #include "asio/config.hpp" #include "asio/detail/concurrency_hint.hpp" -#include -#include -#include -#include -#include -#include +#include "asio/detail/std/cctype.hpp" +#include "asio/detail/std/cstdio.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/vector.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/impl/connect.hpp b/include/asio/impl/connect.hpp index 5dbc289426..888182db81 100644 --- a/include/asio/impl/connect.hpp +++ b/include/asio/impl/connect.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include +#include "asio/detail/std/algorithm.hpp" #include "asio/associator.hpp" #include "asio/detail/base_from_cancellation_state.hpp" #include "asio/detail/bind_handler.hpp" diff --git a/include/asio/impl/connect_pipe.ipp b/include/asio/impl/connect_pipe.ipp index eafa7d3984..f048b41b06 100644 --- a/include/asio/impl/connect_pipe.ipp +++ b/include/asio/impl/connect_pipe.ipp @@ -24,7 +24,7 @@ #include "asio/connect_pipe.hpp" #if defined(ASIO_HAS_IOCP) -# include +# include "asio/detail/std/cstdio.hpp" # if _WIN32_WINNT >= 0x601 # include # if !defined(ASIO_NO_DEFAULT_LINKED_LIBS) diff --git a/include/asio/impl/error.ipp b/include/asio/impl/error.ipp index 0bb7521e38..ad080f0746 100644 --- a/include/asio/impl/error.ipp +++ b/include/asio/impl/error.ipp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/error.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/impl/error_code.ipp b/include/asio/impl/error_code.ipp index 69ec24ea17..a6ba06f6ac 100644 --- a/include/asio/impl/error_code.ipp +++ b/include/asio/impl/error_code.ipp @@ -21,9 +21,9 @@ #elif defined(ASIO_WINDOWS_RUNTIME) # include #else -# include -# include -# include +# include "asio/detail/std/cerrno.hpp" +# include "asio/detail/std/cstring.hpp" +# include "asio/detail/std/string.hpp" #endif #include "asio/detail/local_free_on_block_exit.hpp" #include "asio/detail/socket_types.hpp" diff --git a/include/asio/impl/execution_context.hpp b/include/asio/impl/execution_context.hpp index d5fd5330b3..0340b14cc6 100644 --- a/include/asio/impl/execution_context.hpp +++ b/include/asio/impl/execution_context.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/handler_type_requirements.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/service_registry.hpp" diff --git a/include/asio/impl/executor.hpp b/include/asio/impl/executor.hpp index 1a3231836e..c254cb13d6 100644 --- a/include/asio/impl/executor.hpp +++ b/include/asio/impl/executor.hpp @@ -19,7 +19,7 @@ #if !defined(ASIO_NO_TS_EXECUTORS) -#include +#include "asio/detail/std/new.hpp" #include "asio/detail/atomic_count.hpp" #include "asio/detail/global.hpp" #include "asio/detail/memory.hpp" diff --git a/include/asio/impl/read.hpp b/include/asio/impl/read.hpp index 9585e5cc0d..ff60d589fd 100644 --- a/include/asio/impl/read.hpp +++ b/include/asio/impl/read.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include +#include "asio/detail/std/algorithm.hpp" #include "asio/associator.hpp" #include "asio/buffer.hpp" #include "asio/detail/array_fwd.hpp" diff --git a/include/asio/impl/read_at.hpp b/include/asio/impl/read_at.hpp index 36c3c9256c..283197849e 100644 --- a/include/asio/impl/read_at.hpp +++ b/include/asio/impl/read_at.hpp @@ -15,7 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include +#include "asio/detail/std/algorithm.hpp" #include "asio/associator.hpp" #include "asio/buffer.hpp" #include "asio/detail/array_fwd.hpp" diff --git a/include/asio/impl/read_until.hpp b/include/asio/impl/read_until.hpp index bbab121715..271ee64c7b 100644 --- a/include/asio/impl/read_until.hpp +++ b/include/asio/impl/read_until.hpp @@ -15,10 +15,10 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include -#include -#include -#include +#include "asio/detail/std/algorithm.hpp" +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/vector.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/associator.hpp" #include "asio/buffer.hpp" #include "asio/buffers_iterator.hpp" diff --git a/include/asio/impl/serial_port_base.ipp b/include/asio/impl/serial_port_base.ipp index f6f183040a..9f58b74b05 100644 --- a/include/asio/impl/serial_port_base.ipp +++ b/include/asio/impl/serial_port_base.ipp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_SERIAL_PORT) -#include +#include "asio/detail/std/stdexcept.hpp" #include "asio/error.hpp" #include "asio/serial_port_base.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/impl/spawn.hpp b/include/asio/impl/spawn.hpp index 5860ee897a..a9453cbb04 100644 --- a/include/asio/impl/spawn.hpp +++ b/include/asio/impl/spawn.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/associated_allocator.hpp" #include "asio/associated_cancellation_slot.hpp" #include "asio/associated_executor.hpp" diff --git a/include/asio/impl/thread_pool.ipp b/include/asio/impl/thread_pool.ipp index e39f07f81c..6a768dcfbf 100644 --- a/include/asio/impl/thread_pool.ipp +++ b/include/asio/impl/thread_pool.ipp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/stdexcept.hpp" #include "asio/thread_pool.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/impl/use_future.hpp b/include/asio/impl/use_future.hpp index 8812d2c26c..258e5d2934 100644 --- a/include/asio/impl/use_future.hpp +++ b/include/asio/impl/use_future.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/async_result.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/inline_or_executor.hpp b/include/asio/inline_or_executor.hpp index 86c315ff1e..bfbaadefa9 100644 --- a/include/asio/inline_or_executor.hpp +++ b/include/asio/inline_or_executor.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" #if !defined(ASIO_NO_EXCEPTIONS) -# include // use std::terminate(); +# include "asio/detail/std/exception.hpp" // use std::terminate(); #endif #include "asio/detail/non_const_lvalue.hpp" #include "asio/detail/type_traits.hpp" diff --git a/include/asio/io_context.hpp b/include/asio/io_context.hpp index 9254edb9a5..7b2c48b707 100644 --- a/include/asio/io_context.hpp +++ b/include/asio/io_context.hpp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/stdexcept.hpp" +#include "asio/detail/std/typeinfo.hpp" #include "asio/async_result.hpp" #include "asio/detail/chrono.hpp" #include "asio/detail/concurrency_hint.hpp" diff --git a/include/asio/ip/address.hpp b/include/asio/ip/address.hpp index 252c8d3a86..63f2b03b4e 100644 --- a/include/asio/ip/address.hpp +++ b/include/asio/ip/address.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/functional.hpp" +#include "asio/detail/std/string.hpp" #include "asio/detail/throw_exception.hpp" #include "asio/detail/string_view.hpp" #include "asio/detail/type_traits.hpp" @@ -27,7 +27,7 @@ #include "asio/ip/bad_address_cast.hpp" #if !defined(ASIO_NO_IOSTREAM) -# include +# include "asio/detail/std/iosfwd.hpp" #endif // !defined(ASIO_NO_IOSTREAM) #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/address_v4.hpp b/include/asio/ip/address_v4.hpp index e86e6a7a31..e246e504e0 100644 --- a/include/asio/ip/address_v4.hpp +++ b/include/asio/ip/address_v4.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/functional.hpp" +#include "asio/detail/std/string.hpp" #include "asio/detail/array.hpp" #include "asio/detail/cstdint.hpp" #include "asio/detail/socket_types.hpp" @@ -26,7 +26,7 @@ #include "asio/error_code.hpp" #if !defined(ASIO_NO_IOSTREAM) -# include +# include "asio/detail/std/iosfwd.hpp" #endif // !defined(ASIO_NO_IOSTREAM) #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/address_v6.hpp b/include/asio/ip/address_v6.hpp index 8e6444c44f..7a7d36ff38 100644 --- a/include/asio/ip/address_v6.hpp +++ b/include/asio/ip/address_v6.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/functional.hpp" +#include "asio/detail/std/string.hpp" #include "asio/detail/array.hpp" #include "asio/detail/cstdint.hpp" #include "asio/detail/socket_types.hpp" @@ -27,7 +27,7 @@ #include "asio/ip/address_v4.hpp" #if !defined(ASIO_NO_IOSTREAM) -# include +# include "asio/detail/std/iosfwd.hpp" #endif // !defined(ASIO_NO_IOSTREAM) #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/bad_address_cast.hpp b/include/asio/ip/bad_address_cast.hpp index 58ed754e34..c39bd53aa3 100644 --- a/include/asio/ip/bad_address_cast.hpp +++ b/include/asio/ip/bad_address_cast.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/basic_endpoint.hpp b/include/asio/ip/basic_endpoint.hpp index eff8e3572a..61ec47978f 100644 --- a/include/asio/ip/basic_endpoint.hpp +++ b/include/asio/ip/basic_endpoint.hpp @@ -16,13 +16,13 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/functional.hpp" #include "asio/detail/cstdint.hpp" #include "asio/ip/address.hpp" #include "asio/ip/detail/endpoint.hpp" #if !defined(ASIO_NO_IOSTREAM) -# include +# include "asio/detail/std/iosfwd.hpp" #endif // !defined(ASIO_NO_IOSTREAM) #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/basic_resolver.hpp b/include/asio/ip/basic_resolver.hpp index 4619a5a489..2603eca3b2 100644 --- a/include/asio/ip/basic_resolver.hpp +++ b/include/asio/ip/basic_resolver.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/ip/basic_resolver_entry.hpp b/include/asio/ip/basic_resolver_entry.hpp index ed9e35f6ce..069ca947c8 100644 --- a/include/asio/ip/basic_resolver_entry.hpp +++ b/include/asio/ip/basic_resolver_entry.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/detail/string_view.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/basic_resolver_iterator.hpp b/include/asio/ip/basic_resolver_iterator.hpp index 679cdfc101..fc6ea5c5c8 100644 --- a/include/asio/ip/basic_resolver_iterator.hpp +++ b/include/asio/ip/basic_resolver_iterator.hpp @@ -16,11 +16,11 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/iterator.hpp" +#include "asio/detail/std/string.hpp" +#include "asio/detail/std/vector.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/socket_types.hpp" diff --git a/include/asio/ip/basic_resolver_query.hpp b/include/asio/ip/basic_resolver_query.hpp index 53136288b1..a9c98b52de 100644 --- a/include/asio/ip/basic_resolver_query.hpp +++ b/include/asio/ip/basic_resolver_query.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/ip/resolver_query_base.hpp" diff --git a/include/asio/ip/basic_resolver_results.hpp b/include/asio/ip/basic_resolver_results.hpp index 0bbbb799ab..5e7468527b 100644 --- a/include/asio/ip/basic_resolver_results.hpp +++ b/include/asio/ip/basic_resolver_results.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/cstring.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/socket_types.hpp" #include "asio/ip/basic_resolver_iterator.hpp" diff --git a/include/asio/ip/detail/endpoint.hpp b/include/asio/ip/detail/endpoint.hpp index 85e4023288..9f70fe9800 100644 --- a/include/asio/ip/detail/endpoint.hpp +++ b/include/asio/ip/detail/endpoint.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/winsock_init.hpp" #include "asio/error_code.hpp" diff --git a/include/asio/ip/detail/impl/endpoint.ipp b/include/asio/ip/detail/impl/endpoint.ipp index 55ad31fea5..48e68e5695 100644 --- a/include/asio/ip/detail/impl/endpoint.ipp +++ b/include/asio/ip/detail/impl/endpoint.ipp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstring.hpp" #if !defined(ASIO_NO_IOSTREAM) -# include +# include "asio/detail/std/sstream.hpp" #endif // !defined(ASIO_NO_IOSTREAM) #include "asio/detail/socket_ops.hpp" #include "asio/detail/throw_error.hpp" diff --git a/include/asio/ip/detail/socket_option.hpp b/include/asio/ip/detail/socket_option.hpp index b2396bc965..eb3e2a5e82 100644 --- a/include/asio/ip/detail/socket_option.hpp +++ b/include/asio/ip/detail/socket_option.hpp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/stdexcept.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/ip/host_name.hpp b/include/asio/ip/host_name.hpp index 5425d87a3d..9a942bb434 100644 --- a/include/asio/ip/host_name.hpp +++ b/include/asio/ip/host_name.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/error_code.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/impl/address.ipp b/include/asio/ip/impl/address.ipp index fd9624829e..c510b9d963 100644 --- a/include/asio/ip/impl/address.ipp +++ b/include/asio/ip/impl/address.ipp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/throw_error.hpp" #include "asio/detail/throw_exception.hpp" #include "asio/error.hpp" diff --git a/include/asio/ip/impl/address_v4.ipp b/include/asio/ip/impl/address_v4.ipp index 77d452e000..7c20e1592e 100644 --- a/include/asio/ip/impl/address_v4.ipp +++ b/include/asio/ip/impl/address_v4.ipp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/climits.hpp" +#include "asio/detail/std/limits.hpp" +#include "asio/detail/std/stdexcept.hpp" #include "asio/error.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/throw_error.hpp" diff --git a/include/asio/ip/impl/address_v6.ipp b/include/asio/ip/impl/address_v6.ipp index 16c825a9b8..9cf2b48e6b 100644 --- a/include/asio/ip/impl/address_v6.ipp +++ b/include/asio/ip/impl/address_v6.ipp @@ -16,9 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include +#include "asio/detail/std/cstring.hpp" +#include "asio/detail/std/stdexcept.hpp" +#include "asio/detail/std/typeinfo.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/throw_error.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/ip/impl/network_v4.ipp b/include/asio/ip/impl/network_v4.ipp index 1538e37572..4ee6ad3ab1 100644 --- a/include/asio/ip/impl/network_v4.ipp +++ b/include/asio/ip/impl/network_v4.ipp @@ -17,10 +17,10 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include +#include "asio/detail/std/climits.hpp" +#include "asio/detail/std/cstdio.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/stdexcept.hpp" #include "asio/error.hpp" #include "asio/detail/throw_error.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/ip/impl/network_v6.ipp b/include/asio/ip/impl/network_v6.ipp index d58f49ed31..f7f94e56b1 100644 --- a/include/asio/ip/impl/network_v6.ipp +++ b/include/asio/ip/impl/network_v6.ipp @@ -17,10 +17,10 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include -#include -#include +#include "asio/detail/std/climits.hpp" +#include "asio/detail/std/cstdio.hpp" +#include "asio/detail/std/cstdlib.hpp" +#include "asio/detail/std/stdexcept.hpp" #include "asio/error.hpp" #include "asio/detail/throw_error.hpp" #include "asio/detail/throw_exception.hpp" diff --git a/include/asio/ip/multicast.hpp b/include/asio/ip/multicast.hpp index 530189b0d2..24fc424932 100644 --- a/include/asio/ip/multicast.hpp +++ b/include/asio/ip/multicast.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/ip/detail/socket_option.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/ip/network_v4.hpp b/include/asio/ip/network_v4.hpp index 82552ce05e..6f41bcb4a2 100644 --- a/include/asio/ip/network_v4.hpp +++ b/include/asio/ip/network_v4.hpp @@ -17,7 +17,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/detail/string_view.hpp" #include "asio/error_code.hpp" #include "asio/ip/address_v4_range.hpp" diff --git a/include/asio/ip/network_v6.hpp b/include/asio/ip/network_v6.hpp index 5fd10ec05a..7ea2d269a9 100644 --- a/include/asio/ip/network_v6.hpp +++ b/include/asio/ip/network_v6.hpp @@ -17,7 +17,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/detail/string_view.hpp" #include "asio/error_code.hpp" #include "asio/ip/address_v6_range.hpp" diff --git a/include/asio/ip/unicast.hpp b/include/asio/ip/unicast.hpp index 884c674960..b69c525cb2 100644 --- a/include/asio/ip/unicast.hpp +++ b/include/asio/ip/unicast.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/ip/detail/socket_option.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/is_contiguous_iterator.hpp b/include/asio/is_contiguous_iterator.hpp index 742aafbed7..d874754aa8 100644 --- a/include/asio/is_contiguous_iterator.hpp +++ b/include/asio/is_contiguous_iterator.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/iterator.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/local/basic_endpoint.hpp b/include/asio/local/basic_endpoint.hpp index 7b132984ee..3188f9f769 100644 --- a/include/asio/local/basic_endpoint.hpp +++ b/include/asio/local/basic_endpoint.hpp @@ -24,7 +24,7 @@ #include "asio/local/detail/endpoint.hpp" #if !defined(ASIO_NO_IOSTREAM) -# include +# include "asio/detail/std/iosfwd.hpp" #endif // !defined(ASIO_NO_IOSTREAM) #include "asio/detail/push_options.hpp" diff --git a/include/asio/local/detail/endpoint.hpp b/include/asio/local/detail/endpoint.hpp index 7251cfa9d9..e22520f947 100644 --- a/include/asio/local/detail/endpoint.hpp +++ b/include/asio/local/detail/endpoint.hpp @@ -20,8 +20,8 @@ #if defined(ASIO_HAS_LOCAL_SOCKETS) -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/string.hpp" #include "asio/detail/socket_types.hpp" #include "asio/detail/string_view.hpp" diff --git a/include/asio/local/detail/impl/endpoint.ipp b/include/asio/local/detail/impl/endpoint.ipp index 3a19c7be09..c857b9fc09 100644 --- a/include/asio/local/detail/impl/endpoint.ipp +++ b/include/asio/local/detail/impl/endpoint.ipp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_LOCAL_SOCKETS) -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/socket_ops.hpp" #include "asio/detail/throw_error.hpp" #include "asio/error.hpp" diff --git a/include/asio/multiple_exceptions.hpp b/include/asio/multiple_exceptions.hpp index e084741d7d..738a0e0cb7 100644 --- a/include/asio/multiple_exceptions.hpp +++ b/include/asio/multiple_exceptions.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/exception.hpp" #include "asio/detail/push_options.hpp" namespace asio { diff --git a/include/asio/posix/basic_descriptor.hpp b/include/asio/posix/basic_descriptor.hpp index 5007dddcb7..6bb41e8550 100644 --- a/include/asio/posix/basic_descriptor.hpp +++ b/include/asio/posix/basic_descriptor.hpp @@ -20,7 +20,7 @@ #if defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ || defined(GENERATING_DOCUMENTATION) -#include +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/handler_type_requirements.hpp" diff --git a/include/asio/prepend.hpp b/include/asio/prepend.hpp index c62acc27d8..88d532bea5 100644 --- a/include/asio/prepend.hpp +++ b/include/asio/prepend.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/tuple.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/read.hpp b/include/asio/read.hpp index 71c378a951..a4688997a2 100644 --- a/include/asio/read.hpp +++ b/include/asio/read.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/buffer.hpp" #include "asio/completion_condition.hpp" diff --git a/include/asio/read_at.hpp b/include/asio/read_at.hpp index 921833e644..96759dce87 100644 --- a/include/asio/read_at.hpp +++ b/include/asio/read_at.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/completion_condition.hpp" #include "asio/detail/cstdint.hpp" diff --git a/include/asio/read_until.hpp b/include/asio/read_until.hpp index 474dc61642..80a07b3aa5 100644 --- a/include/asio/read_until.hpp +++ b/include/asio/read_until.hpp @@ -16,8 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/string.hpp" #include "asio/async_result.hpp" #include "asio/buffer.hpp" #include "asio/detail/regex_fwd.hpp" diff --git a/include/asio/ssl/context.hpp b/include/asio/ssl/context.hpp index ac30767f10..2dd7e74419 100644 --- a/include/asio/ssl/context.hpp +++ b/include/asio/ssl/context.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/buffer.hpp" #include "asio/io_context.hpp" #include "asio/ssl/context_base.hpp" diff --git a/include/asio/ssl/detail/impl/openssl_init.ipp b/include/asio/ssl/detail/impl/openssl_init.ipp index 4fdd2c23a8..303c9b5ea7 100644 --- a/include/asio/ssl/detail/impl/openssl_init.ipp +++ b/include/asio/ssl/detail/impl/openssl_init.ipp @@ -17,7 +17,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/vector.hpp" #include "asio/detail/assert.hpp" #include "asio/detail/mutex.hpp" #include "asio/detail/tss_ptr.hpp" diff --git a/include/asio/ssl/detail/openssl_init.hpp b/include/asio/ssl/detail/openssl_init.hpp index 89beda0099..bcb818a271 100644 --- a/include/asio/ssl/detail/openssl_init.hpp +++ b/include/asio/ssl/detail/openssl_init.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/memory.hpp" #include "asio/detail/noncopyable.hpp" #include "asio/ssl/detail/openssl_types.hpp" diff --git a/include/asio/ssl/detail/password_callback.hpp b/include/asio/ssl/detail/password_callback.hpp index 2b7406b87a..e8b5ad481c 100644 --- a/include/asio/ssl/detail/password_callback.hpp +++ b/include/asio/ssl/detail/password_callback.hpp @@ -17,8 +17,8 @@ #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/string.hpp" #include "asio/ssl/context_base.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/ssl/host_name_verification.hpp b/include/asio/ssl/host_name_verification.hpp index fd776f5684..498163534d 100644 --- a/include/asio/ssl/host_name_verification.hpp +++ b/include/asio/ssl/host_name_verification.hpp @@ -17,7 +17,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/string.hpp" #include "asio/ssl/detail/openssl_types.hpp" #include "asio/ssl/verify_context.hpp" diff --git a/include/asio/ssl/impl/context.ipp b/include/asio/ssl/impl/context.ipp index bb88816eea..22834c39ef 100644 --- a/include/asio/ssl/impl/context.ipp +++ b/include/asio/ssl/impl/context.ipp @@ -18,7 +18,7 @@ #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstring.hpp" #include "asio/detail/throw_error.hpp" #include "asio/error.hpp" #include "asio/ssl/context.hpp" diff --git a/include/asio/ssl/impl/host_name_verification.ipp b/include/asio/ssl/impl/host_name_verification.ipp index ef311b3442..5f97796d7d 100644 --- a/include/asio/ssl/impl/host_name_verification.ipp +++ b/include/asio/ssl/impl/host_name_verification.ipp @@ -17,8 +17,8 @@ #include "asio/detail/config.hpp" -#include -#include +#include "asio/detail/std/cctype.hpp" +#include "asio/detail/std/cstring.hpp" #include "asio/ip/address.hpp" #include "asio/ssl/host_name_verification.hpp" #include "asio/ssl/detail/openssl_types.hpp" diff --git a/include/asio/system_error.hpp b/include/asio/system_error.hpp index 51b0cab98b..fdf8353e8a 100644 --- a/include/asio/system_error.hpp +++ b/include/asio/system_error.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/system_error.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/use_future.hpp b/include/asio/use_future.hpp index dc0dd2a237..7958cb3c4c 100644 --- a/include/asio/use_future.hpp +++ b/include/asio/use_future.hpp @@ -21,7 +21,7 @@ #if defined(ASIO_HAS_STD_FUTURE_CLASS) \ || defined(GENERATING_DOCUMENTATION) -#include +#include "asio/detail/std/memory.hpp" #include "asio/detail/type_traits.hpp" #include "asio/detail/push_options.hpp" diff --git a/include/asio/windows/basic_object_handle.hpp b/include/asio/windows/basic_object_handle.hpp index 7e8c5f41bc..90e7d876c0 100644 --- a/include/asio/windows/basic_object_handle.hpp +++ b/include/asio/windows/basic_object_handle.hpp @@ -21,7 +21,7 @@ #if defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ || defined(GENERATING_DOCUMENTATION) -#include +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/io_object_impl.hpp" diff --git a/include/asio/windows/basic_overlapped_handle.hpp b/include/asio/windows/basic_overlapped_handle.hpp index 050ec366ad..2923cce09c 100644 --- a/include/asio/windows/basic_overlapped_handle.hpp +++ b/include/asio/windows/basic_overlapped_handle.hpp @@ -21,8 +21,8 @@ || defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) \ || defined(GENERATING_DOCUMENTATION) -#include -#include +#include "asio/detail/std/cstddef.hpp" +#include "asio/detail/std/utility.hpp" #include "asio/any_io_executor.hpp" #include "asio/async_result.hpp" #include "asio/detail/io_object_impl.hpp" diff --git a/include/asio/write.hpp b/include/asio/write.hpp index af303eb301..0010a7ba64 100644 --- a/include/asio/write.hpp +++ b/include/asio/write.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/buffer.hpp" #include "asio/completion_condition.hpp" diff --git a/include/asio/write_at.hpp b/include/asio/write_at.hpp index 73be9e0f43..50d5b12d9a 100644 --- a/include/asio/write_at.hpp +++ b/include/asio/write_at.hpp @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" -#include +#include "asio/detail/std/cstddef.hpp" #include "asio/async_result.hpp" #include "asio/completion_condition.hpp" #include "asio/detail/cstdint.hpp" diff --git a/module/asio-gmf.h b/module/asio-gmf.h index 8511562e37..aa3a281ffc 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -1,4 +1,6 @@ #pragma once +#define ASIO_IN_GMF + #ifndef ASIO_STANDALONE # define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported #endif @@ -33,61 +35,12 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef ASIO_ENABLE_HANDLER_TRACKING -# include +#ifndef ASIO_ENABLE_HANDLER_TRACKING +# define ASIO_STD_CSTDARG_NO_INCLUDE #endif +#include "asio/detail/std/all.hpp" + #include #include @@ -164,3 +117,4 @@ # include # include #endif +#undef ASIO_IN_GMF diff --git a/module/asio.ixx b/module/asio.ixx index 9f656c5a08..2b086d9732 100644 --- a/module/asio.ixx +++ b/module/asio.ixx @@ -1,7 +1,4 @@ module; -#ifdef __MINGW64__ -# include // work around ODR problems with the C standard library -#endif #include "asio-gmf.h" @@ -13,6 +10,7 @@ export module asio; #ifdef ASIO_HAS_IMPORT_STD import std; #endif +#define ASIO_IN_MODULE_PURVIEW #ifdef _MSC_VER # pragma comment(lib, "asio.lib") diff --git a/module/generate_std_compat.cmake b/module/generate_std_compat.cmake new file mode 100644 index 0000000000..514140b399 --- /dev/null +++ b/module/generate_std_compat.cmake @@ -0,0 +1,394 @@ +# ........................................................................... +# generate_std_compat.cmake +# ........................................................................... +# +# USAGE: +# cmake -DMODE= [-DDRY_RUN=ON] -P module/generate_std_compat.cmake +# +# MODES: +# check - Scan consumer files for unprotected standard includes. +# generate-headers - Create/refresh wrapper headers in include/asio/detail/std/. +# update-includes - Replace
with "asio/detail/std/header.hpp" in consumers. +# update-content - Alias for generate-headers (idempotent content refresh). +# generate - Combined: generate-headers + update-includes. +# revert - Combined: revert-includes + remove-headers. +# revert-includes - Restore raw
includes in consumers. +# remove-headers - Delete generated wrapper headers and the detail/std/ directory. +# +# OPTIONS: +# -DDRY_RUN=ON - Simulate actions without modifying files. +# (Also supports -DDRY_MODE=ON or -DDRYRUN=ON). +# +# ........................................................................... +# Copyright (c) 2026 E. Can Özen (oezen.ce [at] gmail [dot] com) +# ........................................................................... + +cmake_minimum_required(VERSION 3.20) + +# --------------------------------------------------------------------------- +# Dry-run Flag Robustness (supports aliases to prevent accidental typos) +# --------------------------------------------------------------------------- +if(DRY_RUN OR DRY_MODE OR DRYRUN) + set(IS_DRY_RUN ON) + message(STATUS "!!! DRY RUN ENABLED !!! (No physical changes will be made)") +else() + set(IS_DRY_RUN OFF) +endif() + +# --------------------------------------------------------------------------- +# Configuration +# --------------------------------------------------------------------------- + +# Root of the asio source tree (this script lives in module/) +get_filename_component(ASIO_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) +set(STD_DIR "${ASIO_ROOT}/include/asio/detail/std") +set(INCLUDE_DIR "${ASIO_ROOT}/include/asio") + +# Standard C++ headers that MUST be included for macros (import std; does not provide macros) +set(MACRO_STD_HEADERS + cassert + cerrno + cfloat + climits + csetjmp + csignal + cstdarg + cstdint + ctime + cwchar + version +) + +# Standard C++ headers used in asio (keep sorted) +set(STD_HEADERS + algorithm + any + array + atomic + cassert + cctype + cerrno + chrono + climits + codecvt + concepts + condition_variable + coroutine + csignal + cstdarg + cstddef + cstdint + cstdio + cstdlib + cstring + deque + exception + functional + future + iosfwd + istream + iterator + limits + list + locale + memory + mutex + new + optional + ostream + source_location + sstream + stdexcept + streambuf + string + string_view + system_error + thread + tuple + type_traits + typeinfo + utility + variant + vector + version +) + +# --------------------------------------------------------------------------- +# Wrapper header template +# --------------------------------------------------------------------------- + +set(WRAPPER_TEMPLATE [[// +// detail/std/@HEADER@.hpp +// @TILDE_LINE@ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by generate_std_compat.cmake + +#if !defined(ASIO_MODULE) +// Traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_@HEADER_UPPER@_NO_INCLUDE +# include <@HEADER@> +# endif +# endif +#else +// Module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_@HEADER_UPPER@_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || @IS_MACRO_HEADER@ +# include <@HEADER@> +# endif +# endif +# endif +# endif +#endif +]]) + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- + +# Generate a tilde line of given length +function(make_tilde_line header out_var) + string(LENGTH "${header}" header_len) + math(EXPR tilde_count "${header_len} + 18") # len("detail/std/") + len(".hpp") + 3 extra + set(tildes "") + foreach(i RANGE 1 ${tilde_count}) + string(APPEND tildes "~") + endforeach() + set(${out_var} "${tildes}" PARENT_SCOPE) +endfunction() + +# Collect all .hpp and .ipp files under include/asio/, excluding detail/std/ +function(collect_source_files out_var) + file(GLOB_RECURSE all_files + "${INCLUDE_DIR}/*.hpp" + "${INCLUDE_DIR}/*.ipp" + ) + set(filtered "") + foreach(f ${all_files}) + string(FIND "${f}" "/detail/std/" pos) + if(pos EQUAL -1) + list(APPEND filtered "${f}") + endif() + endforeach() + set(${out_var} "${filtered}" PARENT_SCOPE) +endfunction() + +# Idempotent file write: only writes if content differs +function(write_if_changed file_path content) + set(existing_content "") + if(EXISTS "${file_path}") + file(READ "${file_path}" existing_content) + endif() + + if(NOT "${content}" STREQUAL "${existing_content}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] Would update: ${file_path}") + else() + file(WRITE "${file_path}" "${content}") + message(STATUS " Updated: ${file_path}") + endif() + endif() +endfunction() + +# --------------------------------------------------------------------------- +# ATOMIC MODES +# --------------------------------------------------------------------------- + +# MODE: check - Find unprotected standard includes +function(do_check) + message(STATUS "=== Checking for raw standard library includes ===") + collect_source_files(source_files) + set(found_any OFF) + + foreach(src ${source_files}) + file(READ "${src}" content) + # Match #include
+ string(REGEX MATCHALL "#[ \t]*include[ \t]*<([^>]+)>" matches "${content}") + foreach(match ${matches}) + string(REGEX REPLACE "#[ \t]*include[ \t]*<([^>]+)>" "\\1" header "${match}") + + # Check if it's in our STD_HEADERS list + list(FIND STD_HEADERS "${header}" idx) + if(NOT idx EQUAL -1) + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + message(WARNING " Found raw include <${header}> in ${rel}") + set(found_any ON) + endif() + endforeach() + endforeach() + + if(NOT found_any) + message(STATUS " No raw standard includes found. Migration looks complete.") + endif() +endfunction() + +# MODE: generate-headers - Create detail/std/*.hpp +function(do_generate_headers) + message(STATUS "=== Generating wrapper headers ===") + if(NOT IS_DRY_RUN) + file(MAKE_DIRECTORY "${STD_DIR}") + endif() + + foreach(header ${STD_HEADERS}) + set(out_file "${STD_DIR}/${header}.hpp") + make_tilde_line("${header}" tilde_line) + string(TOUPPER "${header}" header_upper) + + set(is_macro "0") + list(FIND MACRO_STD_HEADERS "${header}" idx) + if(NOT idx EQUAL -1) + set(is_macro "1") + endif() + + string(REPLACE "@HEADER@" "${header}" content "${WRAPPER_TEMPLATE}") + string(REPLACE "@HEADER_UPPER@" "${header_upper}" content "${content}") + string(REPLACE "@TILDE_LINE@" "${tilde_line}" content "${content}") + string(REPLACE "@IS_MACRO_HEADER@" "${is_macro}" content "${content}") + + write_if_changed("${out_file}" "${content}") + endforeach() + + # Generate central all.hpp + set(all_hpp_file "${STD_DIR}/all.hpp") + set(all_hpp_content "//\n// detail/std/all.hpp\n// ~~~~~~~~~~~~~~~~~~~\n//\n") + string(APPEND all_hpp_content "// auto-generated by generate_std_compat.cmake\n\n") + string(APPEND all_hpp_content "#ifndef ASIO_DETAIL_STD_ALL_HPP\n#define ASIO_DETAIL_STD_ALL_HPP\n\n") + foreach(header ${STD_HEADERS}) + string(APPEND all_hpp_content "#include \"asio/detail/std/${header}.hpp\"\n") + endforeach() + string(APPEND all_hpp_content "\n#endif // ASIO_DETAIL_STD_ALL_HPP\n") + + write_if_changed("${all_hpp_file}" "${all_hpp_content}") +endfunction() + +# MODE: update-includes - Replace
with "asio/detail/std/header.hpp" +function(do_update_includes) + message(STATUS "=== Updating consumer includes ===") + collect_source_files(source_files) + set(modified_count 0) + + foreach(src ${source_files}) + file(READ "${src}" content) + set(original "${content}") + + foreach(header ${STD_HEADERS}) + string(FIND "${content}" "<${header}>" pos) + if(NOT pos EQUAL -1) + string(REGEX REPLACE + "(#[ \t]*include[ \t]+)<${header}>" + "\\1\"asio/detail/std/${header}.hpp\"" + content "${content}" + ) + endif() + endforeach() + + if(NOT "${content}" STREQUAL "${original}") + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] Would update: ${rel}") + else() + file(WRITE "${src}" "${content}") + message(STATUS " Updated: ${rel}") + endif() + math(EXPR modified_count "${modified_count} + 1") + endif() + endforeach() + message(STATUS " Processed consumer files. Modified: ${modified_count}") +endfunction() + +# MODE: revert-includes - Restore
+function(do_revert_includes) + message(STATUS "=== Reverting consumer includes ===") + collect_source_files(source_files) + set(modified_count 0) + + foreach(src ${source_files}) + file(READ "${src}" content) + set(original "${content}") + + foreach(header ${STD_HEADERS}) + string(FIND "${content}" "\"asio/detail/std/${header}.hpp\"" pos) + if(NOT pos EQUAL -1) + string(REGEX REPLACE + "(#[ \t]*include[ \t]+)\"asio/detail/std/${header}\\.hpp\"" + "\\1<${header}>" + content "${content}" + ) + endif() + endforeach() + + if(NOT "${content}" STREQUAL "${original}") + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] Would revert: ${rel}") + else() + file(WRITE "${src}" "${content}") + message(STATUS " Reverted: ${rel}") + endif() + math(EXPR modified_count "${modified_count} + 1") + endif() + endforeach() + message(STATUS " Reverted ${modified_count} files.") +endfunction() + +# MODE: remove-headers - Delete detail/std/*.hpp +function(do_remove_headers) + message(STATUS "=== Removing wrapper headers ===") + if(NOT EXISTS "${STD_DIR}") + message(STATUS " Directory ${STD_DIR} does not exist. Nothing to do.") + return() + endif() + + file(GLOB all_wrappers "${STD_DIR}/*.hpp") + set(removed_count 0) + foreach(f ${all_wrappers}) + if(IS_DRY_RUN) + message(STATUS " [dry-run] Would remove: ${f}") + else() + file(REMOVE "${f}") + message(STATUS " Removed: ${f}") + endif() + math(EXPR removed_count "${removed_count} + 1") + endforeach() + + if(NOT IS_DRY_RUN) + file(REMOVE_RECURSE "${STD_DIR}") + message(STATUS " Removed directory: ${STD_DIR}") + endif() + message(STATUS " Removed ${removed_count} files.") +endfunction() + +# --------------------------------------------------------------------------- +# Entry point +# --------------------------------------------------------------------------- + +if(NOT DEFINED MODE) + message(FATAL_ERROR "MODE not defined (check, generate-headers, update-includes, generate, revert, etc.)") +endif() + +if(MODE STREQUAL "check") + do_check() +elseif(MODE STREQUAL "generate-headers" OR MODE STREQUAL "update-content") + do_generate_headers() +elseif(MODE STREQUAL "update-includes") + do_update_includes() +elseif(MODE STREQUAL "generate" OR MODE STREQUAL "update") + do_generate_headers() + do_update_includes() +elseif(MODE STREQUAL "revert") + do_revert_includes() + do_remove_headers() +elseif(MODE STREQUAL "revert-includes") + do_revert_includes() +elseif(MODE STREQUAL "remove-headers") + do_remove_headers() +else() + message(FATAL_ERROR "Unknown MODE: ${MODE}") +endif() diff --git a/module/module_compat.cmake b/module/module_compat.cmake new file mode 100644 index 0000000000..d629420c60 --- /dev/null +++ b/module/module_compat.cmake @@ -0,0 +1,338 @@ +# ........................................................................... +# module_compat.cmake +# ........................................................................... +# +# usage: cmake -DMODE= [-DDRY_RUN=ON] -P module/module_compat.cmake +# +# modes: +# check - scan consumer files for unprotected standard includes. +# generate-headers - create/refresh wrapper headers in include/asio/detail/std/. +# update-includes - replace
with "asio/detail/std/header.hpp" in consumers. +# update-content - alias for generate-headers (idempotent content refresh). +# generate - combined: generate-headers + update-includes. +# revert - combined: revert-includes + remove-headers. +# revert-includes - restore raw
includes in consumers. +# remove-headers - delete generated wrapper headers and the detail/std/ directory. +# +# options: +# -DDRY_RUN=ON - simulate actions without modifying files. +# (also supports -DDRY_MODE=ON or -DDRYRUN=ON). +# +# ........................................................................... +# copyright (c) 2026 E. Can Özen (oezen.ce [at] gmail [dot] com) +# ........................................................................... + +cmake_minimum_required(VERSION 3.20) + +# --------------------------------------------------------------------------- +# dry-run support (aliases: DRY_RUN, DRY_MODE, DRYRUN) +# --------------------------------------------------------------------------- +if(DRY_RUN + OR DRY_MODE + OR DRYRUN) + set(IS_DRY_RUN ON) + message(STATUS "[dry-run] enabled, no files will be modified") +else() + set(IS_DRY_RUN OFF) +endif() + +# --------------------------------------------------------------------------- +# configuration +# --------------------------------------------------------------------------- + +# asio root (script lives in module/) +get_filename_component(ASIO_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) +set(STD_DIR "${ASIO_ROOT}/include/asio/detail/std") +set(INCLUDE_DIR "${ASIO_ROOT}/include/asio") + +# standard c++ headers that must be included for macros (import std; does not provide macros) +set(MACRO_STD_HEADERS + cassert cerrno cfloat climits + csetjmp csignal cstdarg cstdint + ctime cwchar version) + +# standard c++ headers used in asio (keep sorted) +set(STD_HEADERS + algorithm any array atomic cassert cctype + cerrno chrono climits codecvt concepts condition_variable + coroutine csignal cstdarg cstddef cstdint cstdio + cstdlib cstring deque exception functional future + iosfwd istream iterator limits list locale + memory mutex new optional ostream source_location + sstream stdexcept streambuf string string_view system_error + thread tuple type_traits typeinfo utility variant + vector version) + +# --------------------------------------------------------------------------- +# wrapper header template +# --------------------------------------------------------------------------- + +set(WRAPPER_TEMPLATE + [[// +// detail/std/@HEADER@.hpp +// @TILDE_LINE@ +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// auto-generated by module_compat.cmake + +#if !defined(ASIO_MODULE) +// traditional (header-only) path. +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_@HEADER_UPPER@_NO_INCLUDE +# include <@HEADER@> +# endif +# endif +#else +// module path. +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +import std; +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_@HEADER_UPPER@_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || @IS_MACRO_HEADER@ +# include <@HEADER@> +# endif +# endif +# endif +# endif +#endif +]]) + +# --------------------------------------------------------------------------- +# helpers +# --------------------------------------------------------------------------- + +# generate a tilde underline matching "detail/std/
.hpp" length +function(make_tilde_line header out_var) + string(LENGTH "${header}" header_len) + math(EXPR tilde_count "${header_len} + 18") + set(tildes "") + foreach(i RANGE 1 ${tilde_count}) + string(APPEND tildes "~") + endforeach() + set(${out_var} + "${tildes}" + PARENT_SCOPE) +endfunction() + +# collect consumer source files, excluding generated detail/std/ +function(collect_source_files out_var) + file(GLOB_RECURSE all_files "${INCLUDE_DIR}/*.hpp" "${INCLUDE_DIR}/*.ipp") + set(filtered "") + foreach(f ${all_files}) + string(FIND "${f}" "/detail/std/" pos) + if(pos EQUAL -1) + list(APPEND filtered "${f}") + endif() + endforeach() + set(${out_var} + "${filtered}" + PARENT_SCOPE) +endfunction() + +# write only if content changed +function(write_if_changed file_path content) + set(existing_content "") + if(EXISTS "${file_path}") + file(READ "${file_path}" existing_content) + endif() + + if(NOT "${content}" STREQUAL "${existing_content}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] would update: ${file_path}") + else() + file(WRITE "${file_path}" "${content}") + message(STATUS " updated: ${file_path}") + endif() + endif() +endfunction() + +# mode: check - find unprotected standard includes +function(do_check) + message(STATUS "=== checking for raw standard library includes ===") + collect_source_files(source_files) + set(found_any OFF) + + foreach(src ${source_files}) + file(READ "${src}" content) + string(REGEX MATCHALL "#[ \t]*include[ \t]*<([^>]+)>" matches "${content}") + foreach(match ${matches}) + string(REGEX REPLACE "#[ \t]*include[ \t]*<([^>]+)>" "\\1" header + "${match}") + list(FIND STD_HEADERS "${header}" idx) + if(NOT idx EQUAL -1) + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + message(WARNING " found raw include <${header}> in ${rel}") + set(found_any ON) + endif() + endforeach() + endforeach() + + if(NOT found_any) + message(STATUS " no raw standard includes found.") + endif() +endfunction() + +# mode: generate-headers - create detail/std/*.hpp +function(do_generate_headers) + message(STATUS "=== generating wrapper headers ===") + if(NOT IS_DRY_RUN) + file(MAKE_DIRECTORY "${STD_DIR}") + endif() + + foreach(header ${STD_HEADERS}) + set(out_file "${STD_DIR}/${header}.hpp") + make_tilde_line("${header}" tilde_line) + string(TOUPPER "${header}" header_upper) + + set(is_macro "0") + list(FIND MACRO_STD_HEADERS "${header}" idx) + if(NOT idx EQUAL -1) + set(is_macro "1") + endif() + + string(REPLACE "@HEADER@" "${header}" content "${WRAPPER_TEMPLATE}") + string(REPLACE "@HEADER_UPPER@" "${header_upper}" content "${content}") + string(REPLACE "@TILDE_LINE@" "${tilde_line}" content "${content}") + string(REPLACE "@IS_MACRO_HEADER@" "${is_macro}" content "${content}") + + write_if_changed("${out_file}" "${content}") + endforeach() + + # generate central all.hpp + set(all_hpp_file "${STD_DIR}/all.hpp") + set(all_hpp_content "//\n// detail/std/all.hpp\n// ~~~~~~~~~~~~~~~~~~~\n//\n") + string(APPEND all_hpp_content "// auto-generated by module_compat.cmake\n\n") + string(APPEND all_hpp_content + "#ifndef ASIO_DETAIL_STD_ALL_HPP\n#define ASIO_DETAIL_STD_ALL_HPP\n\n") + foreach(header ${STD_HEADERS}) + string(APPEND all_hpp_content + "#include \"asio/detail/std/${header}.hpp\"\n") + endforeach() + string(APPEND all_hpp_content "\n#endif // ASIO_DETAIL_STD_ALL_HPP\n") + + write_if_changed("${all_hpp_file}" "${all_hpp_content}") +endfunction() + +# mode: update-includes - replace
with "asio/detail/std/header.hpp" +function(do_update_includes) + message(STATUS "=== updating consumer includes ===") + collect_source_files(source_files) + set(modified_count 0) + + foreach(src ${source_files}) + file(READ "${src}" content) + set(original "${content}") + + foreach(header ${STD_HEADERS}) + string(FIND "${content}" "<${header}>" pos) + if(NOT pos EQUAL -1) + string( + REGEX + REPLACE "(#[ \t]*include[ \t]+)<${header}>" + "\\1\"asio/detail/std/${header}.hpp\"" content "${content}") + endif() + endforeach() + + if(NOT "${content}" STREQUAL "${original}") + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] would update: ${rel}") + else() + file(WRITE "${src}" "${content}") + message(STATUS " updated: ${rel}") + endif() + math(EXPR modified_count "${modified_count} + 1") + endif() + endforeach() + message(STATUS " processed consumer files. modified: ${modified_count}") +endfunction() + +# mode: revert-includes - restore
+function(do_revert_includes) + message(STATUS "=== reverting consumer includes ===") + collect_source_files(source_files) + set(modified_count 0) + + foreach(src ${source_files}) + file(READ "${src}" content) + set(original "${content}") + + foreach(header ${STD_HEADERS}) + string(FIND "${content}" "\"asio/detail/std/${header}.hpp\"" pos) + if(NOT pos EQUAL -1) + string( + REGEX + REPLACE "(#[ \t]*include[ \t]+)\"asio/detail/std/${header}\\.hpp\"" + "\\1<${header}>" content "${content}") + endif() + endforeach() + + if(NOT "${content}" STREQUAL "${original}") + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] would revert: ${rel}") + else() + file(WRITE "${src}" "${content}") + message(STATUS " reverted: ${rel}") + endif() + math(EXPR modified_count "${modified_count} + 1") + endif() + endforeach() + message(STATUS " reverted ${modified_count} files.") +endfunction() + +# mode: remove-headers - delete detail/std/*.hpp +function(do_remove_headers) + message(STATUS "=== removing wrapper headers ===") + if(NOT EXISTS "${STD_DIR}") + message(STATUS " directory ${STD_DIR} does not exist. nothing to do.") + return() + endif() + + file(GLOB all_wrappers "${STD_DIR}/*.hpp") + list(LENGTH all_wrappers removed_count) + if(IS_DRY_RUN) + foreach(f ${all_wrappers}) + message(STATUS " [dry-run] would remove: ${f}") + endforeach() + message(STATUS " [dry-run] would remove directory: ${STD_DIR}") + else() + file(REMOVE_RECURSE "${STD_DIR}") + message(STATUS " removed directory: ${STD_DIR}") + endif() + message(STATUS " ${removed_count} files.") +endfunction() + +# --------------------------------------------------------------------------- +# entry point +# --------------------------------------------------------------------------- + +if(NOT DEFINED MODE) + message( + FATAL_ERROR + "MODE not defined (check, generate-headers, update-includes, generate, revert, etc.)" + ) +endif() + +if(MODE STREQUAL "check") + do_check() +elseif(MODE STREQUAL "generate-headers" OR MODE STREQUAL "update-content") + do_generate_headers() +elseif(MODE STREQUAL "update-includes") + do_update_includes() +elseif(MODE STREQUAL "generate" OR MODE STREQUAL "update") + do_generate_headers() + do_update_includes() +elseif(MODE STREQUAL "revert") + do_revert_includes() + do_remove_headers() +elseif(MODE STREQUAL "revert-includes") + do_revert_includes() +elseif(MODE STREQUAL "remove-headers") + do_remove_headers() +else() + message(FATAL_ERROR "unknown MODE: ${MODE}") +endif() From e4c916f368bbefc3a37ad1f3a1ae5ff6cd0a3ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Fri, 6 Mar 2026 23:29:40 +0300 Subject: [PATCH 41/57] remove redundant/duplicate cmake script --- module/generate_std_compat.cmake | 394 ------------------------------- 1 file changed, 394 deletions(-) delete mode 100644 module/generate_std_compat.cmake diff --git a/module/generate_std_compat.cmake b/module/generate_std_compat.cmake deleted file mode 100644 index 514140b399..0000000000 --- a/module/generate_std_compat.cmake +++ /dev/null @@ -1,394 +0,0 @@ -# ........................................................................... -# generate_std_compat.cmake -# ........................................................................... -# -# USAGE: -# cmake -DMODE= [-DDRY_RUN=ON] -P module/generate_std_compat.cmake -# -# MODES: -# check - Scan consumer files for unprotected standard includes. -# generate-headers - Create/refresh wrapper headers in include/asio/detail/std/. -# update-includes - Replace
with "asio/detail/std/header.hpp" in consumers. -# update-content - Alias for generate-headers (idempotent content refresh). -# generate - Combined: generate-headers + update-includes. -# revert - Combined: revert-includes + remove-headers. -# revert-includes - Restore raw
includes in consumers. -# remove-headers - Delete generated wrapper headers and the detail/std/ directory. -# -# OPTIONS: -# -DDRY_RUN=ON - Simulate actions without modifying files. -# (Also supports -DDRY_MODE=ON or -DDRYRUN=ON). -# -# ........................................................................... -# Copyright (c) 2026 E. Can Özen (oezen.ce [at] gmail [dot] com) -# ........................................................................... - -cmake_minimum_required(VERSION 3.20) - -# --------------------------------------------------------------------------- -# Dry-run Flag Robustness (supports aliases to prevent accidental typos) -# --------------------------------------------------------------------------- -if(DRY_RUN OR DRY_MODE OR DRYRUN) - set(IS_DRY_RUN ON) - message(STATUS "!!! DRY RUN ENABLED !!! (No physical changes will be made)") -else() - set(IS_DRY_RUN OFF) -endif() - -# --------------------------------------------------------------------------- -# Configuration -# --------------------------------------------------------------------------- - -# Root of the asio source tree (this script lives in module/) -get_filename_component(ASIO_ROOT "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE) -set(STD_DIR "${ASIO_ROOT}/include/asio/detail/std") -set(INCLUDE_DIR "${ASIO_ROOT}/include/asio") - -# Standard C++ headers that MUST be included for macros (import std; does not provide macros) -set(MACRO_STD_HEADERS - cassert - cerrno - cfloat - climits - csetjmp - csignal - cstdarg - cstdint - ctime - cwchar - version -) - -# Standard C++ headers used in asio (keep sorted) -set(STD_HEADERS - algorithm - any - array - atomic - cassert - cctype - cerrno - chrono - climits - codecvt - concepts - condition_variable - coroutine - csignal - cstdarg - cstddef - cstdint - cstdio - cstdlib - cstring - deque - exception - functional - future - iosfwd - istream - iterator - limits - list - locale - memory - mutex - new - optional - ostream - source_location - sstream - stdexcept - streambuf - string - string_view - system_error - thread - tuple - type_traits - typeinfo - utility - variant - vector - version -) - -# --------------------------------------------------------------------------- -# Wrapper header template -# --------------------------------------------------------------------------- - -set(WRAPPER_TEMPLATE [[// -// detail/std/@HEADER@.hpp -// @TILDE_LINE@ -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// auto-generated by generate_std_compat.cmake - -#if !defined(ASIO_MODULE) -// Traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_@HEADER_UPPER@_NO_INCLUDE -# include <@HEADER@> -# endif -# endif -#else -// Module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) -import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_@HEADER_UPPER@_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || @IS_MACRO_HEADER@ -# include <@HEADER@> -# endif -# endif -# endif -# endif -#endif -]]) - -# --------------------------------------------------------------------------- -# Helpers -# --------------------------------------------------------------------------- - -# Generate a tilde line of given length -function(make_tilde_line header out_var) - string(LENGTH "${header}" header_len) - math(EXPR tilde_count "${header_len} + 18") # len("detail/std/") + len(".hpp") + 3 extra - set(tildes "") - foreach(i RANGE 1 ${tilde_count}) - string(APPEND tildes "~") - endforeach() - set(${out_var} "${tildes}" PARENT_SCOPE) -endfunction() - -# Collect all .hpp and .ipp files under include/asio/, excluding detail/std/ -function(collect_source_files out_var) - file(GLOB_RECURSE all_files - "${INCLUDE_DIR}/*.hpp" - "${INCLUDE_DIR}/*.ipp" - ) - set(filtered "") - foreach(f ${all_files}) - string(FIND "${f}" "/detail/std/" pos) - if(pos EQUAL -1) - list(APPEND filtered "${f}") - endif() - endforeach() - set(${out_var} "${filtered}" PARENT_SCOPE) -endfunction() - -# Idempotent file write: only writes if content differs -function(write_if_changed file_path content) - set(existing_content "") - if(EXISTS "${file_path}") - file(READ "${file_path}" existing_content) - endif() - - if(NOT "${content}" STREQUAL "${existing_content}") - if(IS_DRY_RUN) - message(STATUS " [dry-run] Would update: ${file_path}") - else() - file(WRITE "${file_path}" "${content}") - message(STATUS " Updated: ${file_path}") - endif() - endif() -endfunction() - -# --------------------------------------------------------------------------- -# ATOMIC MODES -# --------------------------------------------------------------------------- - -# MODE: check - Find unprotected standard includes -function(do_check) - message(STATUS "=== Checking for raw standard library includes ===") - collect_source_files(source_files) - set(found_any OFF) - - foreach(src ${source_files}) - file(READ "${src}" content) - # Match #include
- string(REGEX MATCHALL "#[ \t]*include[ \t]*<([^>]+)>" matches "${content}") - foreach(match ${matches}) - string(REGEX REPLACE "#[ \t]*include[ \t]*<([^>]+)>" "\\1" header "${match}") - - # Check if it's in our STD_HEADERS list - list(FIND STD_HEADERS "${header}" idx) - if(NOT idx EQUAL -1) - file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") - message(WARNING " Found raw include <${header}> in ${rel}") - set(found_any ON) - endif() - endforeach() - endforeach() - - if(NOT found_any) - message(STATUS " No raw standard includes found. Migration looks complete.") - endif() -endfunction() - -# MODE: generate-headers - Create detail/std/*.hpp -function(do_generate_headers) - message(STATUS "=== Generating wrapper headers ===") - if(NOT IS_DRY_RUN) - file(MAKE_DIRECTORY "${STD_DIR}") - endif() - - foreach(header ${STD_HEADERS}) - set(out_file "${STD_DIR}/${header}.hpp") - make_tilde_line("${header}" tilde_line) - string(TOUPPER "${header}" header_upper) - - set(is_macro "0") - list(FIND MACRO_STD_HEADERS "${header}" idx) - if(NOT idx EQUAL -1) - set(is_macro "1") - endif() - - string(REPLACE "@HEADER@" "${header}" content "${WRAPPER_TEMPLATE}") - string(REPLACE "@HEADER_UPPER@" "${header_upper}" content "${content}") - string(REPLACE "@TILDE_LINE@" "${tilde_line}" content "${content}") - string(REPLACE "@IS_MACRO_HEADER@" "${is_macro}" content "${content}") - - write_if_changed("${out_file}" "${content}") - endforeach() - - # Generate central all.hpp - set(all_hpp_file "${STD_DIR}/all.hpp") - set(all_hpp_content "//\n// detail/std/all.hpp\n// ~~~~~~~~~~~~~~~~~~~\n//\n") - string(APPEND all_hpp_content "// auto-generated by generate_std_compat.cmake\n\n") - string(APPEND all_hpp_content "#ifndef ASIO_DETAIL_STD_ALL_HPP\n#define ASIO_DETAIL_STD_ALL_HPP\n\n") - foreach(header ${STD_HEADERS}) - string(APPEND all_hpp_content "#include \"asio/detail/std/${header}.hpp\"\n") - endforeach() - string(APPEND all_hpp_content "\n#endif // ASIO_DETAIL_STD_ALL_HPP\n") - - write_if_changed("${all_hpp_file}" "${all_hpp_content}") -endfunction() - -# MODE: update-includes - Replace
with "asio/detail/std/header.hpp" -function(do_update_includes) - message(STATUS "=== Updating consumer includes ===") - collect_source_files(source_files) - set(modified_count 0) - - foreach(src ${source_files}) - file(READ "${src}" content) - set(original "${content}") - - foreach(header ${STD_HEADERS}) - string(FIND "${content}" "<${header}>" pos) - if(NOT pos EQUAL -1) - string(REGEX REPLACE - "(#[ \t]*include[ \t]+)<${header}>" - "\\1\"asio/detail/std/${header}.hpp\"" - content "${content}" - ) - endif() - endforeach() - - if(NOT "${content}" STREQUAL "${original}") - file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") - if(IS_DRY_RUN) - message(STATUS " [dry-run] Would update: ${rel}") - else() - file(WRITE "${src}" "${content}") - message(STATUS " Updated: ${rel}") - endif() - math(EXPR modified_count "${modified_count} + 1") - endif() - endforeach() - message(STATUS " Processed consumer files. Modified: ${modified_count}") -endfunction() - -# MODE: revert-includes - Restore
-function(do_revert_includes) - message(STATUS "=== Reverting consumer includes ===") - collect_source_files(source_files) - set(modified_count 0) - - foreach(src ${source_files}) - file(READ "${src}" content) - set(original "${content}") - - foreach(header ${STD_HEADERS}) - string(FIND "${content}" "\"asio/detail/std/${header}.hpp\"" pos) - if(NOT pos EQUAL -1) - string(REGEX REPLACE - "(#[ \t]*include[ \t]+)\"asio/detail/std/${header}\\.hpp\"" - "\\1<${header}>" - content "${content}" - ) - endif() - endforeach() - - if(NOT "${content}" STREQUAL "${original}") - file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") - if(IS_DRY_RUN) - message(STATUS " [dry-run] Would revert: ${rel}") - else() - file(WRITE "${src}" "${content}") - message(STATUS " Reverted: ${rel}") - endif() - math(EXPR modified_count "${modified_count} + 1") - endif() - endforeach() - message(STATUS " Reverted ${modified_count} files.") -endfunction() - -# MODE: remove-headers - Delete detail/std/*.hpp -function(do_remove_headers) - message(STATUS "=== Removing wrapper headers ===") - if(NOT EXISTS "${STD_DIR}") - message(STATUS " Directory ${STD_DIR} does not exist. Nothing to do.") - return() - endif() - - file(GLOB all_wrappers "${STD_DIR}/*.hpp") - set(removed_count 0) - foreach(f ${all_wrappers}) - if(IS_DRY_RUN) - message(STATUS " [dry-run] Would remove: ${f}") - else() - file(REMOVE "${f}") - message(STATUS " Removed: ${f}") - endif() - math(EXPR removed_count "${removed_count} + 1") - endforeach() - - if(NOT IS_DRY_RUN) - file(REMOVE_RECURSE "${STD_DIR}") - message(STATUS " Removed directory: ${STD_DIR}") - endif() - message(STATUS " Removed ${removed_count} files.") -endfunction() - -# --------------------------------------------------------------------------- -# Entry point -# --------------------------------------------------------------------------- - -if(NOT DEFINED MODE) - message(FATAL_ERROR "MODE not defined (check, generate-headers, update-includes, generate, revert, etc.)") -endif() - -if(MODE STREQUAL "check") - do_check() -elseif(MODE STREQUAL "generate-headers" OR MODE STREQUAL "update-content") - do_generate_headers() -elseif(MODE STREQUAL "update-includes") - do_update_includes() -elseif(MODE STREQUAL "generate" OR MODE STREQUAL "update") - do_generate_headers() - do_update_includes() -elseif(MODE STREQUAL "revert") - do_revert_includes() - do_remove_headers() -elseif(MODE STREQUAL "revert-includes") - do_revert_includes() -elseif(MODE STREQUAL "remove-headers") - do_remove_headers() -else() - message(FATAL_ERROR "Unknown MODE: ${MODE}") -endif() From 0fb34e911d96bbdd7fa5321941e7c7143721f7e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Fri, 6 Mar 2026 23:20:49 +0300 Subject: [PATCH 42/57] modernize cmake build system and introduce cross-platform presets - add CMakePresets.json with initial configurations for MSVC, GCC, and Clang [WIP] - extract experimental 'import std' logic into cmake/enable_import_std.cmake - clean up root CMakeLists.txt by moving fragile, hardcoded compiler flags into presets - adapts CMakeLists.txt to changes accordingly --- CMakeLists.txt | 85 +------ CMakePresets.json | 422 ++++++++++++++++++++++++++++++++++ cmake/enable_import_std.cmake | 35 +++ src/examples/CMakeLists.txt | 15 +- 4 files changed, 482 insertions(+), 75 deletions(-) create mode 100644 CMakePresets.json create mode 100644 cmake/enable_import_std.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dde8331f8..667d940dd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,8 @@ cmake_minimum_required(VERSION 3.30...4.3) # gersemi: off -if(CMAKE_CXX_STANDARD LESS 20) - message( FATAL_ERROR "At least C++20 required but have ${CMAKE_CXX_STANDARD}") -endif() -# --------------------------------------------------------------------------- -# check if import std; is supported by CMAKE_CXX_COMPILER -# --------------------------------------------------------------------------- -if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.3 AND CMAKE_VERSION VERSION_LESS 4.4) - set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") -elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.3) - set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") -endif() -# gersemi: on +include(cmake/enable_import_std.cmake) project( asio @@ -22,15 +11,6 @@ project( LANGUAGES CXX ) -if(NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 23) -endif() -set(CMAKE_CXX_EXTENSIONS ON) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CMAKE_INSTALL_MESSAGE LAZY) -set(CMAKE_SKIP_TEST_ALL_DEPENDENCY OFF) # --------------------------------------------------------------------------- # Ensure binaries find the correct libstdc++ at runtime when using a @@ -69,7 +49,7 @@ file( # asio interface library #============================== add_library(asio_header INTERFACE) -add_library(asio::asio_header ALIAS asio_header) +add_library(asio::asio-header ALIAS asio_header) target_sources( asio_header INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${_asio_implementation} @@ -100,7 +80,7 @@ target_sources( FILE_SET modules TYPE CXX_MODULES BASE_DIRS module FILES module/asio.ixx FILE_SET HEADERS BASE_DIRS include FILES ${_public_headers} ) -target_compile_features(asio PUBLIC cxx_std_${CMAKE_CXX_STANDARD}) +target_compile_features(asio PRIVATE cxx_std_${CMAKE_CXX_STANDARD}) set_target_properties( asio PROPERTIES VERIFY_INTERFACE_HEADER_SETS ${PROJECT_IS_TOP_LEVEL} @@ -109,28 +89,11 @@ target_link_libraries(asio PUBLIC asio_header) option(ASIO_IMPORT_STD "Enable 'import std;' support for ASIO module" OFF) if(ASIO_IMPORT_STD) - message( - STATUS - "CMAKE_CXX_COMPILER_IMPORT_STD=${CMAKE_CXX_COMPILER_IMPORT_STD}" - ) - if(${CMAKE_CXX_STANDARD} IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) - option( - ASIO_HAS_IMPORT_STD - "Build with import std; is possible and used!" - ON - ) - message(STATUS "CMAKE_CXX_MODULE_STD=${CMAKE_CXX_MODULE_STD}") - endif() - message(STATUS "ASIO_HAS_IMPORT_STD=${ASIO_HAS_IMPORT_STD}") -endif() -if(ASIO_HAS_IMPORT_STD) - # ------------------------------------------------------------------------- # Tell CMake that we explicitly want `import std`. - # This will initialize the property CXX_MODULE_STD of asio targets to 1 - # ------------------------------------------------------------------------- + # This initializes the property CXX_MODULE_STD of asio targets to 1 (requires CMake 3.30+) target_compile_definitions(asio PUBLIC ASIO_HAS_IMPORT_STD) set_target_properties(asio PROPERTIES CXX_MODULE_STD ON) - message(STATUS "Build asio with target PROPERRY CXX_MODULE_STD ON") + message(STATUS "Build asio with target PROPERTY CXX_MODULE_STD ON") endif() # Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=OFF to disable) @@ -139,10 +102,6 @@ if(ASIO_ENABLE_SSL) find_package(OpenSSL REQUIRED) target_compile_definitions(asio PUBLIC ASIO_USE_SSL) # Add OpenSSL include directories for module compilation - # Use SYSTEM to mark as system headers and PRIVATE for module internal use - target_include_directories(asio SYSTEM PRIVATE ${OPENSSL_INCLUDE_DIR}) - # Also add as PUBLIC for consumers - target_include_directories(asio SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR}) target_link_libraries(asio PUBLIC OpenSSL::SSL OpenSSL::Crypto) message( STATUS @@ -155,39 +114,17 @@ else() ) endif() -if(MSVC) - # right, but please don't complain about #includes in the module purview - target_compile_options(asio PRIVATE /wd5244) - # I do mean C++23 - target_compile_options( - asio - PUBLIC - /utf-8 - /Zc:__cplusplus - /Zc:throwingNew - /Zc:inline - /Zc:externConstexpr - /Zc:templateScope - /Zc:checkGwOdr - /Zc:enumTypes - ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # I do mean C++20 - target_compile_options( - asio - PUBLIC - -fsized-deallocation - -faligned-allocation - -Wno-include-angled-in-module-purview - ) -endif() + if(MINGW) target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) endif() -enable_testing() -add_subdirectory(src/examples) +option(ASIO_BUILD_EXAMPLES "Build Asio examples" ${PROJECT_IS_TOP_LEVEL}) +if(ASIO_BUILD_EXAMPLES) + enable_testing() + add_subdirectory(src/examples) +endif() # # Install the libraries and its FILE_SET's. diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000000..2396e94872 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,422 @@ +{ + "version": 9, + "cmakeMinimumRequired": { + "major": 3, + "minor": 30, + "patch": 0 + }, + "configurePresets": [ + { + "name": "cmake-pedantic", + "hidden": true, + "warnings": { + "dev": true, + "deprecated": true, + "uninitialized": true, + "unusedCli": true, + "systemVars": false + }, + "errors": { + "dev": false, + "deprecated": true + } + }, + { + "name": "dev-base", + "hidden": true, + "inherits": "cmake-pedantic", + "generator": "Ninja Multi-Config", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_CXX_EXTENSIONS": "ON", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_INSTALL_MESSAGE": "LAZY", + "CMAKE_SKIP_TEST_ALL_DEPENDENCY": "OFF", + "CMAKE_CXX_SCAN_FOR_MODULES": "ON", + "CMAKE_CXX_STANDARD": "20", + "ASIO_IMPORT_STD": "OFF" + } + }, + { + "name": "flags-gcc-clang", + "description": "These flags are supported by both GCC and Clang", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_FLAGS": "-D_GLIBCXX_ASSERTIONS=1 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", + "CMAKE_EXE_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen", + "CMAKE_SHARED_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen" + } + }, + { + "name": "flags-appleclang", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_FLAGS": "-fstack-protector-strong -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" + } + }, + { + "name": "flags-msvc", + "description": "Note that all the flags after /W4 are required for MSVC to conform to the language standard", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_FLAGS": "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc", + "CMAKE_EXE_LINKER_FLAGS": "/machine:x64 /guard:cf", + "CMAKE_SHARED_LINKER_FLAGS": "/machine:x64 /guard:cf" + } + }, + { + "name": "windows-msvc", + "inherits": ["dev-base", "flags-msvc"], + "displayName": "Windows MSVC", + "description": "Base configuration for Windows using MSVC toolchain (requires Developer Command Prompt)", + "cacheVariables": { + "CMAKE_C_COMPILER": "cl", + "CMAKE_CXX_COMPILER": "cl", + "ASIO_BUILD_EXAMPLES": "ON" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "linux-gcc", + "inherits": ["dev-base", "flags-gcc-clang"], + "displayName": "Linux GCC", + "description": "Base configuration for Linux using GCC", + "cacheVariables": { + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++", + "ASIO_BUILD_EXAMPLES": "ON", + "ASIO_IMPORT_STD": "OFF" + } + }, + { + "name": "linux-clang", + "inherits": ["dev-base", "flags-gcc-clang"], + "displayName": "Clang", + "description": "Base configuration for Clang", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "ASIO_BUILD_EXAMPLES": "ON", + "ASIO_IMPORT_STD": "ON" + } + }, + { + "name": "windows-mingw-clang", + "inherits": ["dev-base", "flags-gcc-clang"], + "displayName": "Windows MinGW Clang", + "description": "Base configuration for Windows using MSYS2 MinGW Clang toolchain", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "ASIO_BUILD_EXAMPLES": "ON", + "ASIO_IMPORT_STD": "ON" + } + } + ], + "buildPresets": [ + { + "name": "windows-msvc-debug", + "configurePreset": "windows-msvc", + "configuration": "Debug", + "displayName": "Debug Build (MSVC)" + }, + { + "name": "windows-msvc-release", + "configurePreset": "windows-msvc", + "configuration": "Release", + "displayName": "Release Build (MSVC)" + }, + { + "name": "linux-gcc-debug", + "configurePreset": "linux-gcc", + "configuration": "Debug", + "displayName": "Debug Build (GCC)" + }, + { + "name": "linux-gcc-release", + "configurePreset": "linux-gcc", + "configuration": "Release", + "displayName": "Release Build (GCC)" + }, + { + "name": "linux-clang-debug", + "configurePreset": "linux-clang", + "configuration": "Debug", + "displayName": "Debug Build (Clang)" + }, + { + "name": "linux-clang-release", + "configurePreset": "linux-clang", + "configuration": "Release", + "displayName": "Release Build (Clang)" + }, + { + "name": "windows-mingw-clang-debug", + "configurePreset": "windows-mingw-clang", + "configuration": "Debug", + "displayName": "Debug Build (MinGW Clang)" + }, + { + "name": "windows-mingw-clang-release", + "configurePreset": "windows-mingw-clang", + "configuration": "Release", + "displayName": "Release Build (MinGW Clang)" + } + ], + "testPresets": [ + { + "name": "windows-msvc-debug", + "configurePreset": "windows-msvc", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "windows-msvc-release", + "configurePreset": "windows-msvc", + "configuration": "Release", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "linux-gcc-debug", + "configurePreset": "linux-gcc", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "linux-gcc-release", + "configurePreset": "linux-gcc", + "configuration": "Release", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "linux-clang-debug", + "configurePreset": "linux-clang", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "linux-clang-release", + "configurePreset": "linux-clang", + "configuration": "Release", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "windows-mingw-clang-debug", + "configurePreset": "windows-mingw-clang", + "configuration": "Debug", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + }, + { + "name": "windows-mingw-clang-release", + "configurePreset": "windows-mingw-clang", + "configuration": "Release", + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": false + } + } + ], + "workflowPresets": [ + { + "name": "windows-msvc-debug", + "displayName": "Windows MSVC Debug Workflow", + "description": "Configure, build, and test in Debug", + "steps": [ + { + "type": "configure", + "name": "windows-msvc" + }, + { + "type": "build", + "name": "windows-msvc-debug" + }, + { + "type": "test", + "name": "windows-msvc-debug" + } + ] + }, + { + "name": "windows-msvc-release", + "displayName": "Windows MSVC Release Workflow", + "description": "Configure, build, and test in Release", + "steps": [ + { + "type": "configure", + "name": "windows-msvc" + }, + { + "type": "build", + "name": "windows-msvc-release" + }, + { + "type": "test", + "name": "windows-msvc-release" + } + ] + }, + { + "name": "linux-gcc-debug", + "displayName": "GCC Debug Workflow", + "description": "Configure, build, and test with GCC in Debug", + "steps": [ + { + "type": "configure", + "name": "linux-gcc" + }, + { + "type": "build", + "name": "linux-gcc-debug" + }, + { + "type": "test", + "name": "linux-gcc-debug" + } + ] + }, + { + "name": "linux-gcc-release", + "displayName": "GCC Release Workflow", + "description": "Configure, build, and test with GCC in Release", + "steps": [ + { + "type": "configure", + "name": "linux-gcc" + }, + { + "type": "build", + "name": "linux-gcc-release" + }, + { + "type": "test", + "name": "linux-gcc-release" + } + ] + }, + { + "name": "linux-clang-debug", + "displayName": "Clang Debug Workflow", + "description": "Configure, build, and test with Clang in Debug", + "steps": [ + { + "type": "configure", + "name": "linux-clang" + }, + { + "type": "build", + "name": "linux-clang-debug" + }, + { + "type": "test", + "name": "linux-clang-debug" + } + ] + }, + { + "name": "linux-clang-release", + "displayName": "Clang Release Workflow", + "description": "Configure, build, and test with Clang in Release", + "steps": [ + { + "type": "configure", + "name": "linux-clang" + }, + { + "type": "build", + "name": "linux-clang-release" + }, + { + "type": "test", + "name": "linux-clang-release" + } + ] + }, + { + "name": "windows-mingw-clang-debug", + "displayName": "MinGW Clang Debug Workflow", + "description": "Configure, build, and test with MinGW Clang in Debug", + "steps": [ + { + "type": "configure", + "name": "windows-mingw-clang" + }, + { + "type": "build", + "name": "windows-mingw-clang-debug" + }, + { + "type": "test", + "name": "windows-mingw-clang-debug" + } + ] + }, + { + "name": "windows-mingw-clang-release", + "displayName": "MinGW Clang Release Workflow", + "description": "Configure, build, and test with MinGW Clang in Release", + "steps": [ + { + "type": "configure", + "name": "windows-mingw-clang" + }, + { + "type": "build", + "name": "windows-mingw-clang-release" + }, + { + "type": "test", + "name": "windows-mingw-clang-release" + } + ] + } + ] +} diff --git a/cmake/enable_import_std.cmake b/cmake/enable_import_std.cmake new file mode 100644 index 0000000000..7813fff152 --- /dev/null +++ b/cmake/enable_import_std.cmake @@ -0,0 +1,35 @@ + +if(NOT DEFINED CMAKE_CXX_STANDARD) + message(STATUS "CMAKE_CXX_STANDARD is not defined. Setting it to 20...") + set(CMAKE_CXX_STANDARD 20) +endif() + +if(CMAKE_CXX_STANDARD LESS 20) + message(FATAL_ERROR "At least C++20 required but have ${CMAKE_CXX_STANDARD}") +endif() + +if(ASIO_IMPORT_STD) + if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.3 AND CMAKE_VERSION VERSION_LESS 4.4) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.3) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") + elseif(NOT DEFINED CMAKE_EXPERIMENTAL_CXX_IMPORT_STD) + if(CMAKE_VERSION GREATER 4.3) # last checked cmake version + message(WARNING "This version of CMake have not been tested. Please set CMAKE_EXPERIMENTAL_CXX_IMPORT_STD + to a valid UUID for this version if experimental gate is still a thing in the future.") + else() + message(FATAL_ERROR "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD is not defined. Please set it to a valid UUID.") + endif() + endif() + + if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD VERSION_LESS 23) + message(WARNING "import std requires C++23 but have ${CMAKE_CXX_STANDARD}. Overriding to 23...") + set(CMAKE_CXX_STANDARD 23) + endif() + + if("${CMAKE_CXX_STANDARD}" IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) + message(STATUS "Compiler supports 'import std;' for C++${CMAKE_CXX_STANDARD}") + else() # msvc may not show support as they dont have c++23 formal flag yet, but it works + message(WARNING "Compiler does NOT support 'import std;' for C++${CMAKE_CXX_STANDARD}") + endif() +endif() diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index fa6b905843..2e2fe06475 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -1,3 +1,15 @@ +cmake_minimum_required(VERSION 3.30...4.3) + +project( + asio_examples + DESCRIPTION "Examples for Asio" + LANGUAGES CXX +) + +if(NOT TARGET asio::asio) + find_package(asio REQUIRED) +endif() + add_executable( example.completion_executor cpp20/invocation/completion_executor.cpp @@ -14,8 +26,9 @@ target_sources( PRIVATE Impl.cpp impl_part.cpp PUBLIC FILE_SET CXX_MODULES FILES M.cppm interface_part.cppm ) -target_compile_features(M PUBLIC cxx_std_${CMAKE_CXX_STANDARD}) +target_compile_features(M PRIVATE cxx_std_${CMAKE_CXX_STANDARD}) add_executable(example.User User.cpp) target_link_libraries(example.User PRIVATE M) add_test(NAME example.User COMMAND example.User) + \ No newline at end of file From 7f9370bf1962f60e020a437269b95c52841b103c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Fri, 6 Mar 2026 23:27:00 +0300 Subject: [PATCH 43/57] update workflows due to changes in cmake infra [WIP] --- .github/workflows/clang.yml | 30 +++++----- .github/workflows/gcc.yml | 30 +++++----- .github/workflows/windows.yml | 106 +++++++++++++++++----------------- 3 files changed, 85 insertions(+), 81 deletions(-) diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 8179a6958f..06b131996d 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -1,13 +1,6 @@ name: Clang -on: - push: - branches: [ main, develop ] - pull_request: - branches: [ develop ] - workflow_dispatch: - schedule: - - cron: "30 15 * * 0" # Every Sunday at 15:30 UTC +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -19,6 +12,9 @@ jobs: fail-fast: false matrix: version: [21, 22] + cxx_config: + - { std: 20, import_std: "OFF" } + - { std: 23, import_std: "ON" } runs-on: ubuntu-latest @@ -42,12 +38,18 @@ jobs: ninja: 1.13.0 gcovr: true - - name: Run test suite + - name: Configure CMake env: - # CXX: clang++-${{ matrix.version }} CXX: clang++ PATH: $HOME/.local/bin:$PATH - run: | - # export PATH=$HOME/.local/bin:$PATH - make all - make test + run: cmake --preset linux-clang -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} + + - name: Build + env: + PATH: $HOME/.local/bin:$PATH + run: cmake --build --preset linux-clang-release + + - name: Test + env: + PATH: $HOME/.local/bin:$PATH + run: ctest --preset linux-clang-release diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 37bfee1fdb..07fc93a5e4 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -1,13 +1,6 @@ name: GCC -on: - push: - branches: [ main, develop ] - pull_request: - branches: [ develop ] - workflow_dispatch: - schedule: - - cron: "30 15 * * 0" # Every Sunday at 15:30 UTC +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -19,6 +12,9 @@ jobs: fail-fast: false matrix: version: [15, 16] + cxx_config: + - { std: 20, import_std: "OFF" } + - { std: 23, import_std: "ON" } runs-on: ubuntu-latest @@ -41,12 +37,18 @@ jobs: ninja: 1.13.0 gcovr: true - - name: Run test suite + - name: Configure CMake env: - # CXX: g++-${{ matrix.version }} CXX: g++ PATH: $HOME/.local/bin:$PATH - run: | - # export PATH=$HOME/.local/bin:$PATH - make all - make test + run: cmake --preset linux-gcc -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} + + - name: Build + env: + PATH: $HOME/.local/bin:$PATH + run: cmake --build --preset linux-gcc-release + + - name: Test + env: + PATH: $HOME/.local/bin:$PATH + run: ctest --preset linux-gcc-release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f358a990d0..5ce6656daa 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,6 +1,6 @@ name: windows -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] permissions: contents: read @@ -15,61 +15,61 @@ jobs: strategy: fail-fast: false matrix: - # windows-2022 has MSVC 2022 installed: - # https://github.com/actions/virtual-environments. - os: [windows-2022] - platform: [x64] - toolset: [v143] - standard: [20] - shared: [""] - build_type: [Debug, Release] + os: [windows-2022, windows-2025] + cxx_config: + - { std: 20, import_std: "OFF" } + - { std: 23, import_std: "ON" } + build_type: [debug, release] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build + - uses: actions/setup-python@v5 + with: { python-version: "3.13" } - - name: Configure - # Use a bash shell for $GITHUB_WORKSPACE. - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - cmake -A ${{matrix.platform}} -T ${{matrix.toolset}} \ - -DCMAKE_CXX_STANDARD=${{matrix.standard}} \ - ${{matrix.shared}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ - $GITHUB_WORKSPACE + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + cmake: 4.2.3 + ninja: 1.13.0 - - name: Build - working-directory: ${{runner.workspace}}/build - run: | - $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors - cmake --build . --config ${{matrix.build_type}} --parallel $threads + - name: Build and Test + shell: pwsh + run: | + $vsPath = &"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + cmd.exe /c "`"$vsPath\VC\Auxiliary\Build\vcvars64.bat`" && cmake --preset windows-msvc -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} && cmake --build --preset windows-msvc-${{ matrix.build_type }} && ctest --preset windows-msvc-${{ matrix.build_type }}" - mingw: - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - strategy: - fail-fast: false - matrix: - cxx: [ clang++ ] - lib: [ libc++, libstdc++ ] - steps: - - uses: actions/checkout@v3 - - uses: msys2/setup-msys2@v2 - with: - release: false - msystem: ucrt64 - pacboy: cmake:u ninja:u clang:u libc++:u gcc-libs:u - - name: Configure - run: | - cmake -B ../build -G "Ninja" -DCMAKE_CXX_STANDARD=20 \ - -DCMAKE_CXX_EXTENSIONS=OFF -DCMAKE_BUILD_TYPE=Debug - env: - CXX: ${{matrix.cxx}} - CXXFLAGS: ${{format('-stdlib={0}', matrix.lib)}} - - - name: Build - run: cmake --build ../build + # mingw: + # runs-on: windows-latest + # defaults: + # run: + # shell: msys2 {0} + # strategy: + # fail-fast: false + # matrix: + # cxx: [ clang++ ] + # lib: [ libc++, libstdc++ ] + # cxx_config: + # - { std: 20, import_std: "OFF" } + # - { std: 23, import_std: "ON" } + # build_type: [debug, release] + # + # steps: + # - uses: actions/checkout@v4 + # - uses: msys2/setup-msys2@v2 + # with: + # release: false + # msystem: ucrt64 + # pacboy: cmake:u ninja:u clang:u libc++:u gcc-libs:u + # + # - name: Configure CMake + # env: + # CXX: ${{matrix.cxx}} + # CXXFLAGS: ${{format('-stdlib={0}', matrix.lib)}} + # run: cmake --preset windows-mingw-clang -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} + # + # - name: Build + # run: cmake --build --preset windows-mingw-clang-${{ matrix.build_type }} + # + # - name: Test + # run: ctest --preset windows-mingw-clang-${{ matrix.build_type }} From c3ad37095802f5288e98621131f372e5cd3e5a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Sat, 7 Mar 2026 00:43:48 +0300 Subject: [PATCH 44/57] fix(examples/cmakelist):use correct variable name for import std support --- src/examples/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 2e2fe06475..2b03b08725 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -15,7 +15,7 @@ add_executable( cpp20/invocation/completion_executor.cpp ) target_link_libraries(example.completion_executor PRIVATE asio::asio) -if (ASIO_HAS_IMPORT_STD) +if (ASIO_IMPORT_STD) set_property(TARGET example.completion_executor PROPERTY CXX_MODULE_STD ON) endif() add_test(NAME example.completion_executor COMMAND example.completion_executor) From 7c83cfb2c10c51eba219b22fd268c6e437cf3eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Sun, 8 Mar 2026 00:33:40 +0300 Subject: [PATCH 45/57] fix(Clang): handling clang bugs regarding CMAKE_CXX_STDLIB_MODULES_JSON path resolution when building with libc++ --- CMakeLists.txt | 4 +++ CMakePresets.json | 11 ++++--- cmake/enable_import_std.cmake | 55 +++++++++++++++++++++++------------ 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 667d940dd8..14a8e7cc92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.30...4.3) include(cmake/enable_import_std.cmake) + + project( asio DESCRIPTION "Modularized Asio for C++20" @@ -32,6 +34,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") endif() endif() + + message( STATUS "Cmake is: ${CMAKE_VERSION} modules scan: ${CMAKE_CXX_SCAN_FOR_MODULES}" diff --git a/CMakePresets.json b/CMakePresets.json index 2396e94872..06f3776305 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -28,7 +28,7 @@ "generator": "Ninja Multi-Config", "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { - "CMAKE_CXX_EXTENSIONS": "ON", + "CMAKE_CXX_EXTENSIONS": "OFF", "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "CMAKE_INSTALL_MESSAGE": "LAZY", "CMAKE_SKIP_TEST_ALL_DEPENDENCY": "OFF", @@ -42,9 +42,9 @@ "description": "These flags are supported by both GCC and Clang", "hidden": true, "cacheVariables": { - "CMAKE_CXX_FLAGS": "-D_GLIBCXX_ASSERTIONS=1 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", - "CMAKE_EXE_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen", - "CMAKE_SHARED_LINKER_FLAGS": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen" + "CMAKE_CXX_FLAGS_INIT": "-D_GLIBCXX_ASSERTIONS=1 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", + "CMAKE_EXE_LINKER_FLAGS_INIT": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen", + "CMAKE_SHARED_LINKER_FLAGS_INIT": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen" } }, { @@ -100,6 +100,9 @@ "cacheVariables": { "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_CXX_FLAGS": "-stdlib=libc++", + "CMAKE_EXE_LINKER_FLAGS": "-lc++abi", + "CMAKE_SHARED_LINKER_FLAGS": "-lc++abi", "ASIO_BUILD_EXAMPLES": "ON", "ASIO_IMPORT_STD": "ON" } diff --git a/cmake/enable_import_std.cmake b/cmake/enable_import_std.cmake index 7813fff152..779e316c81 100644 --- a/cmake/enable_import_std.cmake +++ b/cmake/enable_import_std.cmake @@ -1,6 +1,4 @@ - if(NOT DEFINED CMAKE_CXX_STANDARD) - message(STATUS "CMAKE_CXX_STANDARD is not defined. Setting it to 20...") set(CMAKE_CXX_STANDARD 20) endif() @@ -9,27 +7,48 @@ if(CMAKE_CXX_STANDARD LESS 20) endif() if(ASIO_IMPORT_STD) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.3 AND CMAKE_VERSION VERSION_LESS 4.4) - set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") - elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.3) - set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") - elseif(NOT DEFINED CMAKE_EXPERIMENTAL_CXX_IMPORT_STD) - if(CMAKE_VERSION GREATER 4.3) # last checked cmake version - message(WARNING "This version of CMake have not been tested. Please set CMAKE_EXPERIMENTAL_CXX_IMPORT_STD - to a valid UUID for this version if experimental gate is still a thing in the future.") - else() - message(FATAL_ERROR "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD is not defined. Please set it to a valid UUID.") + # --------------------------------------------------------------------------- + # Experimental Setup (MUST be before project() for compiler detection) + # --------------------------------------------------------------------------- + + # 1. Enable experimental 'import std;' support + if(NOT DEFINED CMAKE_EXPERIMENTAL_CXX_IMPORT_STD) + if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.3 AND CMAKE_VERSION VERSION_LESS 4.4) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") + elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.3) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") + elseif(CMAKE_VERSION VERSION_GREATER 4.3) + message(WARNING "This version of CMake has not been tested for 'import std;'.") endif() endif() - if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD VERSION_LESS 23) - message(WARNING "import std requires C++23 but have ${CMAKE_CXX_STANDARD}. Overriding to 23...") + # 3. Ensure required C++ standard is set + if(CMAKE_CXX_STANDARD VERSION_LESS 23) + message(WARNING "import std requires C++23 but have ${CMAKE_CXX_STANDARD}. Overriding CMAKE_CXX_STANDARD to 23...") set(CMAKE_CXX_STANDARD 23) endif() - if("${CMAKE_CXX_STANDARD}" IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD) - message(STATUS "Compiler supports 'import std;' for C++${CMAKE_CXX_STANDARD}") - else() # msvc may not show support as they dont have c++23 formal flag yet, but it works - message(WARNING "Compiler does NOT support 'import std;' for C++${CMAKE_CXX_STANDARD}") + # 2. Clang libc++ Modules Path Setup + # before project() we must detect clang by inspecting CMAKE_CXX_COMPILER + if(NOT CMAKE_CXX_STDLIB_MODULES_JSON AND (CMAKE_CXX_COMPILER MATCHES "clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} -print-resource-dir + OUTPUT_VARIABLE _clang_resource_dir + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(_clang_resource_dir) + # libc++.modules.json is in the lib directory within LLVM/Clang root + cmake_path(SET _modules_json_path "${_clang_resource_dir}") + cmake_path(GET _modules_json_path PARENT_PATH _modules_json_path) # .../lib/clang + cmake_path(GET _modules_json_path PARENT_PATH _modules_json_path) # .../lib + cmake_path(APPEND _modules_json_path "libc++.modules.json") + + if(EXISTS "${_modules_json_path}") + set(CMAKE_CXX_STDLIB_MODULES_JSON "${_modules_json_path}" CACHE PATH "Path to libc++.modules.json") + message(STATUS "Found libc++.modules.json: ${CMAKE_CXX_STDLIB_MODULES_JSON}") + endif() + endif() endif() + + endif() From 4d3168dd2fa1ada48d5b30d3135b6c7510b35911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Sun, 8 Mar 2026 00:43:25 +0300 Subject: [PATCH 46/57] windows ci: add vs2026 image --- .github/workflows/windows.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5ce6656daa..212691cb41 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2022, windows-2025] + os: [windows-2022, windows-2025-vs2026] cxx_config: - { std: 20, import_std: "OFF" } - { std: 23, import_std: "ON" } @@ -33,11 +33,17 @@ jobs: cmake: 4.2.3 ninja: 1.13.0 + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + - name: Build and Test shell: pwsh run: | - $vsPath = &"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath - cmd.exe /c "`"$vsPath\VC\Auxiliary\Build\vcvars64.bat`" && cmake --preset windows-msvc -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} && cmake --build --preset windows-msvc-${{ matrix.build_type }} && ctest --preset windows-msvc-${{ matrix.build_type }}" + cmake --preset windows-msvc -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} + cmake --build --preset windows-msvc-${{ matrix.build_type }} + ctest --preset windows-msvc-${{ matrix.build_type }} # mingw: # runs-on: windows-latest From 7aad530a55567b8f3523e1d9d738cb511cae533d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20=C3=96zen?= Date: Sun, 8 Mar 2026 01:07:38 +0300 Subject: [PATCH 47/57] fix(msvc-19.50-bug): force external linkage for winsock_init_instance to fix module link errors msvc 19.50 incorrectly drops definitions of unexported inline variables. --- include/asio/detail/winsock_init.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/asio/detail/winsock_init.hpp b/include/asio/detail/winsock_init.hpp index 94b30f23f9..da037b755c 100644 --- a/include/asio/detail/winsock_init.hpp +++ b/include/asio/detail/winsock_init.hpp @@ -112,7 +112,10 @@ winsock_init_base::data winsock_init::data_; // Static variable to ensure that winsock is initialised before main, and // therefore before any other threads can get started. + +extern "C++"{ inline const winsock_init<>& winsock_init_instance = winsock_init<>(false); +} } // namespace detail } // namespace asio From 2629948c28a1c773f884d7dddc31101eb9ce1020 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 10 Mar 2026 21:31:47 +0100 Subject: [PATCH 48/57] Add find-package round-trip test too --- CMakeLists.txt | 80 ++++-- GNUmakefile | 13 +- cmake/Config.cmake.in | 13 + cmake/asio-install-library.cmake | 357 ++++++++++++++++++++++++ cmake/enable_import_std.cmake | 61 +++- module/module_compat.cmake | 458 ++++++++++++++++++------------- src/examples/CMakeLists.txt | 13 +- 7 files changed, 744 insertions(+), 251 deletions(-) create mode 100644 cmake/Config.cmake.in create mode 100644 cmake/asio-install-library.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 14a8e7cc92..eb9ebfcadd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,15 @@ cmake_minimum_required(VERSION 3.30...4.3) -# gersemi: off - include(cmake/enable_import_std.cmake) - - project( asio DESCRIPTION "Modularized Asio for C++20" HOMEPAGE_URL "https://github.com/DanielaE/asio/tree/module" LANGUAGES CXX + VERSION 1.36.0 ) - # --------------------------------------------------------------------------- # Ensure binaries find the correct libstdc++ at runtime when using a # non-system GCC (e.g. /opt/gcc-16). Without this, CTest fails because the @@ -21,8 +17,12 @@ project( # GLIBCXX symbols. # --------------------------------------------------------------------------- if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(_suffix .so) + if(APPLE) + set(_suffix .dylib) + endif() execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++.so + COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++${_suffix} OUTPUT_VARIABLE _gcc_stdcxx_path OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -34,8 +34,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") endif() endif() - - message( STATUS "Cmake is: ${CMAKE_VERSION} modules scan: ${CMAKE_CXX_SCAN_FOR_MODULES}" @@ -59,7 +57,13 @@ target_sources( INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${_asio_implementation} ) target_compile_features(asio_header INTERFACE cxx_std_${CMAKE_CXX_STANDARD}) -target_compile_definitions(asio_header INTERFACE ASIO_DISABLE_BOOST_CONTEXT_FIBER ASIO_STANDALONE ASIO_NO_DEPRECATED) +target_compile_definitions( + asio_header + INTERFACE + ASIO_DISABLE_BOOST_CONTEXT_FIBER + ASIO_STANDALONE + ASIO_NO_DEPRECATED +) #============================== # asio module library @@ -82,7 +86,9 @@ target_sources( asio PUBLIC FILE_SET modules TYPE CXX_MODULES BASE_DIRS module FILES module/asio.ixx - FILE_SET HEADERS BASE_DIRS include FILES ${_public_headers} + FILE_SET HEADERS + BASE_DIRS include module + FILES ${_public_headers} module/asio-gmf.h ) target_compile_features(asio PRIVATE cxx_std_${CMAKE_CXX_STANDARD}) set_target_properties( @@ -111,42 +117,58 @@ if(ASIO_ENABLE_SSL) STATUS "ASIO: SSL support enabled with OpenSSL at ${OPENSSL_INCLUDE_DIR}" ) + set(_dependencies DEPENDENCIES OpenSSL) else() message( STATUS "ASIO: SSL support disabled (use -DASIO_ENABLE_SSL=ON to enable)" ) + set(_dependencies) endif() - - if(MINGW) target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) endif() +enable_testing() + option(ASIO_BUILD_EXAMPLES "Build Asio examples" ${PROJECT_IS_TOP_LEVEL}) if(ASIO_BUILD_EXAMPLES) - enable_testing() add_subdirectory(src/examples) endif() +option(ASIO_BUILD_TESTS "Build Asio tests" ${PROJECT_IS_TOP_LEVEL}) +if(ASIO_BUILD_TESTS) + # test if the targets are usable from the install directory + add_test( + NAME install-to-stagedir + COMMAND + ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix + ${CMAKE_BINARY_DIR}/stagedir --config $ + ) + add_test( + NAME find-package-test + COMMAND + ${CMAKE_CTEST_COMMAND} # --verbose + --output-on-failure -C $ --build-and-test + "${CMAKE_SOURCE_DIR}/src/examples" + "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" --build-generator + ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} + --build-options # + "-D ASIO_IMPORT_STD=${ASIO_IMPORT_STD}" + "-D CMAKE_BUILD_TYPE=$" + "-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" + "-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" + "-D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" + "-D CMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/stagedir" + ) +endif() + # # Install the libraries and its FILE_SET's. # -include(GNUInstallDirs) - -set(package_install_dir ${CMAKE_INSTALL_LIBDIR}/cmake/asio) - -install( - TARGETS asio asio_header - # EXPORT ${targets_export_name} - COMPONENT asio_Development - FILE_SET HEADERS - FILE_SET CXX_MODULES - CXX_MODULES_BMI - DESTINATION - ${package_install_dir}/bmi-${CMAKE_CXX_COMPILER_ID}_$ - FILE_SET asio_header -) +include(cmake/asio-install-library.cmake) -# TODO(CK): install the cmake config packages too +asio_install_library(asio TARGETS asio asio_header + ${_dependencies} +) diff --git a/GNUmakefile b/GNUmakefile index 3e9cbd37aa..d60a340475 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -12,7 +12,7 @@ ifeq (${hostSystemName},Darwin) export LLVM_PREFIX:=$(shell brew --prefix llvm) export LLVM_DIR:=$(shell realpath ${LLVM_PREFIX}) export PATH:=${LLVM_DIR}/bin:${PATH} - #XXX CMAKE=${HOME}/.local/bin/cmake # cmake v4.4-rc1 + #XXX CMAKE=${HOME}/.local/bin/cmake # cmake v4.3-rc2 CMAKE?=/usr/local/bin/cmake STDLIB=libc++ @@ -22,9 +22,7 @@ ifeq (${hostSystemName},Darwin) export CXX:=clang++ export GCOV:="llvm-cov gcov" - ### FIXME: to test g++-15: - # include/asio/detail/posix_thread.hpp error: conflicting declaration of 'void* asio::detail::asio_detail_posix_thread_function(void*)' in module 'asio' - # friend void* asio_detail_posix_thread_function(void* arg); + ### to test g++-15: export GCC_PREFIX:=$(shell brew --prefix gcc) export GCC_DIR:=$(shell realpath ${GCC_PREFIX}) @@ -43,7 +41,7 @@ else ifeq (${hostSystemName},Linux) endif ############################################################# -.PHONY: all test check install clean +.PHONY: all test check install clean format ############################################################# all: build @@ -54,7 +52,7 @@ build: GNUmakefile CMakeLists.txt ${CXX} -print-file-name=$(STDLIB).modules.json CXX=${CXX} ${CMAKE} -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=26 -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ - -D ASIO_IMPORT_STD=ON --fresh -Wdev + -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev ln -fs build/compile_commands.json . clean: @@ -68,6 +66,9 @@ check: build install test: build ninja -C build $(@) +format: + git ls-files ::*.cmake ::*CMakeLists.txt | xargs gersemi -i + ############################################################# # Anything we don't know how to build will use this rule. ############################################################# diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in new file mode 100644 index 0000000000..326a681391 --- /dev/null +++ b/cmake/Config.cmake.in @@ -0,0 +1,13 @@ +# Copyright Claus Klein, 2025-2026 +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +include(CMakeFindDependencyMacro) + +@ASIO_FIND_DEPENDENCIES@ + +@PACKAGE_INIT@ + +include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) + +check_required_components(@PROJECT_NAME@) diff --git a/cmake/asio-install-library.cmake b/cmake/asio-install-library.cmake new file mode 100644 index 0000000000..615d4572b5 --- /dev/null +++ b/cmake/asio-install-library.cmake @@ -0,0 +1,357 @@ +# Copyright Claus Klein, 2025-2026 +# Distributed under the Boost Software License, Version 1.0. +# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.30) + +include_guard(GLOBAL) + +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) + +# asio_install_library +# ===================== +# +# Installs a library (or set of targets) along with headers, C++ modules, +# and optional CMake package configuration files. +# +# Usage: +# ------ +# asio_install_library( +# TARGETS [ ...] +# [DEPENDENCIES [ ...]] +# [NAMESPACE ] +# [EXPORT_NAME ] +# [DESTINATION ] +# [NO_VERSION_SUFFIX] +# ) +# +# Arguments: +# ---------- +# +# name +# Logical package name (e.g. "asio_any"). +# Used to derive config file names and cache variable prefixes. +# +# TARGETS (required) +# List of CMake targets to install. +# +# DEPENDENCIES (optional) +# Semicolon-separated list, one dependency per entry. +# Each entry is a valid find_dependency() argument list. +# NOTE: you must use the bracket form for quoting if not only a package name is used! CK +# "[===[Boost::type_traits 1.0.0]===] [===[Boost::scope 0.0.1 EXACT]===] fmt" +# +# NAMESPACE (optional) +# Namespace for exported targets. +# Defaults to "asio::". +# +# EXPORT_NAME (optional) +# Name of the CMake export set. +# Defaults to "-targets". +# +# DESTINATION (optional) +# The install destination for CXX_MODULES. +# Defaults to ${CMAKE_INSTALL_LIBDIR}/cmake/${name}/modules. +# +# NO_VERSION_SUFFIX (optional) +# option to disable the versioning of install destinations +# +# Brief +# ----- +# +# This function installs the specified project TARGETS and its FILE_SET +# HEADERS to the default CMAKE install destination. +# +# It also handles the installation of the CMake config package files if +# needed. If the given targets has FILE_SET CXX_MODULE, it will also +# installed to the given DESTINATION +# +# Cache variables: +# ---------------- +# +# ASIO_INSTALL_CONFIG_FILE_PACKAGES +# List of package names for which config files should be installed. +# +# _INSTALL_CONFIG_FILE_PACKAGE +# Per-package override to enable/disable config file installation. +# is the uppercased package name with dots replaced by underscores. +# +# Caveats +# ------- +# +# **Only one `FILE_SET CXX_MODULES` is yet supported to install with this +# function!** +# +# **Only header files contained in a `PUBLIC FILE_SET TYPE HEADERS` will be +# install with this function!** + +function(asio_install_library name) + # ---------------------------- + # Argument parsing + # ---------------------------- + set(options NO_VERSION_SUFFIX) + set(oneValueArgs NAMESPACE EXPORT_NAME DESTINATION) + set(multiValueArgs TARGETS DEPENDENCIES) + + cmake_parse_arguments( + ASIO + "${options}" + "${oneValueArgs}" + "${multiValueArgs}" + ${ARGN} + ) + + if(NOT ASIO_TARGETS) + message( + FATAL_ERROR + "asio_install_library(${name}): TARGETS must be specified" + ) + endif() + + if(CMAKE_SKIP_INSTALL_RULES) + message( + WARNING + "asio_install_library(${name}): not installing targets '${ASIO_TARGETS}' due to CMAKE_SKIP_INSTALL_RULES" + ) + return() + endif() + + # gersemi: off + set(_version_suffix) + set(_include_install_dir) + set(_lib_install_dir) + set(_bin_install_dir) + # NOTE: If one of this variables is not set, the default DESTINATION is used! CK + if(NOT ASIO_NO_VERSION_SUFFIX) + set(_version_suffix "-${PROJECT_VERSION}") + set(_include_install_dir DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/asio${_version_suffix}) + # set(_lib_install_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/asio${_version_suffix}) + # set(_bin_install_dir DESTINATION ${CMAKE_INSTALL_BINDIR}/asio${_version_suffix}) + endif() + set(_config_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${name}${_version_suffix}") + # gersemi: on + + # ---------------------------- + # Defaults + # ---------------------------- + if(NOT ASIO_NAMESPACE) + set(ASIO_NAMESPACE "asio::") + endif() + + if(NOT ASIO_EXPORT_NAME) + set(ASIO_EXPORT_NAME "${name}-targets") + endif() + + if(NOT ASIO_DESTINATION) + set(ASIO_DESTINATION "${_config_install_dir}/modules") + endif() + + # XXX string(REPLACE "asio_" "" install_component_name "${name}") + set(install_component_name "asio") + message( + VERBOSE + "asio-install-library(${name}): COMPONENT '${install_component_name}'" + ) + + # -------------------------------------------------- + # Install each target with all of its file sets + # -------------------------------------------------- + foreach(_tgt IN LISTS ASIO_TARGETS) + if(NOT TARGET "${_tgt}") + message( + WARNING + "asio_install_library(${name}): '${_tgt}' is not a target" + ) + continue() + endif() + + # # Given asio_any, the component_name is any + # string(REPLACE "_" ";" name_parts "${_tgt}") + # # fail if the name doesn't look like asio_any + # list(LENGTH name_parts name_parts_length) + # if(NOT name_parts_length GREATER_EQUAL 2) + # message( + # FATAL_ERROR + # "asio_install_library(${name}): expects a name of the form 'asio_', got '${_tgt}'" + # ) + # endif() + # # XXX list(GET name_parts -1 component_name) + + set(component_name "${_tgt}") + set_target_properties( + "${_tgt}" + PROPERTIES EXPORT_NAME "${component_name}" + ) + message( + VERBOSE + "asio_install_library(${name}): EXPORT_NAME ${component_name} for TARGET '${_tgt}'" + ) + + # Get the list of interface header sets, exact one expected! + set(_install_header_set_args) + get_target_property( + _available_header_sets + ${_tgt} + INTERFACE_HEADER_SETS + ) + if(_available_header_sets) + message( + VERBOSE + "asio-install-library(${name}): '${_tgt}' has INTERFACE_HEADER_SETS=${_available_header_sets}" + ) + foreach(_install_header_set IN LISTS _available_header_sets) + list( + APPEND _install_header_set_args + FILE_SET + "${_install_header_set}" + ${_include_install_dir} + COMPONENT + "${install_component_name}_Development" + ) + endforeach() + else() + set(_install_header_set_args FILE_SET HEADERS) # NOTE: empty FILE_SET in this case! CK + endif() + + # Detect presence of C++ module file sets, exact one expected! + get_target_property(_module_sets "${_tgt}" CXX_MODULE_SETS) + if(_module_sets) + message( + VERBOSE + "asio-install-library(${name}): '${_tgt}' has CXX_MODULE_SETS=${_module_sets}" + ) + install( + TARGETS "${_tgt}" + EXPORT ${ASIO_EXPORT_NAME} + ARCHIVE + ${_lib_install_dir} + COMPONENT "${install_component_name}_Development" + LIBRARY + ${_lib_install_dir} + COMPONENT "${install_component_name}_Runtime" + NAMELINK_COMPONENT "${install_component_name}_Development" + RUNTIME + ${_bin_install_dir} + COMPONENT "${install_component_name}_Runtime" + ${_install_header_set_args} + FILE_SET ${_module_sets} + DESTINATION "${ASIO_DESTINATION}" + COMPONENT "${install_component_name}_Development" + # NOTE: There's currently no convention for this location! CK + CXX_MODULES_BMI + DESTINATION + ${_config_install_dir}/bmi-${CMAKE_CXX_COMPILER_ID}_$ + COMPONENT "${install_component_name}_Development" + ) + else() + install( + TARGETS "${_tgt}" + EXPORT ${ASIO_EXPORT_NAME} + ARCHIVE + ${_lib_install_dir} + COMPONENT "${install_component_name}_Development" + LIBRARY + ${_lib_install_dir} + COMPONENT "${install_component_name}_Runtime" + NAMELINK_COMPONENT "${install_component_name}_Development" + RUNTIME + ${_bin_install_dir} + COMPONENT "${install_component_name}_Runtime" + ${_install_header_set_args} + ) + endif() + endforeach() + + # -------------------------------------------------- + # Export targets + # -------------------------------------------------- + # gersemi: off + install( + EXPORT ${ASIO_EXPORT_NAME} + NAMESPACE ${ASIO_NAMESPACE} + CXX_MODULES_DIRECTORY cxx-modules + DESTINATION ${_config_install_dir} + COMPONENT "${install_component_name}_Development" + ) + # gersemi: on + + # ---------------------------------------- + # Config file installation logic + # ---------------------------------------- + string(TOUPPER "${name}" _pkg_upper) + string(REPLACE "." "_" _pkg_prefix "${_pkg_upper}") + + option( + ${_pkg_prefix}_INSTALL_CONFIG_FILE_PACKAGE + "Enable creating and installing a CMake config-file package. Default: ON. Values: { ON, OFF }." + ON + ) + + set(_pkg_var "${_pkg_prefix}_INSTALL_CONFIG_FILE_PACKAGE") + + if(NOT DEFINED ${_pkg_var}) + set(${_pkg_var} + OFF + CACHE BOOL + "Install CMake package config files for ${name}" + ) + endif() + + set(_install_config OFF) + + if(${_pkg_var}) + set(_install_config ON) + elseif(ASIO_INSTALL_CONFIG_FILE_PACKAGES) + list(FIND ASIO_INSTALL_CONFIG_FILE_PACKAGES "${name}" _idx) + if(NOT _idx EQUAL -1) + set(_install_config ON) + endif() + endif() + + # ---------------------------------------- + # expand dependencies + # ---------------------------------------- + set(_asio_find_deps "") + foreach(dep IN ITEMS ${ASIO_DEPENDENCIES}) + message( + VERBOSE + "asio-install-library(${name}): Add find_dependency(${dep})" + ) + string(APPEND _asio_find_deps "find_dependency(${dep})\n") + endforeach() + set(ASIO_FIND_DEPENDENCIES "${_asio_find_deps}") + + # ---------------------------------------- + # Generate + install config files + # ---------------------------------------- + if(_install_config) + configure_package_config_file( + "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/Config.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake" + INSTALL_DESTINATION ${_config_install_dir} + ) + + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/${name}-config-version.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion + ) + + install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${name}-config-version.cmake" + DESTINATION ${_config_install_dir} + COMPONENT "${install_component_name}_Development" + ) + else() + message( + WARNING + "asio-install-library(${name}): Not installing a config package for '${name}'" + ) + endif() +endfunction() + +set(CPACK_GENERATOR TGZ) +include(CPack) diff --git a/cmake/enable_import_std.cmake b/cmake/enable_import_std.cmake index 779e316c81..c0cf12ceba 100644 --- a/cmake/enable_import_std.cmake +++ b/cmake/enable_import_std.cmake @@ -3,7 +3,10 @@ if(NOT DEFINED CMAKE_CXX_STANDARD) endif() if(CMAKE_CXX_STANDARD LESS 20) - message(FATAL_ERROR "At least C++20 required but have ${CMAKE_CXX_STANDARD}") + message( + FATAL_ERROR + "At least C++20 required but have ${CMAKE_CXX_STANDARD}" + ) endif() if(ASIO_IMPORT_STD) @@ -13,24 +16,46 @@ if(ASIO_IMPORT_STD) # 1. Enable experimental 'import std;' support if(NOT DEFINED CMAKE_EXPERIMENTAL_CXX_IMPORT_STD) - if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.3 AND CMAKE_VERSION VERSION_LESS 4.4) - set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b") - elseif(CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 AND CMAKE_VERSION VERSION_LESS 4.3) - set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444") + if( + CMAKE_VERSION VERSION_GREATER_EQUAL 4.3 + AND CMAKE_VERSION VERSION_LESS 4.4 + ) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD + "451f2fe2-a8a2-47c3-bc32-94786d8fc91b" + ) + elseif( + CMAKE_VERSION VERSION_GREATER_EQUAL 4.2 + AND CMAKE_VERSION VERSION_LESS 4.3 + ) + set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD + "d0edc3af-4c50-42ea-a356-e2862fe7a444" + ) elseif(CMAKE_VERSION VERSION_GREATER 4.3) - message(WARNING "This version of CMake has not been tested for 'import std;'.") + message( + WARNING + "This version of CMake has not been tested for 'import std;'." + ) endif() endif() - # 3. Ensure required C++ standard is set + # 3. Ensure required C++ standard is set if(CMAKE_CXX_STANDARD VERSION_LESS 23) - message(WARNING "import std requires C++23 but have ${CMAKE_CXX_STANDARD}. Overriding CMAKE_CXX_STANDARD to 23...") + message( + WARNING + "import std requires C++23 but have ${CMAKE_CXX_STANDARD}. Overriding CMAKE_CXX_STANDARD to 23..." + ) set(CMAKE_CXX_STANDARD 23) endif() # 2. Clang libc++ Modules Path Setup # before project() we must detect clang by inspecting CMAKE_CXX_COMPILER - if(NOT CMAKE_CXX_STDLIB_MODULES_JSON AND (CMAKE_CXX_COMPILER MATCHES "clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) + if( + NOT CMAKE_CXX_STDLIB_MODULES_JSON + AND ( + CMAKE_CXX_COMPILER MATCHES "clang" + OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + ) + ) execute_process( COMMAND ${CMAKE_CXX_COMPILER} -print-resource-dir OUTPUT_VARIABLE _clang_resource_dir @@ -44,11 +69,21 @@ if(ASIO_IMPORT_STD) cmake_path(APPEND _modules_json_path "libc++.modules.json") if(EXISTS "${_modules_json_path}") - set(CMAKE_CXX_STDLIB_MODULES_JSON "${_modules_json_path}" CACHE PATH "Path to libc++.modules.json") - message(STATUS "Found libc++.modules.json: ${CMAKE_CXX_STDLIB_MODULES_JSON}") + set(CMAKE_CXX_STDLIB_MODULES_JSON + "${_modules_json_path}" + CACHE PATH + "Path to libc++.modules.json" + ) + message( + STATUS + "Found libc++.modules.json: ${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) endif() endif() + else() + message( + VERBOSE + "CMAKE_CXX_STDLIB_MODULES_JSON: ${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) endif() - - endif() diff --git a/module/module_compat.cmake b/module/module_compat.cmake index d629420c60..d73780b602 100644 --- a/module/module_compat.cmake +++ b/module/module_compat.cmake @@ -27,13 +27,11 @@ cmake_minimum_required(VERSION 3.20) # --------------------------------------------------------------------------- # dry-run support (aliases: DRY_RUN, DRY_MODE, DRYRUN) # --------------------------------------------------------------------------- -if(DRY_RUN - OR DRY_MODE - OR DRYRUN) - set(IS_DRY_RUN ON) - message(STATUS "[dry-run] enabled, no files will be modified") +if(DRY_RUN OR DRY_MODE OR DRYRUN) + set(IS_DRY_RUN ON) + message(STATUS "[dry-run] enabled, no files will be modified") else() - set(IS_DRY_RUN OFF) + set(IS_DRY_RUN OFF) endif() # --------------------------------------------------------------------------- @@ -47,21 +45,72 @@ set(INCLUDE_DIR "${ASIO_ROOT}/include/asio") # standard c++ headers that must be included for macros (import std; does not provide macros) set(MACRO_STD_HEADERS - cassert cerrno cfloat climits - csetjmp csignal cstdarg cstdint - ctime cwchar version) + cassert + cerrno + cfloat + climits + csetjmp + csignal + cstdarg + cstdint + ctime + cwchar + version +) # standard c++ headers used in asio (keep sorted) set(STD_HEADERS - algorithm any array atomic cassert cctype - cerrno chrono climits codecvt concepts condition_variable - coroutine csignal cstdarg cstddef cstdint cstdio - cstdlib cstring deque exception functional future - iosfwd istream iterator limits list locale - memory mutex new optional ostream source_location - sstream stdexcept streambuf string string_view system_error - thread tuple type_traits typeinfo utility variant - vector version) + algorithm + any + array + atomic + cassert + cctype + cerrno + chrono + climits + codecvt + concepts + condition_variable + coroutine + csignal + cstdarg + cstddef + cstdint + cstdio + cstdlib + cstring + deque + exception + functional + future + iosfwd + istream + iterator + limits + list + locale + memory + mutex + new + optional + ostream + source_location + sstream + stdexcept + streambuf + string + string_view + system_error + thread + tuple + type_traits + typeinfo + utility + variant + vector + version +) # --------------------------------------------------------------------------- # wrapper header template @@ -98,7 +147,8 @@ import std; # endif # endif #endif -]]) +]] +) # --------------------------------------------------------------------------- # helpers @@ -106,204 +156,222 @@ import std; # generate a tilde underline matching "detail/std/
.hpp" length function(make_tilde_line header out_var) - string(LENGTH "${header}" header_len) - math(EXPR tilde_count "${header_len} + 18") - set(tildes "") - foreach(i RANGE 1 ${tilde_count}) - string(APPEND tildes "~") - endforeach() - set(${out_var} - "${tildes}" - PARENT_SCOPE) + string(LENGTH "${header}" header_len) + math(EXPR tilde_count "${header_len} + 18") + set(tildes "") + foreach(i RANGE 1 ${tilde_count}) + string(APPEND tildes "~") + endforeach() + set(${out_var} "${tildes}" PARENT_SCOPE) endfunction() # collect consumer source files, excluding generated detail/std/ function(collect_source_files out_var) - file(GLOB_RECURSE all_files "${INCLUDE_DIR}/*.hpp" "${INCLUDE_DIR}/*.ipp") - set(filtered "") - foreach(f ${all_files}) - string(FIND "${f}" "/detail/std/" pos) - if(pos EQUAL -1) - list(APPEND filtered "${f}") - endif() - endforeach() - set(${out_var} - "${filtered}" - PARENT_SCOPE) + file(GLOB_RECURSE all_files "${INCLUDE_DIR}/*.hpp" "${INCLUDE_DIR}/*.ipp") + set(filtered "") + foreach(f ${all_files}) + string(FIND "${f}" "/detail/std/" pos) + if(pos EQUAL -1) + list(APPEND filtered "${f}") + endif() + endforeach() + set(${out_var} "${filtered}" PARENT_SCOPE) endfunction() # write only if content changed function(write_if_changed file_path content) - set(existing_content "") - if(EXISTS "${file_path}") - file(READ "${file_path}" existing_content) - endif() + set(existing_content "") + if(EXISTS "${file_path}") + file(READ "${file_path}" existing_content) + endif() - if(NOT "${content}" STREQUAL "${existing_content}") - if(IS_DRY_RUN) - message(STATUS " [dry-run] would update: ${file_path}") - else() - file(WRITE "${file_path}" "${content}") - message(STATUS " updated: ${file_path}") + if(NOT "${content}" STREQUAL "${existing_content}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] would update: ${file_path}") + else() + file(WRITE "${file_path}" "${content}") + message(STATUS " updated: ${file_path}") + endif() endif() - endif() endfunction() # mode: check - find unprotected standard includes function(do_check) - message(STATUS "=== checking for raw standard library includes ===") - collect_source_files(source_files) - set(found_any OFF) - - foreach(src ${source_files}) - file(READ "${src}" content) - string(REGEX MATCHALL "#[ \t]*include[ \t]*<([^>]+)>" matches "${content}") - foreach(match ${matches}) - string(REGEX REPLACE "#[ \t]*include[ \t]*<([^>]+)>" "\\1" header - "${match}") - list(FIND STD_HEADERS "${header}" idx) - if(NOT idx EQUAL -1) - file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") - message(WARNING " found raw include <${header}> in ${rel}") - set(found_any ON) - endif() + message(STATUS "=== checking for raw standard library includes ===") + collect_source_files(source_files) + set(found_any OFF) + + foreach(src ${source_files}) + file(READ "${src}" content) + string( + REGEX MATCHALL "#[ \t]*include[ \t]*<([^>]+)>" + matches + "${content}" + ) + foreach(match ${matches}) + string( + REGEX REPLACE "#[ \t]*include[ \t]*<([^>]+)>" + "\\1" + header + "${match}" + ) + list(FIND STD_HEADERS "${header}" idx) + if(NOT idx EQUAL -1) + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + message(WARNING " found raw include <${header}> in ${rel}") + set(found_any ON) + endif() + endforeach() endforeach() - endforeach() - if(NOT found_any) - message(STATUS " no raw standard includes found.") - endif() + if(NOT found_any) + message(STATUS " no raw standard includes found.") + endif() endfunction() # mode: generate-headers - create detail/std/*.hpp function(do_generate_headers) - message(STATUS "=== generating wrapper headers ===") - if(NOT IS_DRY_RUN) - file(MAKE_DIRECTORY "${STD_DIR}") - endif() - - foreach(header ${STD_HEADERS}) - set(out_file "${STD_DIR}/${header}.hpp") - make_tilde_line("${header}" tilde_line) - string(TOUPPER "${header}" header_upper) - - set(is_macro "0") - list(FIND MACRO_STD_HEADERS "${header}" idx) - if(NOT idx EQUAL -1) - set(is_macro "1") + message(STATUS "=== generating wrapper headers ===") + if(NOT IS_DRY_RUN) + file(MAKE_DIRECTORY "${STD_DIR}") endif() - string(REPLACE "@HEADER@" "${header}" content "${WRAPPER_TEMPLATE}") - string(REPLACE "@HEADER_UPPER@" "${header_upper}" content "${content}") - string(REPLACE "@TILDE_LINE@" "${tilde_line}" content "${content}") - string(REPLACE "@IS_MACRO_HEADER@" "${is_macro}" content "${content}") - - write_if_changed("${out_file}" "${content}") - endforeach() - - # generate central all.hpp - set(all_hpp_file "${STD_DIR}/all.hpp") - set(all_hpp_content "//\n// detail/std/all.hpp\n// ~~~~~~~~~~~~~~~~~~~\n//\n") - string(APPEND all_hpp_content "// auto-generated by module_compat.cmake\n\n") - string(APPEND all_hpp_content - "#ifndef ASIO_DETAIL_STD_ALL_HPP\n#define ASIO_DETAIL_STD_ALL_HPP\n\n") - foreach(header ${STD_HEADERS}) - string(APPEND all_hpp_content - "#include \"asio/detail/std/${header}.hpp\"\n") - endforeach() - string(APPEND all_hpp_content "\n#endif // ASIO_DETAIL_STD_ALL_HPP\n") - - write_if_changed("${all_hpp_file}" "${all_hpp_content}") -endfunction() - -# mode: update-includes - replace
with "asio/detail/std/header.hpp" -function(do_update_includes) - message(STATUS "=== updating consumer includes ===") - collect_source_files(source_files) - set(modified_count 0) - - foreach(src ${source_files}) - file(READ "${src}" content) - set(original "${content}") + foreach(header ${STD_HEADERS}) + set(out_file "${STD_DIR}/${header}.hpp") + make_tilde_line("${header}" tilde_line) + string(TOUPPER "${header}" header_upper) + + set(is_macro "0") + list(FIND MACRO_STD_HEADERS "${header}" idx) + if(NOT idx EQUAL -1) + set(is_macro "1") + endif() + + string(REPLACE "@HEADER@" "${header}" content "${WRAPPER_TEMPLATE}") + string(REPLACE "@HEADER_UPPER@" "${header_upper}" content "${content}") + string(REPLACE "@TILDE_LINE@" "${tilde_line}" content "${content}") + string(REPLACE "@IS_MACRO_HEADER@" "${is_macro}" content "${content}") + + write_if_changed("${out_file}" "${content}") + endforeach() + # generate central all.hpp + set(all_hpp_file "${STD_DIR}/all.hpp") + set(all_hpp_content + "//\n// detail/std/all.hpp\n// ~~~~~~~~~~~~~~~~~~~\n//\n" + ) + string( + APPEND all_hpp_content + "// auto-generated by module_compat.cmake\n\n" + ) + string( + APPEND all_hpp_content + "#ifndef ASIO_DETAIL_STD_ALL_HPP\n#define ASIO_DETAIL_STD_ALL_HPP\n\n" + ) foreach(header ${STD_HEADERS}) - string(FIND "${content}" "<${header}>" pos) - if(NOT pos EQUAL -1) string( - REGEX - REPLACE "(#[ \t]*include[ \t]+)<${header}>" - "\\1\"asio/detail/std/${header}.hpp\"" content "${content}") - endif() + APPEND all_hpp_content + "#include \"asio/detail/std/${header}.hpp\"\n" + ) endforeach() + string(APPEND all_hpp_content "\n#endif // ASIO_DETAIL_STD_ALL_HPP\n") - if(NOT "${content}" STREQUAL "${original}") - file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") - if(IS_DRY_RUN) - message(STATUS " [dry-run] would update: ${rel}") - else() - file(WRITE "${src}" "${content}") - message(STATUS " updated: ${rel}") - endif() - math(EXPR modified_count "${modified_count} + 1") - endif() - endforeach() - message(STATUS " processed consumer files. modified: ${modified_count}") + write_if_changed("${all_hpp_file}" "${all_hpp_content}") +endfunction() + +# mode: update-includes - replace
with "asio/detail/std/header.hpp" +function(do_update_includes) + message(STATUS "=== updating consumer includes ===") + collect_source_files(source_files) + set(modified_count 0) + + foreach(src ${source_files}) + file(READ "${src}" content) + set(original "${content}") + + foreach(header ${STD_HEADERS}) + string(FIND "${content}" "<${header}>" pos) + if(NOT pos EQUAL -1) + string( + REGEX REPLACE "(#[ \t]*include[ \t]+)<${header}>" + "\\1\"asio/detail/std/${header}.hpp\"" + content + "${content}" + ) + endif() + endforeach() + + if(NOT "${content}" STREQUAL "${original}") + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] would update: ${rel}") + else() + file(WRITE "${src}" "${content}") + message(STATUS " updated: ${rel}") + endif() + math(EXPR modified_count "${modified_count} + 1") + endif() + endforeach() + message(STATUS " processed consumer files. modified: ${modified_count}") endfunction() # mode: revert-includes - restore
function(do_revert_includes) - message(STATUS "=== reverting consumer includes ===") - collect_source_files(source_files) - set(modified_count 0) - - foreach(src ${source_files}) - file(READ "${src}" content) - set(original "${content}") - - foreach(header ${STD_HEADERS}) - string(FIND "${content}" "\"asio/detail/std/${header}.hpp\"" pos) - if(NOT pos EQUAL -1) - string( - REGEX - REPLACE "(#[ \t]*include[ \t]+)\"asio/detail/std/${header}\\.hpp\"" - "\\1<${header}>" content "${content}") - endif() + message(STATUS "=== reverting consumer includes ===") + collect_source_files(source_files) + set(modified_count 0) + + foreach(src ${source_files}) + file(READ "${src}" content) + set(original "${content}") + + foreach(header ${STD_HEADERS}) + string(FIND "${content}" "\"asio/detail/std/${header}.hpp\"" pos) + if(NOT pos EQUAL -1) + string( + REGEX REPLACE + "(#[ \t]*include[ \t]+)\"asio/detail/std/${header}\\.hpp\"" + "\\1<${header}>" + content + "${content}" + ) + endif() + endforeach() + + if(NOT "${content}" STREQUAL "${original}") + file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") + if(IS_DRY_RUN) + message(STATUS " [dry-run] would revert: ${rel}") + else() + file(WRITE "${src}" "${content}") + message(STATUS " reverted: ${rel}") + endif() + math(EXPR modified_count "${modified_count} + 1") + endif() endforeach() - - if(NOT "${content}" STREQUAL "${original}") - file(RELATIVE_PATH rel "${ASIO_ROOT}" "${src}") - if(IS_DRY_RUN) - message(STATUS " [dry-run] would revert: ${rel}") - else() - file(WRITE "${src}" "${content}") - message(STATUS " reverted: ${rel}") - endif() - math(EXPR modified_count "${modified_count} + 1") - endif() - endforeach() - message(STATUS " reverted ${modified_count} files.") + message(STATUS " reverted ${modified_count} files.") endfunction() # mode: remove-headers - delete detail/std/*.hpp function(do_remove_headers) - message(STATUS "=== removing wrapper headers ===") - if(NOT EXISTS "${STD_DIR}") - message(STATUS " directory ${STD_DIR} does not exist. nothing to do.") - return() - endif() - - file(GLOB all_wrappers "${STD_DIR}/*.hpp") - list(LENGTH all_wrappers removed_count) - if(IS_DRY_RUN) - foreach(f ${all_wrappers}) - message(STATUS " [dry-run] would remove: ${f}") - endforeach() - message(STATUS " [dry-run] would remove directory: ${STD_DIR}") - else() - file(REMOVE_RECURSE "${STD_DIR}") - message(STATUS " removed directory: ${STD_DIR}") - endif() - message(STATUS " ${removed_count} files.") + message(STATUS "=== removing wrapper headers ===") + if(NOT EXISTS "${STD_DIR}") + message(STATUS " directory ${STD_DIR} does not exist. nothing to do.") + return() + endif() + + file(GLOB all_wrappers "${STD_DIR}/*.hpp") + list(LENGTH all_wrappers removed_count) + if(IS_DRY_RUN) + foreach(f ${all_wrappers}) + message(STATUS " [dry-run] would remove: ${f}") + endforeach() + message(STATUS " [dry-run] would remove directory: ${STD_DIR}") + else() + file(REMOVE_RECURSE "${STD_DIR}") + message(STATUS " removed directory: ${STD_DIR}") + endif() + message(STATUS " ${removed_count} files.") endfunction() # --------------------------------------------------------------------------- @@ -311,28 +379,28 @@ endfunction() # --------------------------------------------------------------------------- if(NOT DEFINED MODE) - message( - FATAL_ERROR - "MODE not defined (check, generate-headers, update-includes, generate, revert, etc.)" - ) + message( + FATAL_ERROR + "MODE not defined (check, generate-headers, update-includes, generate, revert, etc.)" + ) endif() if(MODE STREQUAL "check") - do_check() + do_check() elseif(MODE STREQUAL "generate-headers" OR MODE STREQUAL "update-content") - do_generate_headers() + do_generate_headers() elseif(MODE STREQUAL "update-includes") - do_update_includes() + do_update_includes() elseif(MODE STREQUAL "generate" OR MODE STREQUAL "update") - do_generate_headers() - do_update_includes() + do_generate_headers() + do_update_includes() elseif(MODE STREQUAL "revert") - do_revert_includes() - do_remove_headers() + do_revert_includes() + do_remove_headers() elseif(MODE STREQUAL "revert-includes") - do_revert_includes() + do_revert_includes() elseif(MODE STREQUAL "remove-headers") - do_remove_headers() + do_remove_headers() else() - message(FATAL_ERROR "unknown MODE: ${MODE}") + message(FATAL_ERROR "unknown MODE: ${MODE}") endif() diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 2b03b08725..22605ded3f 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.30...4.3) -project( - asio_examples - DESCRIPTION "Examples for Asio" - LANGUAGES CXX -) +include(../../cmake/enable_import_std.cmake) + +project(asio_examples DESCRIPTION "Examples for Asio" LANGUAGES CXX) if(NOT TARGET asio::asio) find_package(asio REQUIRED) @@ -15,8 +13,8 @@ add_executable( cpp20/invocation/completion_executor.cpp ) target_link_libraries(example.completion_executor PRIVATE asio::asio) -if (ASIO_IMPORT_STD) - set_property(TARGET example.completion_executor PROPERTY CXX_MODULE_STD ON) +if(ASIO_IMPORT_STD) + set_property(TARGET example.completion_executor PROPERTY CXX_MODULE_STD ON) endif() add_test(NAME example.completion_executor COMMAND example.completion_executor) @@ -31,4 +29,3 @@ target_compile_features(M PRIVATE cxx_std_${CMAKE_CXX_STANDARD}) add_executable(example.User User.cpp) target_link_libraries(example.User PRIVATE M) add_test(NAME example.User COMMAND example.User) - \ No newline at end of file From 244768292f833cc4d06cb55f35e2230ac0988ee7 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Wed, 11 Mar 2026 22:38:19 +0100 Subject: [PATCH 49/57] Add more examples and unit tests Format cmake preset file too --- CMakeLists.txt | 3 +- CMakePresets.json | 71 ++++++++++----- GNUmakefile | 2 +- src/examples/CMakeLists.txt | 7 +- src/examples/cpp11/CMakeLists.txt | 93 +++++++++++++++++++ src/examples/cpp14/CMakeLists.txt | 36 ++++++++ src/examples/cpp17/CMakeLists.txt | 17 ++++ src/examples/cpp20/CMakeLists.txt | 41 +++++++++ src/tests/unit/CMakeLists.txt | 144 ++++++++++++++++++++++++++++++ src/tests/unit/unit_test.hpp | 3 +- 10 files changed, 389 insertions(+), 28 deletions(-) create mode 100644 src/examples/cpp11/CMakeLists.txt create mode 100644 src/examples/cpp14/CMakeLists.txt create mode 100644 src/examples/cpp17/CMakeLists.txt create mode 100644 src/examples/cpp20/CMakeLists.txt create mode 100644 src/tests/unit/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index eb9ebfcadd..33c2f02b12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ file( # asio interface library #============================== add_library(asio_header INTERFACE) -add_library(asio::asio-header ALIAS asio_header) +add_library(asio::asio_header ALIAS asio_header) target_sources( asio_header INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${_asio_implementation} @@ -139,6 +139,7 @@ endif() option(ASIO_BUILD_TESTS "Build Asio tests" ${PROJECT_IS_TOP_LEVEL}) if(ASIO_BUILD_TESTS) + add_subdirectory(src/tests/unit) # test if the targets are usable from the install directory add_test( NAME install-to-stagedir diff --git a/CMakePresets.json b/CMakePresets.json index 06f3776305..86c3de8455 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -28,13 +28,16 @@ "generator": "Ninja Multi-Config", "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { - "CMAKE_CXX_EXTENSIONS": "OFF", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_CXX_EXTENSIONS": false, + "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_MESSAGE": "LAZY", - "CMAKE_SKIP_TEST_ALL_DEPENDENCY": "OFF", - "CMAKE_CXX_SCAN_FOR_MODULES": "ON", + "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false, + "CMAKE_CXX_SCAN_FOR_MODULES": true, "CMAKE_CXX_STANDARD": "20", - "ASIO_IMPORT_STD": "OFF" + "ASIO_IMPORT_STD": true + }, + "environment": { + "CTEST_OUTPUT_ON_FAILURE": "ON" } }, { @@ -42,37 +45,47 @@ "description": "These flags are supported by both GCC and Clang", "hidden": true, "cacheVariables": { - "CMAKE_CXX_FLAGS_INIT": "-D_GLIBCXX_ASSERTIONS=1 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", - "CMAKE_EXE_LINKER_FLAGS_INIT": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen", - "CMAKE_SHARED_LINKER_FLAGS_INIT": "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen" + "CMAKE_CXX_FLAGS_INIT": + "-D_GLIBCXX_ASSERTIONS=1 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast", + "CMAKE_EXE_LINKER_FLAGS_INIT": + "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen", + "CMAKE_SHARED_LINKER_FLAGS_INIT": + "-Wl,--allow-shlib-undefined,--as-needed,-z,noexecstack,-z,relro,-z,now,-z,nodlopen" } }, { "name": "flags-appleclang", "hidden": true, "cacheVariables": { - "CMAKE_CXX_FLAGS": "-fstack-protector-strong -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" + "CMAKE_CXX_FLAGS": + "-fstack-protector-strong -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" } }, { "name": "flags-msvc", - "description": "Note that all the flags after /W4 are required for MSVC to conform to the language standard", + "description": + "Note that all the flags after /W4 are required for MSVC to conform to the language standard", "hidden": true, "cacheVariables": { - "CMAKE_CXX_FLAGS": "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc", + "CMAKE_CXX_FLAGS": + "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc", "CMAKE_EXE_LINKER_FLAGS": "/machine:x64 /guard:cf", "CMAKE_SHARED_LINKER_FLAGS": "/machine:x64 /guard:cf" } }, { "name": "windows-msvc", - "inherits": ["dev-base", "flags-msvc"], + "inherits": [ + "dev-base", + "flags-msvc" + ], "displayName": "Windows MSVC", - "description": "Base configuration for Windows using MSVC toolchain (requires Developer Command Prompt)", + "description": + "Base configuration for Windows using MSVC toolchain (requires Developer Command Prompt)", "cacheVariables": { "CMAKE_C_COMPILER": "cl", "CMAKE_CXX_COMPILER": "cl", - "ASIO_BUILD_EXAMPLES": "ON" + "ASIO_BUILD_EXAMPLES": true }, "condition": { "type": "equals", @@ -82,19 +95,25 @@ }, { "name": "linux-gcc", - "inherits": ["dev-base", "flags-gcc-clang"], + "inherits": [ + "dev-base", + "flags-gcc-clang" + ], "displayName": "Linux GCC", "description": "Base configuration for Linux using GCC", "cacheVariables": { "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++", - "ASIO_BUILD_EXAMPLES": "ON", - "ASIO_IMPORT_STD": "OFF" + "ASIO_BUILD_EXAMPLES": true, + "ASIO_IMPORT_STD": true } }, { "name": "linux-clang", - "inherits": ["dev-base", "flags-gcc-clang"], + "inherits": [ + "dev-base", + "flags-gcc-clang" + ], "displayName": "Clang", "description": "Base configuration for Clang", "cacheVariables": { @@ -103,20 +122,24 @@ "CMAKE_CXX_FLAGS": "-stdlib=libc++", "CMAKE_EXE_LINKER_FLAGS": "-lc++abi", "CMAKE_SHARED_LINKER_FLAGS": "-lc++abi", - "ASIO_BUILD_EXAMPLES": "ON", - "ASIO_IMPORT_STD": "ON" + "ASIO_BUILD_EXAMPLES": true, + "ASIO_IMPORT_STD": true } }, { "name": "windows-mingw-clang", - "inherits": ["dev-base", "flags-gcc-clang"], + "inherits": [ + "dev-base", + "flags-gcc-clang" + ], "displayName": "Windows MinGW Clang", - "description": "Base configuration for Windows using MSYS2 MinGW Clang toolchain", + "description": + "Base configuration for Windows using MSYS2 MinGW Clang toolchain", "cacheVariables": { "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", - "ASIO_BUILD_EXAMPLES": "ON", - "ASIO_IMPORT_STD": "ON" + "ASIO_BUILD_EXAMPLES": true, + "ASIO_IMPORT_STD": true } } ], diff --git a/GNUmakefile b/GNUmakefile index d60a340475..883fa842ff 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -49,7 +49,7 @@ all: build build: GNUmakefile CMakeLists.txt ${CMAKE} --version - ${CXX} -print-file-name=$(STDLIB).modules.json + -${CXX} -print-file-name=$(STDLIB).modules.json CXX=${CXX} ${CMAKE} -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=26 -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 22605ded3f..2f034ecb14 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -4,8 +4,13 @@ include(../../cmake/enable_import_std.cmake) project(asio_examples DESCRIPTION "Examples for Asio" LANGUAGES CXX) -if(NOT TARGET asio::asio) +if(PROJECT_IS_TOP_LEVEL) find_package(asio REQUIRED) +else() + add_subdirectory(cpp11) + add_subdirectory(cpp14) + add_subdirectory(cpp17) + add_subdirectory(cpp20) endif() add_executable( diff --git a/src/examples/cpp11/CMakeLists.txt b/src/examples/cpp11/CMakeLists.txt new file mode 100644 index 0000000000..326870e98e --- /dev/null +++ b/src/examples/cpp11/CMakeLists.txt @@ -0,0 +1,93 @@ +set(target_prefix asio_cpp11_) + +set(noinst_PROGRAMS + allocation/server + buffers/reference_counted + chat/chat_client + chat/chat_server + echo/async_tcp_echo_server + echo/async_udp_echo_server + echo/blocking_tcp_echo_client + echo/blocking_tcp_echo_server + echo/blocking_udp_echo_client + echo/blocking_udp_echo_server + executors/actor + executors/bank_account_1 + executors/bank_account_2 + executors/fork_join + # XXX executors/pipeline + executors/priority_scheduler + # XXX futures/daytime_client + # XXX http/server/http_server + # XXX invocation/prioritised_handlers + iostreams/http_client + multicast/receiver + multicast/sender + nonblocking/third_party_lib + # XXX operations/composed_1 + # XXX operations/composed_2 + # XXX operations/composed_3 + # XXX operations/composed_4 + # XXX operations/composed_5 + # XXX operations/composed_6 + # XXX operations/composed_7 + # XXX operations/composed_8 + socks4/sync_client + timeouts/async_tcp_client + timeouts/blocking_tcp_client + timeouts/blocking_token_tcp_client + timeouts/blocking_udp_client + timeouts/server + timers/time_t_timer +) + +if(UNIX) + list( + APPEND noinst_PROGRAMS + chat/posix_chat_client + fork/daemon + fork/process_per_connection + local/connect_pair + local/iostream_client + local/stream_server + local/stream_client + local/fd_passing_stream_server + local/fd_passing_stream_client + ) +endif() + +if(MSVC) + list(APPEND noinst_PROGRAMS windows/transmit_file) +endif() + +if(Boost_FOUND) + list(APPEND noinst_PROGRAMS spawn/echo_server spawn/parallel_grep) +endif() + +# if(OpenSSL_FOUND) +# list(APPEND noinst_PROGRAMS +# ssl/client +# ssl/server +# ) +# endif() + +set(http_server_http_server_SOURCES + http/server/connection.cpp + http/server/connection_manager.cpp + http/server/main.cpp + http/server/mime_types.cpp + http/server/reply.cpp + http/server/request_handler.cpp + http/server/request_parser.cpp + http/server/server.cpp +) + +foreach(program ${noinst_PROGRAMS}) + string(REPLACE "/" "_" target ${program}) + if(NOT DEFINED "${target}_SOURCES") + set("${target}_SOURCES" ${program}.cpp) + endif() + add_executable(${target_prefix}${target} ${${target}_SOURCES}) + # set_target_properties(${target_prefix}${target} PROPERTIES CXX_STANDARD 11) + target_link_libraries(${target_prefix}${target} asio::asio_header) +endforeach() diff --git a/src/examples/cpp14/CMakeLists.txt b/src/examples/cpp14/CMakeLists.txt new file mode 100644 index 0000000000..2181e10a64 --- /dev/null +++ b/src/examples/cpp14/CMakeLists.txt @@ -0,0 +1,36 @@ +set(target_prefix asio_cpp14_) + +set(noinst_PROGRAMS + echo/async_tcp_echo_server.cpp + echo/async_udp_echo_server.cpp + echo/blocking_tcp_echo_client.cpp + echo/blocking_tcp_echo_server.cpp + echo/blocking_udp_echo_client.cpp + echo/blocking_udp_echo_server.cpp + executors/actor.cpp + executors/async_1.cpp + executors/async_2.cpp + executors/bank_account_1.cpp + executors/bank_account_2.cpp + executors/fork_join.cpp + executors/pipeline.cpp + executors/priority_scheduler.cpp + iostreams/http_client.cpp + # XXX operations/composed_1.cpp + # XXX operations/composed_2.cpp + # XXX operations/composed_3.cpp + # XXX operations/composed_4.cpp + # XXX operations/composed_5.cpp + # XXX operations/composed_6.cpp + # XXX operations/composed_7.cpp + # XXX operations/composed_8.cpp +) + +foreach(source ${noinst_PROGRAMS}) + string(REGEX REPLACE "\.cpp$" "" program ${source}) + string(REPLACE "/" "_" target ${program}) + add_executable(${target_prefix}${target} ${program}.cpp) + # set_target_properties(${target_prefix}${target} PROPERTIES CXX_STANDARD 14) + + target_link_libraries(${target_prefix}${target} asio::asio_header) +endforeach() diff --git a/src/examples/cpp17/CMakeLists.txt b/src/examples/cpp17/CMakeLists.txt new file mode 100644 index 0000000000..4e132750f0 --- /dev/null +++ b/src/examples/cpp17/CMakeLists.txt @@ -0,0 +1,17 @@ +set(target_prefix asio_cpp17_) + +set(noinst_PROGRAMS + coroutines_ts/chat_server.cpp + coroutines_ts/echo_server.cpp + coroutines_ts/range_based_for.cpp + coroutines_ts/refactored_echo_server.cpp + coroutines_ts/echo_server_with_default.cpp +) + +foreach(source ${noinst_PROGRAMS}) + string(REGEX REPLACE "\.cpp$" "" program ${source}) + string(REPLACE "/" "_" target ${program}) + + add_executable(${target_prefix}${target} ${program}.cpp) + target_link_libraries(${target_prefix}${target} asio::asio_header) +endforeach() diff --git a/src/examples/cpp20/CMakeLists.txt b/src/examples/cpp20/CMakeLists.txt new file mode 100644 index 0000000000..4c0fc30a0c --- /dev/null +++ b/src/examples/cpp20/CMakeLists.txt @@ -0,0 +1,41 @@ +set(target_prefix asio_cpp20_) + +set(noinst_PROGRAMS + invocation/completion_executor.cpp + # operations/composed_5.cpp + # operations/composed_4.cpp + # operations/composed_6.cpp + # operations/composed_7.cpp + # operations/composed_3.cpp + # operations/composed_2.cpp + # operations/composed_1.cpp + # operations/composed_8.cpp + # XXX operations/c_callback_wrapper.cpp + # XXX operations/callback_wrapper.cpp + coroutines/echo_server_with_as_tuple_default.cpp + coroutines/echo_server_with_default.cpp + coroutines/echo_server.cpp + coroutines/echo_server_with_as_single_default.cpp + coroutines/echo_server_with_deferred.cpp + coroutines/echo_server_with_deferred_default.cpp + coroutines/refactored_echo_server.cpp + coroutines/chat_server.cpp + coroutines/timeout.cpp + channels/mutual_exclusion_2.cpp + channels/throttling_proxy.cpp + channels/mutual_exclusion_1.cpp +) + +set(type_erasure_type_erasure_SOURCES + type_erasure/main.cpp + type_erasure/stdin_line_reader.cpp + type_erasure/sleep.cpp +) + +foreach(source ${noinst_PROGRAMS}) + string(REGEX REPLACE "\.cpp$" "" program ${source}) + string(REPLACE "/" "_" target ${program}) + + add_executable(${target_prefix}${target} ${program}.cpp) + target_link_libraries(${target_prefix}${target} asio::asio_header) +endforeach() diff --git a/src/tests/unit/CMakeLists.txt b/src/tests/unit/CMakeLists.txt new file mode 100644 index 0000000000..7ae77e39b8 --- /dev/null +++ b/src/tests/unit/CMakeLists.txt @@ -0,0 +1,144 @@ +set(target_prefix asio_unit_) + +set(test_PROGRAMS + associated_allocator + associated_executor + async_result + awaitable + basic_datagram_socket + basic_deadline_timer + basic_raw_socket + basic_seq_packet_socket + basic_serial_port + basic_signal_set + basic_socket + basic_socket_acceptor + basic_stream_socket + basic_streambuf + basic_waitable_timer + # XXX bind_executor + # XXX buffered_read_stream + # XXX buffered_stream + # XXX buffered_write_stream + buffer + buffers_iterator + co_spawn + completion_condition + compose + connect + coroutine + deadline_timer + defer + detached + dispatch + error + execution_context + executor + executor_work_guard + generic/basic_endpoint + # XXX generic/datagram_protocol + # XXX generic/raw_protocol + # XXX generic/seq_packet_protocol + # XXX generic/stream_protocol + high_resolution_timer + io_context + # XXX io_context_strand + ip/address + ip/address_v4 + ip/address_v4_iterator + ip/address_v4_range + ip/address_v6 + ip/address_v6_iterator + ip/address_v6_range + ip/basic_endpoint + ip/basic_resolver + ip/basic_resolver_entry + ip/basic_resolver_iterator + ip/basic_resolver_query + ip/host_name + # XXX ip/icmp + ip/multicast + ip/network_v4 + ip/network_v6 + ip/resolver_query_base + # XXX ip/tcp + # XXX ip/udp + ip/unicast + ip/v6_only + is_read_buffered + is_write_buffered + local/basic_endpoint + local/connect_pair + local/datagram_protocol + local/stream_protocol + packaged_task + placeholders + posix/basic_descriptor + posix/basic_stream_descriptor + posix/descriptor + posix/descriptor_base + # XXX posix/stream_descriptor + post + # XXX read + # XXX read_at + # XXX read_until + # XXX redirect_error + # XXX serial_port + serial_port_base + # XXX signal_set + socket_base + steady_timer + strand + streambuf + system_context + system_executor + system_timer + this_coro + thread + time_traits + ts/buffer + ts/executor + ts/internet + ts/io_context + ts/net + ts/netfwd + ts/socket + ts/timer + use_awaitable + # XXX use_future + uses_executor + wait_traits + windows/basic_object_handle + windows/basic_overlapped_handle + windows/basic_random_access_handle + windows/basic_stream_handle + windows/object_handle + windows/overlapped_handle + windows/overlapped_ptr + windows/random_access_handle + windows/stream_handle + # XXX write + # XXX write_at +) + +set(test_header ../latency/high_res_clock.hpp unit_test.hpp) + +# if(OpenSSL_FOUND) +# list(APPEND test_PROGRAMS +# ssl/context_base +# ssl/context +# ssl/error +# ssl/stream_base +# ssl/stream +# ) +# endif() + +foreach(program ${test_PROGRAMS}) + string(REPLACE "/" "_" target ${program}) + add_executable(${target_prefix}${target} ${program}.cpp ${test_header}) + # XXX set_target_properties(${target_prefix}${target} PROPERTIES CXX_STANDARD 17) + + target_link_libraries(${target_prefix}${target} asio::asio_header) + + add_test(NAME ${target_prefix}${target} COMMAND "${target_prefix}${target}") +endforeach() diff --git a/src/tests/unit/unit_test.hpp b/src/tests/unit/unit_test.hpp index c3669e04c3..724a4cabba 100644 --- a/src/tests/unit/unit_test.hpp +++ b/src/tests/unit/unit_test.hpp @@ -12,9 +12,10 @@ #define UNIT_TEST_HPP #include "asio/detail/config.hpp" -#include #include "asio/detail/atomic_count.hpp" +#include + #if defined(__sun) # include // Needed for lrand48. #endif // defined(__sun) From 4b63533262a265e3c218f4aa89acba4db745e44f Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Thu, 12 Mar 2026 00:05:02 +0100 Subject: [PATCH 50/57] Be less pedantic on UNIX, disable old examples Be more verbose on CI workflow cmake --preset --- .github/workflows/clang.yml | 2 +- .github/workflows/gcc.yml | 2 +- .github/workflows/windows.yml | 12 ++++++++++-- CMakePresets.json | 8 ++++---- src/examples/CMakeLists.txt | 6 +++--- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 06b131996d..6a48b5f854 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -42,7 +42,7 @@ jobs: env: CXX: clang++ PATH: $HOME/.local/bin:$PATH - run: cmake --preset linux-clang -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} + run: cmake --preset linux-clang --log-level=VERBOSE -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} - name: Build env: diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 07fc93a5e4..8e7d4d4d7f 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -41,7 +41,7 @@ jobs: env: CXX: g++ PATH: $HOME/.local/bin:$PATH - run: cmake --preset linux-gcc -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} + run: cmake --preset linux-gcc --log-level=VERBOSE -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} - name: Build env: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 212691cb41..e2940ae97d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -38,11 +38,19 @@ jobs: with: arch: x64 - - name: Build and Test + - name: Configure CMake + shell: pwsh + run: | + cmake --preset windows-msvc --log-level=VERBOSE -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} + + - name: Build shell: pwsh run: | - cmake --preset windows-msvc -D CMAKE_CXX_STANDARD=${{ matrix.cxx_config.std }} -D ASIO_IMPORT_STD=${{ matrix.cxx_config.import_std }} cmake --build --preset windows-msvc-${{ matrix.build_type }} + + - name: Test + shell: pwsh + run: | ctest --preset windows-msvc-${{ matrix.build_type }} # mingw: diff --git a/CMakePresets.json b/CMakePresets.json index 86c3de8455..d10efa872e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -33,8 +33,8 @@ "CMAKE_INSTALL_MESSAGE": "LAZY", "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false, "CMAKE_CXX_SCAN_FOR_MODULES": true, - "CMAKE_CXX_STANDARD": "20", - "ASIO_IMPORT_STD": true + "CMAKE_CXX_STANDARD": "23", + "ASIO_IMPORT_STD": false }, "environment": { "CTEST_OUTPUT_ON_FAILURE": "ON" @@ -58,7 +58,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-fstack-protector-strong -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast" + "-fstack-protector-strong -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wno-undef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast" } }, { @@ -97,7 +97,7 @@ "name": "linux-gcc", "inherits": [ "dev-base", - "flags-gcc-clang" + "flags-appleclang" ], "displayName": "Linux GCC", "description": "Base configuration for Linux using GCC", diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 2f034ecb14..0517cdf366 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -7,9 +7,9 @@ project(asio_examples DESCRIPTION "Examples for Asio" LANGUAGES CXX) if(PROJECT_IS_TOP_LEVEL) find_package(asio REQUIRED) else() - add_subdirectory(cpp11) - add_subdirectory(cpp14) - add_subdirectory(cpp17) + # add_subdirectory(cpp11) + # add_subdirectory(cpp14) + # add_subdirectory(cpp17) add_subdirectory(cpp20) endif() From 0d87cf562dbdd8f4ced42e77817e617a3074d89d Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Thu, 12 Mar 2026 13:24:13 +0100 Subject: [PATCH 51/57] Make it works on APPLE with clang++ --- CMakeLists.txt | 37 ++---- GNUmakefile | 14 ++- module/asio-gmf.h | 127 +++++++++++---------- src/examples/CMakeLists.txt | 9 +- src/tests/unit/CMakeLists.txt | 27 +++++ src/tests/unit/local/datagram_protocol.cpp | 47 ++++---- src/tests/unit/local/stream_protocol.cpp | 30 ++--- 7 files changed, 154 insertions(+), 137 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33c2f02b12..9be4e76592 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,11 +59,12 @@ target_sources( target_compile_features(asio_header INTERFACE cxx_std_${CMAKE_CXX_STANDARD}) target_compile_definitions( asio_header - INTERFACE - ASIO_DISABLE_BOOST_CONTEXT_FIBER - ASIO_STANDALONE - ASIO_NO_DEPRECATED + INTERFACE ASIO_DISABLE_BOOST_CONTEXT_FIBER ASIO_STANDALONE + # TODO(CK): ASIO_NO_DEPRECATED ) +if(MSVC) + target_compile_definitions(asio_header INTERFACE _WIN32_WINNT=0x0601) +endif() #============================== # asio module library @@ -126,6 +127,11 @@ else() set(_dependencies) endif() +if(MSVC) + target_compile_definitions(asio PUBLIC _WIN32_WINNT=0x0601) + target_link_libraries(asio PUBLIC mswsock ws2_32) +endif() + if(MINGW) target_link_libraries(asio PUBLIC bcrypt mswsock ws2_32) endif() @@ -140,29 +146,6 @@ endif() option(ASIO_BUILD_TESTS "Build Asio tests" ${PROJECT_IS_TOP_LEVEL}) if(ASIO_BUILD_TESTS) add_subdirectory(src/tests/unit) - # test if the targets are usable from the install directory - add_test( - NAME install-to-stagedir - COMMAND - ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix - ${CMAKE_BINARY_DIR}/stagedir --config $ - ) - add_test( - NAME find-package-test - COMMAND - ${CMAKE_CTEST_COMMAND} # --verbose - --output-on-failure -C $ --build-and-test - "${CMAKE_SOURCE_DIR}/src/examples" - "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" --build-generator - ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-options # - "-D ASIO_IMPORT_STD=${ASIO_IMPORT_STD}" - "-D CMAKE_BUILD_TYPE=$" - "-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" - "-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" - "-D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" - "-D CMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/stagedir" - ) endif() # diff --git a/GNUmakefile b/GNUmakefile index 883fa842ff..5a2dcd9c91 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -41,7 +41,7 @@ else ifeq (${hostSystemName},Linux) endif ############################################################# -.PHONY: all test check install clean format +.PHONY: all test check install clean format workflow ############################################################# all: build @@ -49,7 +49,11 @@ all: build build: GNUmakefile CMakeLists.txt ${CMAKE} --version - -${CXX} -print-file-name=$(STDLIB).modules.json + -if [ "${hostSystemName}" = "Darwin" ]; then \ + ${CXX} -print-file-name=c++/$(STDLIB).modules.json; \ + else \ + ${CXX} -print-file-name=$(STDLIB).modules.json; \ + fi CXX=${CXX} ${CMAKE} -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=26 -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev @@ -60,6 +64,12 @@ clean: find . -name .DS_Store -delete find . -name '*~' -delete +workflow: + cmake --preset linux-clang -D CMAKE_CXX_STANDARD=26 \ + -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ + -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev + cmake --workflow --preset linux-clang-release + check: build run-clang-tidy src/examples/cpp20 diff --git a/module/asio-gmf.h b/module/asio-gmf.h index aa3a281ffc..35be643359 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -2,33 +2,34 @@ #define ASIO_IN_GMF #ifndef ASIO_STANDALONE -# define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported +# define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported #endif #if defined(_WIN32) and __has_include() -# include +# include #endif #if defined(ASIO_HEADER_ONLY) -# error "ASIO_HEADER_ONLY" makes no sense with this module +# error "ASIO_HEADER_ONLY" makes no sense with this module #endif #if !defined(ASIO_SEPARATE_COMPILATION) -# define ASIO_SEPARATE_COMPILATION +# define ASIO_SEPARATE_COMPILATION #endif -#if !defined(ASIO_DISABLE_BUFFER_DEBUGGING) && !defined(ASIO_ENABLE_BUFFER_DEBUGGING) -# define ASIO_DISABLE_BUFFER_DEBUGGING +#if !defined(ASIO_DISABLE_BUFFER_DEBUGGING) && \ + !defined(ASIO_ENABLE_BUFFER_DEBUGGING) +# define ASIO_DISABLE_BUFFER_DEBUGGING #endif #if __has_include() -# include -#else -# ifndef ASIO_NO_DEPRECATED -# define ASIO_NO_DEPRECATED -# endif -# undef ASIO_DEPRECATED_MSG -# define ASIO_DISABLE_DEPRECATED_MSG +# include +#elif !defined(__APPLE__) +# ifndef ASIO_NO_DEPRECATED +# define ASIO_NO_DEPRECATED +# endif +# undef ASIO_DEPRECATED_MSG +# define ASIO_DISABLE_DEPRECATED_MSG #endif #define ASIO_MODULE @@ -36,7 +37,7 @@ #include #ifndef ASIO_ENABLE_HANDLER_TRACKING -# define ASIO_STD_CSTDARG_NO_INCLUDE +# define ASIO_STD_CSTDARG_NO_INCLUDE #endif #include "asio/detail/std/all.hpp" @@ -45,76 +46,76 @@ #include #if defined(ASIO_WINDOWS_RUNTIME) // expected to not work at all -# include -# include -# include -# include -# include +# include +# include +# include +# include +# include #elif defined(ASIO_WINDOWS) or defined(__CYGWIN__) -# include -# include -# include +# include +# include +# include // do not reorder! -# include -# include +# include +# include #else -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include #endif #ifdef ASIO_HAS_PTHREADS -# include +# include #endif #if defined(ASIO_HAS_IO_URING) -# include +# include #endif #if defined(ASIO_HAS_KQUEUE) -# include -# include +# include +# include #endif #if defined(ASIO_HAS_DEV_POLL) -# include +# include #endif #if defined(ASIO_HAS_EPOLL) -# include -# if defined(ASIO_HAS_TIMERFD) -# include -# endif +# include +# if defined(ASIO_HAS_TIMERFD) +# include +# endif #endif #if defined(ASIO_HAS_EVENTFD) -# include +# include #endif #if defined(ASIO_HAS_PIPE) and defined(ASIO_HAS_IOCP) -# include +# include #endif #if defined(ASIO_USE_SSL) -# if defined(ASIO_USE_WOLFSSL) -# include -# endif // defined(ASIO_USE_WOLFSSL) +# if defined(ASIO_USE_WOLFSSL) +# include +# endif // defined(ASIO_USE_WOLFSSL) -# include -# include -# if !defined(OPENSSL_NO_ENGINE) -# include -# endif // !defined(OPENSSL_NO_ENGINE) -# include -# include -# include -# include -# include +# include +# include +# if !defined(OPENSSL_NO_ENGINE) +# include +# endif // !defined(OPENSSL_NO_ENGINE) +# include +# include +# include +# include +# include #endif #undef ASIO_IN_GMF diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 0517cdf366..61d6daf13d 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -7,9 +7,12 @@ project(asio_examples DESCRIPTION "Examples for Asio" LANGUAGES CXX) if(PROJECT_IS_TOP_LEVEL) find_package(asio REQUIRED) else() - # add_subdirectory(cpp11) - # add_subdirectory(cpp14) - # add_subdirectory(cpp17) + if(APPLE) + add_subdirectory(cpp11) + add_subdirectory(cpp14) + # CoroutineTS is deperecated! + # NO! add_subdirectory(cpp17) + endif() add_subdirectory(cpp20) endif() diff --git a/src/tests/unit/CMakeLists.txt b/src/tests/unit/CMakeLists.txt index 7ae77e39b8..39319485b3 100644 --- a/src/tests/unit/CMakeLists.txt +++ b/src/tests/unit/CMakeLists.txt @@ -142,3 +142,30 @@ foreach(program ${test_PROGRAMS}) add_test(NAME ${target_prefix}${target} COMMAND "${target_prefix}${target}") endforeach() + +# FIXME: does not work on CI yet! CK +if(APPLE) + # test if the targets are usable from the install directory + add_test( + NAME install-to-stagedir + COMMAND + ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix + ${CMAKE_BINARY_DIR}/stagedir --config $ + ) + add_test( + NAME find-package-test + COMMAND + ${CMAKE_CTEST_COMMAND} # --verbose + --output-on-failure -C $ --build-and-test + "${CMAKE_SOURCE_DIR}/src/examples" + "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" --build-generator + ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} + --build-options # + "-D ASIO_IMPORT_STD=${ASIO_IMPORT_STD}" + "-D CMAKE_BUILD_TYPE=$" + "-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" + "-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" + "-D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" + "-D CMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/stagedir" + ) +endif() diff --git a/src/tests/unit/local/datagram_protocol.cpp b/src/tests/unit/local/datagram_protocol.cpp index 57aecfe375..2390861fbf 100644 --- a/src/tests/unit/local/datagram_protocol.cpp +++ b/src/tests/unit/local/datagram_protocol.cpp @@ -148,82 +148,75 @@ void test() socket1.send(buffer(mutable_char_buffer)); socket1.send(buffer(const_char_buffer)); - socket1.send(null_buffers()); + // XXX socket1.send(null_buffers()); socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); - socket1.send(null_buffers(), in_flags); + // XXX socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); - socket1.send(null_buffers(), in_flags, ec); + // XXX socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), send_handler); socket1.async_send(buffer(const_char_buffer), send_handler); - socket1.async_send(null_buffers(), send_handler); + // XXX socket1.async_send(null_buffers(), send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); - socket1.async_send(null_buffers(), in_flags, send_handler); + // XXX socket1.async_send(null_buffers(), in_flags, send_handler); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint("")); socket1.send_to(buffer(const_char_buffer), dp::endpoint("")); - socket1.send_to(null_buffers(), - dp::endpoint("")); + // XXX socket1.send_to(null_buffers(), dp::endpoint("")); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint(""), in_flags); socket1.send_to(buffer(const_char_buffer), dp::endpoint(""), in_flags); - socket1.send_to(null_buffers(), - dp::endpoint(""), in_flags); + // XXX socket1.send_to(null_buffers(), dp::endpoint(""), in_flags); socket1.send_to(buffer(mutable_char_buffer), dp::endpoint(""), in_flags, ec); socket1.send_to(buffer(const_char_buffer), dp::endpoint(""), in_flags, ec); - socket1.send_to(null_buffers(), - dp::endpoint(""), in_flags, ec); + // XXX socket1.send_to(null_buffers(), dp::endpoint(""), in_flags, ec); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(""), send_handler); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(""), send_handler); - socket1.async_send_to(null_buffers(), - dp::endpoint(""), send_handler); + // XXX socket1.async_send_to(null_buffers(), dp::endpoint(""), send_handler); socket1.async_send_to(buffer(mutable_char_buffer), dp::endpoint(""), in_flags, send_handler); socket1.async_send_to(buffer(const_char_buffer), dp::endpoint(""), in_flags, send_handler); - socket1.async_send_to(null_buffers(), - dp::endpoint(""), in_flags, send_handler); + // XXX socket1.async_send_to(null_buffers(), dp::endpoint(""), in_flags, send_handler); socket1.receive(buffer(mutable_char_buffer)); - socket1.receive(null_buffers()); + // XXX socket1.receive(null_buffers()); socket1.receive(buffer(mutable_char_buffer), in_flags); - socket1.receive(null_buffers(), in_flags); + // XXX socket1.receive(null_buffers(), in_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, ec); - socket1.receive(null_buffers(), in_flags, ec); + // XXX socket1.receive(null_buffers(), in_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), receive_handler); - socket1.async_receive(null_buffers(), receive_handler); + // XXX socket1.async_receive(null_buffers(), receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, receive_handler); - socket1.async_receive(null_buffers(), in_flags, receive_handler); + // XXX socket1.async_receive(null_buffers(), in_flags, receive_handler); dp::endpoint endpoint; socket1.receive_from(buffer(mutable_char_buffer), endpoint); - socket1.receive_from(null_buffers(), endpoint); + // XXX socket1.receive_from(null_buffers(), endpoint); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags); - socket1.receive_from(null_buffers(), endpoint, in_flags); + // XXX socket1.receive_from(null_buffers(), endpoint, in_flags); socket1.receive_from(buffer(mutable_char_buffer), endpoint, in_flags, ec); - socket1.receive_from(null_buffers(), endpoint, in_flags, ec); + // XXX socket1.receive_from(null_buffers(), endpoint, in_flags, ec); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, receive_handler); - socket1.async_receive_from(null_buffers(), - endpoint, receive_handler); + // XXX socket1.async_receive_from(null_buffers(), endpoint, receive_handler); socket1.async_receive_from(buffer(mutable_char_buffer), endpoint, in_flags, receive_handler); - socket1.async_receive_from(null_buffers(), - endpoint, in_flags, receive_handler); + // XXX socket1.async_receive_from(null_buffers(), endpoint, in_flags, receive_handler); } catch (std::exception&) { diff --git a/src/tests/unit/local/stream_protocol.cpp b/src/tests/unit/local/stream_protocol.cpp index 9200e99d2b..5915436505 100644 --- a/src/tests/unit/local/stream_protocol.cpp +++ b/src/tests/unit/local/stream_protocol.cpp @@ -156,51 +156,51 @@ void test() socket1.send(buffer(mutable_char_buffer)); socket1.send(buffer(const_char_buffer)); - socket1.send(null_buffers()); + // XXX socket1.send(null_buffers()); socket1.send(buffer(mutable_char_buffer), in_flags); socket1.send(buffer(const_char_buffer), in_flags); - socket1.send(null_buffers(), in_flags); + // XXX socket1.send(null_buffers(), in_flags); socket1.send(buffer(mutable_char_buffer), in_flags, ec); socket1.send(buffer(const_char_buffer), in_flags, ec); - socket1.send(null_buffers(), in_flags, ec); + // XXX socket1.send(null_buffers(), in_flags, ec); socket1.async_send(buffer(mutable_char_buffer), send_handler); socket1.async_send(buffer(const_char_buffer), send_handler); - socket1.async_send(null_buffers(), send_handler); + // XXX socket1.async_send(null_buffers(), send_handler); socket1.async_send(buffer(mutable_char_buffer), in_flags, send_handler); socket1.async_send(buffer(const_char_buffer), in_flags, send_handler); - socket1.async_send(null_buffers(), in_flags, send_handler); + // XXX socket1.async_send(null_buffers(), in_flags, send_handler); socket1.receive(buffer(mutable_char_buffer)); - socket1.receive(null_buffers()); + // XXX socket1.receive(null_buffers()); socket1.receive(buffer(mutable_char_buffer), in_flags); - socket1.receive(null_buffers(), in_flags); + // XXX socket1.receive(null_buffers(), in_flags); socket1.receive(buffer(mutable_char_buffer), in_flags, ec); - socket1.receive(null_buffers(), in_flags, ec); + // XXX socket1.receive(null_buffers(), in_flags, ec); socket1.async_receive(buffer(mutable_char_buffer), receive_handler); - socket1.async_receive(null_buffers(), receive_handler); + // XXX socket1.async_receive(null_buffers(), receive_handler); socket1.async_receive(buffer(mutable_char_buffer), in_flags, receive_handler); - socket1.async_receive(null_buffers(), in_flags, receive_handler); + // XXX socket1.async_receive(null_buffers(), in_flags, receive_handler); socket1.write_some(buffer(mutable_char_buffer)); socket1.write_some(buffer(const_char_buffer)); - socket1.write_some(null_buffers()); + // XXX socket1.write_some(null_buffers()); socket1.write_some(buffer(mutable_char_buffer), ec); socket1.write_some(buffer(const_char_buffer), ec); - socket1.write_some(null_buffers(), ec); + // XXX socket1.write_some(null_buffers(), ec); socket1.async_write_some(buffer(mutable_char_buffer), write_some_handler); socket1.async_write_some(buffer(const_char_buffer), write_some_handler); - socket1.async_write_some(null_buffers(), write_some_handler); + // XXX socket1.async_write_some(null_buffers(), write_some_handler); socket1.read_some(buffer(mutable_char_buffer)); socket1.read_some(buffer(mutable_char_buffer), ec); - socket1.read_some(null_buffers(), ec); + // XXX socket1.read_some(null_buffers(), ec); socket1.async_read_some(buffer(mutable_char_buffer), read_some_handler); - socket1.async_read_some(null_buffers(), read_some_handler); + // XXX socket1.async_read_some(null_buffers(), read_some_handler); } catch (std::exception&) { From e3f356c759c0e359892c752b08f70a2ce61569b3 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Thu, 12 Mar 2026 22:05:14 +0100 Subject: [PATCH 52/57] Prevent errors with deprecated interfaces on CI The windows preset flags are to pedantic yet. --- CMakeLists.txt | 1 + CMakePresets.json | 2 +- module/asio-gmf.h | 122 +++++++++++++++--------------- src/examples/CMakeLists.txt | 2 +- src/examples/cpp11/Makefile.am | 14 ++-- src/examples/cpp14/CMakeLists.txt | 7 ++ src/examples/cpp14/Makefile.am | 12 +-- src/tests/unit/CMakeLists.txt | 8 +- 8 files changed, 88 insertions(+), 80 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9be4e76592..918fbe57d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ target_compile_features(asio_header INTERFACE cxx_std_${CMAKE_CXX_STANDARD}) target_compile_definitions( asio_header INTERFACE ASIO_DISABLE_BOOST_CONTEXT_FIBER ASIO_STANDALONE + # FIXME: some of the examples and tests still use deprecated interfaces! CK # TODO(CK): ASIO_NO_DEPRECATED ) if(MSVC) diff --git a/CMakePresets.json b/CMakePresets.json index d10efa872e..1f7f2b3c6e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -68,7 +68,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "/sdl /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc", + "/sdl- /guard:cf /utf-8 /diagnostics:caret /w14165 /w44242 /w44254 /w44263 /w34265 /w34287 /w44296 /w44365 /w44388 /w44464 /w14545 /w14546 /w14547 /w14549 /w14555 /w34619 /w34640 /w24826 /w14905 /w14906 /w14928 /w45038 /W4 /permissive- /volatile:iso /Zc:inline /Zc:preprocessor /Zc:enumTypes /Zc:lambda /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew /EHsc", "CMAKE_EXE_LINKER_FLAGS": "/machine:x64 /guard:cf", "CMAKE_SHARED_LINKER_FLAGS": "/machine:x64 /guard:cf" } diff --git a/module/asio-gmf.h b/module/asio-gmf.h index 35be643359..888e935ae4 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -2,34 +2,34 @@ #define ASIO_IN_GMF #ifndef ASIO_STANDALONE -# define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported +# define ASIO_STANDALONE // sorry, Boost-ified Asio is not yet supported #endif #if defined(_WIN32) and __has_include() -# include +# include #endif #if defined(ASIO_HEADER_ONLY) -# error "ASIO_HEADER_ONLY" makes no sense with this module +# error "ASIO_HEADER_ONLY" makes no sense with this module #endif #if !defined(ASIO_SEPARATE_COMPILATION) -# define ASIO_SEPARATE_COMPILATION +# define ASIO_SEPARATE_COMPILATION #endif #if !defined(ASIO_DISABLE_BUFFER_DEBUGGING) && \ !defined(ASIO_ENABLE_BUFFER_DEBUGGING) -# define ASIO_DISABLE_BUFFER_DEBUGGING +# define ASIO_DISABLE_BUFFER_DEBUGGING #endif #if __has_include() -# include +# include #elif !defined(__APPLE__) -# ifndef ASIO_NO_DEPRECATED -# define ASIO_NO_DEPRECATED -# endif -# undef ASIO_DEPRECATED_MSG -# define ASIO_DISABLE_DEPRECATED_MSG +# ifndef ASIO_NO_DEPRECATED +# define ASIO_NO_DEPRECATED +# endif +# undef ASIO_DEPRECATED_MSG +# define ASIO_DISABLE_DEPRECATED_MSG #endif #define ASIO_MODULE @@ -37,7 +37,7 @@ #include #ifndef ASIO_ENABLE_HANDLER_TRACKING -# define ASIO_STD_CSTDARG_NO_INCLUDE +# define ASIO_STD_CSTDARG_NO_INCLUDE #endif #include "asio/detail/std/all.hpp" @@ -46,76 +46,76 @@ #include #if defined(ASIO_WINDOWS_RUNTIME) // expected to not work at all -# include -# include -# include -# include -# include +# include +# include +# include +# include +# include #elif defined(ASIO_WINDOWS) or defined(__CYGWIN__) -# include -# include -# include +# include +# include +# include // do not reorder! -# include -# include +# include +# include #else -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include #endif #ifdef ASIO_HAS_PTHREADS -# include +# include #endif #if defined(ASIO_HAS_IO_URING) -# include +# include #endif #if defined(ASIO_HAS_KQUEUE) -# include -# include +# include +# include #endif #if defined(ASIO_HAS_DEV_POLL) -# include +# include #endif #if defined(ASIO_HAS_EPOLL) -# include -# if defined(ASIO_HAS_TIMERFD) -# include -# endif +# include +# if defined(ASIO_HAS_TIMERFD) +# include +# endif #endif #if defined(ASIO_HAS_EVENTFD) -# include +# include #endif #if defined(ASIO_HAS_PIPE) and defined(ASIO_HAS_IOCP) -# include +# include #endif #if defined(ASIO_USE_SSL) -# if defined(ASIO_USE_WOLFSSL) -# include -# endif // defined(ASIO_USE_WOLFSSL) +# if defined(ASIO_USE_WOLFSSL) +# include +# endif // defined(ASIO_USE_WOLFSSL) -# include -# include -# if !defined(OPENSSL_NO_ENGINE) -# include -# endif // !defined(OPENSSL_NO_ENGINE) -# include -# include -# include -# include -# include +# include +# include +# if !defined(OPENSSL_NO_ENGINE) +# include +# endif // !defined(OPENSSL_NO_ENGINE) +# include +# include +# include +# include +# include #endif #undef ASIO_IN_GMF diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 61d6daf13d..72ec9f3b08 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -8,7 +8,7 @@ if(PROJECT_IS_TOP_LEVEL) find_package(asio REQUIRED) else() if(APPLE) - add_subdirectory(cpp11) + # partly deprecated! add_subdirectory(cpp11) add_subdirectory(cpp14) # CoroutineTS is deperecated! # NO! add_subdirectory(cpp17) diff --git a/src/examples/cpp11/Makefile.am b/src/examples/cpp11/Makefile.am index a132a469ff..2e012f414c 100644 --- a/src/examples/cpp11/Makefile.am +++ b/src/examples/cpp11/Makefile.am @@ -54,11 +54,11 @@ noinst_PROGRAMS = \ operations/composed_6 \ operations/composed_7 \ operations/composed_8 \ - parallel_group/ranged_wait_for_all \ - parallel_group/wait_for_all \ - parallel_group/wait_for_one \ - parallel_group/wait_for_one_error \ - parallel_group/wait_for_one_success \ + parallel_group/ranged_wait_for_all \ + parallel_group/wait_for_all \ + parallel_group/wait_for_one \ + parallel_group/wait_for_one_error \ + parallel_group/wait_for_one_success \ porthopper/client \ porthopper/server \ services/daytime_client \ @@ -109,8 +109,8 @@ endif if HAVE_BOOST_COROUTINE noinst_PROGRAMS += \ - spawn/echo_server \ - spawn/parallel_grep + spawn/echo_server \ + spawn/parallel_grep endif noinst_HEADERS = \ diff --git a/src/examples/cpp14/CMakeLists.txt b/src/examples/cpp14/CMakeLists.txt index 2181e10a64..c3339c6043 100644 --- a/src/examples/cpp14/CMakeLists.txt +++ b/src/examples/cpp14/CMakeLists.txt @@ -24,6 +24,13 @@ set(noinst_PROGRAMS # XXX operations/composed_6.cpp # XXX operations/composed_7.cpp # XXX operations/composed_8.cpp + # experimental ... + # XXX parallel_group/parallel_sort.cpp + # XXX parallel_group/ranged_wait_for_all.cpp + # XXX parallel_group/wait_for_all.cpp + # XXX parallel_group/wait_for_one.cpp + # XXX parallel_group/wait_for_one_error.cpp + # XXX parallel_group/wait_for_one_success.cpp ) foreach(source ${noinst_PROGRAMS}) diff --git a/src/examples/cpp14/Makefile.am b/src/examples/cpp14/Makefile.am index 2ddf12a8a2..3677304dde 100644 --- a/src/examples/cpp14/Makefile.am +++ b/src/examples/cpp14/Makefile.am @@ -43,12 +43,12 @@ noinst_PROGRAMS = \ operations/composed_6 \ operations/composed_7 \ operations/composed_8 \ - parallel_group/parallel_sort \ - parallel_group/ranged_wait_for_all \ - parallel_group/wait_for_all \ - parallel_group/wait_for_one \ - parallel_group/wait_for_one_error \ - parallel_group/wait_for_one_success + parallel_group/parallel_sort \ + parallel_group/ranged_wait_for_all \ + parallel_group/wait_for_all \ + parallel_group/wait_for_one \ + parallel_group/wait_for_one_error \ + parallel_group/wait_for_one_success AM_CXXFLAGS = -I$(srcdir)/../../../include diff --git a/src/tests/unit/CMakeLists.txt b/src/tests/unit/CMakeLists.txt index 39319485b3..5121a2420c 100644 --- a/src/tests/unit/CMakeLists.txt +++ b/src/tests/unit/CMakeLists.txt @@ -112,11 +112,11 @@ set(test_PROGRAMS windows/basic_overlapped_handle windows/basic_random_access_handle windows/basic_stream_handle - windows/object_handle + # FIXME: windows/object_handle windows/overlapped_handle - windows/overlapped_ptr - windows/random_access_handle - windows/stream_handle + # FIXME: windows/overlapped_ptr + # FIXME: windows/random_access_handle + # FIXME: windows/stream_handle # XXX write # XXX write_at ) From 00f727474eb7eb0eaeec13b2de44ee77f0734e18 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Thu, 12 Mar 2026 23:15:02 +0100 Subject: [PATCH 53/57] Use clang-format for new added headers --- .clang-format | 86 +++++++++++++++++++ GNUmakefile | 1 + include/asio/detail/std/algorithm.hpp | 26 +++--- include/asio/detail/std/any.hpp | 26 +++--- include/asio/detail/std/array.hpp | 26 +++--- include/asio/detail/std/atomic.hpp | 26 +++--- include/asio/detail/std/cassert.hpp | 26 +++--- include/asio/detail/std/cctype.hpp | 26 +++--- include/asio/detail/std/cerrno.hpp | 26 +++--- include/asio/detail/std/chrono.hpp | 26 +++--- include/asio/detail/std/climits.hpp | 26 +++--- include/asio/detail/std/codecvt.hpp | 26 +++--- include/asio/detail/std/concepts.hpp | 26 +++--- .../asio/detail/std/condition_variable.hpp | 26 +++--- include/asio/detail/std/coroutine.hpp | 26 +++--- include/asio/detail/std/csignal.hpp | 26 +++--- include/asio/detail/std/cstdarg.hpp | 26 +++--- include/asio/detail/std/cstddef.hpp | 26 +++--- include/asio/detail/std/cstdint.hpp | 26 +++--- include/asio/detail/std/cstdio.hpp | 26 +++--- include/asio/detail/std/cstdlib.hpp | 26 +++--- include/asio/detail/std/cstring.hpp | 26 +++--- include/asio/detail/std/deque.hpp | 26 +++--- include/asio/detail/std/exception.hpp | 26 +++--- include/asio/detail/std/functional.hpp | 26 +++--- include/asio/detail/std/future.hpp | 26 +++--- include/asio/detail/std/iosfwd.hpp | 26 +++--- include/asio/detail/std/istream.hpp | 26 +++--- include/asio/detail/std/iterator.hpp | 26 +++--- include/asio/detail/std/limits.hpp | 26 +++--- include/asio/detail/std/list.hpp | 26 +++--- include/asio/detail/std/locale.hpp | 26 +++--- include/asio/detail/std/memory.hpp | 26 +++--- include/asio/detail/std/mutex.hpp | 26 +++--- include/asio/detail/std/new.hpp | 26 +++--- include/asio/detail/std/optional.hpp | 26 +++--- include/asio/detail/std/ostream.hpp | 26 +++--- include/asio/detail/std/source_location.hpp | 26 +++--- include/asio/detail/std/sstream.hpp | 26 +++--- include/asio/detail/std/stdexcept.hpp | 26 +++--- include/asio/detail/std/streambuf.hpp | 26 +++--- include/asio/detail/std/string.hpp | 26 +++--- include/asio/detail/std/string_view.hpp | 26 +++--- include/asio/detail/std/system_error.hpp | 26 +++--- include/asio/detail/std/thread.hpp | 26 +++--- include/asio/detail/std/tuple.hpp | 26 +++--- include/asio/detail/std/type_traits.hpp | 26 +++--- include/asio/detail/std/typeinfo.hpp | 26 +++--- include/asio/detail/std/utility.hpp | 26 +++--- include/asio/detail/std/variant.hpp | 26 +++--- include/asio/detail/std/vector.hpp | 26 +++--- include/asio/detail/std/version.hpp | 26 +++--- module/asio-gmf.h | 3 +- 53 files changed, 738 insertions(+), 652 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..abbbd40893 --- /dev/null +++ b/.clang-format @@ -0,0 +1,86 @@ +--- +# We'll use defaults from the Mozilla style, +# with 2 columns indentation. +BasedOnStyle: Mozilla +IndentPPDirectives: AfterHash +IndentCaseLabels: false +UseTab: Never +--- +Language: Cpp +AccessModifierOffset: -2 +ContinuationIndentWidth: 2 +IndentWidth: 2 +Standard: Auto +# +### see BinPack... too +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +# +AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: false +AllowShortNamespacesOnASingleLine: false +# +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +# +BreakAfterOpenBracketFunction: true +BreakBeforeCloseBracketFunction: true +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: true + AfterControlStatement: true + AfterEnum: false + AfterFunction: true + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: true + AfterExternBlock: true + BeforeCatch: true + BeforeElse: true + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +# +### BinPack... args will not be on the same line +BinPackArguments: false +BinPackLongBracedList: false +BinPackParameters: AlwaysOnePerLine +# +# TBD: AlwaysBreakTemplateDeclarations: MultiLine +BreakBeforeInheritanceComma: true +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +# +# TBD: Should we only use 80 columns? +ColumnLimit: 99 +# +DerivePointerAlignment: true +FixNamespaceComments: true +# SpaceAfterTemplateKeyword: true +# PenaltyReturnTypeOnItsOwnLine: 60 +# +SortIncludes: false +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^("asio.*|)' + Priority: 2 + - Regex: '^<(Poco|spdlog|doctest|zmqpp|boost|gtest|gmock|fmt|json|openssl)/' + Priority: 3 + - Regex: '<[[:alnum:].]+>' + Priority: 4 +# all other headers first! + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '(_test)?$' +# +--- diff --git a/GNUmakefile b/GNUmakefile index 5a2dcd9c91..c3b0c52f30 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -78,6 +78,7 @@ install test: build format: git ls-files ::*.cmake ::*CMakeLists.txt | xargs gersemi -i + clang-format -i include/asio/detail/std/*.hpp module/asio-gmf.h CMakePresets.json ############################################################# # Anything we don't know how to build will use this rule. diff --git a/include/asio/detail/std/algorithm.hpp b/include/asio/detail/std/algorithm.hpp index bf7b3bb009..38a9443cb5 100644 --- a/include/asio/detail/std/algorithm.hpp +++ b/include/asio/detail/std/algorithm.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ALGORITHM_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ALGORITHM_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ALGORITHM_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ALGORITHM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/any.hpp b/include/asio/detail/std/any.hpp index 387d99f241..58b5c6150f 100644 --- a/include/asio/detail/std/any.hpp +++ b/include/asio/detail/std/any.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ANY_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ANY_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ANY_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ANY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/array.hpp b/include/asio/detail/std/array.hpp index f25e94778e..3fe496da3a 100644 --- a/include/asio/detail/std/array.hpp +++ b/include/asio/detail/std/array.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ARRAY_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ARRAY_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ARRAY_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ARRAY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/atomic.hpp b/include/asio/detail/std/atomic.hpp index 968d583af0..b78553299a 100644 --- a/include/asio/detail/std/atomic.hpp +++ b/include/asio/detail/std/atomic.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ATOMIC_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ATOMIC_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ATOMIC_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ATOMIC_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cassert.hpp b/include/asio/detail/std/cassert.hpp index 98eec1eba0..3d5c04514e 100644 --- a/include/asio/detail/std/cassert.hpp +++ b/include/asio/detail/std/cassert.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CASSERT_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CASSERT_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CASSERT_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 1 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CASSERT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cctype.hpp b/include/asio/detail/std/cctype.hpp index 5a6cb573f1..2188ed398b 100644 --- a/include/asio/detail/std/cctype.hpp +++ b/include/asio/detail/std/cctype.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CCTYPE_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CCTYPE_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CCTYPE_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CCTYPE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cerrno.hpp b/include/asio/detail/std/cerrno.hpp index 4f9f61cbc3..0fa93e457e 100644 --- a/include/asio/detail/std/cerrno.hpp +++ b/include/asio/detail/std/cerrno.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CERRNO_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CERRNO_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CERRNO_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 1 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CERRNO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/chrono.hpp b/include/asio/detail/std/chrono.hpp index 724c50fecc..fa41fcba1f 100644 --- a/include/asio/detail/std/chrono.hpp +++ b/include/asio/detail/std/chrono.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CHRONO_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CHRONO_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CHRONO_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CHRONO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/climits.hpp b/include/asio/detail/std/climits.hpp index d16ecdcc58..ca2d0978d3 100644 --- a/include/asio/detail/std/climits.hpp +++ b/include/asio/detail/std/climits.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CLIMITS_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CLIMITS_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CLIMITS_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 1 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CLIMITS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/codecvt.hpp b/include/asio/detail/std/codecvt.hpp index 83a2f03eea..cf24c6cb9e 100644 --- a/include/asio/detail/std/codecvt.hpp +++ b/include/asio/detail/std/codecvt.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CODECVT_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CODECVT_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CODECVT_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CODECVT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/concepts.hpp b/include/asio/detail/std/concepts.hpp index 8252e2f538..019efe3115 100644 --- a/include/asio/detail/std/concepts.hpp +++ b/include/asio/detail/std/concepts.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CONCEPTS_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONCEPTS_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CONCEPTS_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONCEPTS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/condition_variable.hpp b/include/asio/detail/std/condition_variable.hpp index 1eb1f13ebf..18e3cbad07 100644 --- a/include/asio/detail/std/condition_variable.hpp +++ b/include/asio/detail/std/condition_variable.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CONDITION_VARIABLE_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONDITION_VARIABLE_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CONDITION_VARIABLE_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CONDITION_VARIABLE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/coroutine.hpp b/include/asio/detail/std/coroutine.hpp index e2058a7be8..1c4f5e8ddc 100644 --- a/include/asio/detail/std/coroutine.hpp +++ b/include/asio/detail/std/coroutine.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_COROUTINE_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_COROUTINE_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_COROUTINE_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_COROUTINE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/csignal.hpp b/include/asio/detail/std/csignal.hpp index 7a2b9b5994..20a3a2b831 100644 --- a/include/asio/detail/std/csignal.hpp +++ b/include/asio/detail/std/csignal.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSIGNAL_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSIGNAL_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSIGNAL_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 1 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSIGNAL_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cstdarg.hpp b/include/asio/detail/std/cstdarg.hpp index 0bf09e1549..b70dab2b04 100644 --- a/include/asio/detail/std/cstdarg.hpp +++ b/include/asio/detail/std/cstdarg.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDARG_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDARG_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDARG_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 1 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDARG_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cstddef.hpp b/include/asio/detail/std/cstddef.hpp index adbed2585c..8fb56d59f0 100644 --- a/include/asio/detail/std/cstddef.hpp +++ b/include/asio/detail/std/cstddef.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDDEF_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDDEF_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDDEF_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDDEF_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cstdint.hpp b/include/asio/detail/std/cstdint.hpp index dddf6b1d65..749967600e 100644 --- a/include/asio/detail/std/cstdint.hpp +++ b/include/asio/detail/std/cstdint.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDINT_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDINT_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDINT_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 1 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDINT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cstdio.hpp b/include/asio/detail/std/cstdio.hpp index ad2dfab464..6733bc392e 100644 --- a/include/asio/detail/std/cstdio.hpp +++ b/include/asio/detail/std/cstdio.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDIO_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDIO_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDIO_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDIO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cstdlib.hpp b/include/asio/detail/std/cstdlib.hpp index b87001d210..b33c3b5f1d 100644 --- a/include/asio/detail/std/cstdlib.hpp +++ b/include/asio/detail/std/cstdlib.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDLIB_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDLIB_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTDLIB_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTDLIB_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/cstring.hpp b/include/asio/detail/std/cstring.hpp index e1f828b6e1..a03a9272c0 100644 --- a/include/asio/detail/std/cstring.hpp +++ b/include/asio/detail/std/cstring.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTRING_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTRING_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_CSTRING_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_CSTRING_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/deque.hpp b/include/asio/detail/std/deque.hpp index 0ec6527ece..280f49c4cd 100644 --- a/include/asio/detail/std/deque.hpp +++ b/include/asio/detail/std/deque.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_DEQUE_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_DEQUE_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_DEQUE_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_DEQUE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/exception.hpp b/include/asio/detail/std/exception.hpp index c479f82f79..4724bd116e 100644 --- a/include/asio/detail/std/exception.hpp +++ b/include/asio/detail/std/exception.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_EXCEPTION_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_EXCEPTION_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_EXCEPTION_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_EXCEPTION_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/functional.hpp b/include/asio/detail/std/functional.hpp index 3cba31c10a..40ff72b115 100644 --- a/include/asio/detail/std/functional.hpp +++ b/include/asio/detail/std/functional.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_FUNCTIONAL_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUNCTIONAL_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_FUNCTIONAL_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUNCTIONAL_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/future.hpp b/include/asio/detail/std/future.hpp index 3f1740070e..4429040e1b 100644 --- a/include/asio/detail/std/future.hpp +++ b/include/asio/detail/std/future.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_FUTURE_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUTURE_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_FUTURE_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_FUTURE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/iosfwd.hpp b/include/asio/detail/std/iosfwd.hpp index 280ffef3a8..fa95343dc3 100644 --- a/include/asio/detail/std/iosfwd.hpp +++ b/include/asio/detail/std/iosfwd.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_IOSFWD_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_IOSFWD_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_IOSFWD_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_IOSFWD_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/istream.hpp b/include/asio/detail/std/istream.hpp index 44b542e9d7..df5a88e144 100644 --- a/include/asio/detail/std/istream.hpp +++ b/include/asio/detail/std/istream.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ISTREAM_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ISTREAM_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ISTREAM_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ISTREAM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/iterator.hpp b/include/asio/detail/std/iterator.hpp index 12077dac3a..be27bf7aa8 100644 --- a/include/asio/detail/std/iterator.hpp +++ b/include/asio/detail/std/iterator.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ITERATOR_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ITERATOR_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_ITERATOR_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_ITERATOR_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/limits.hpp b/include/asio/detail/std/limits.hpp index 1a678ad03d..1be0e9fbbd 100644 --- a/include/asio/detail/std/limits.hpp +++ b/include/asio/detail/std/limits.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_LIMITS_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIMITS_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_LIMITS_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIMITS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/list.hpp b/include/asio/detail/std/list.hpp index 20f9c91cf9..102a3c3393 100644 --- a/include/asio/detail/std/list.hpp +++ b/include/asio/detail/std/list.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_LIST_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIST_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_LIST_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LIST_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/locale.hpp b/include/asio/detail/std/locale.hpp index d62adf46c9..8881bd530d 100644 --- a/include/asio/detail/std/locale.hpp +++ b/include/asio/detail/std/locale.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_LOCALE_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LOCALE_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_LOCALE_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_LOCALE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/memory.hpp b/include/asio/detail/std/memory.hpp index aa6b17bff8..311290ec33 100644 --- a/include/asio/detail/std/memory.hpp +++ b/include/asio/detail/std/memory.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_MEMORY_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MEMORY_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_MEMORY_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MEMORY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/mutex.hpp b/include/asio/detail/std/mutex.hpp index e61e981db3..5bfad1f5fd 100644 --- a/include/asio/detail/std/mutex.hpp +++ b/include/asio/detail/std/mutex.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_MUTEX_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MUTEX_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_MUTEX_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_MUTEX_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/new.hpp b/include/asio/detail/std/new.hpp index 07423e1c55..53133ebaac 100644 --- a/include/asio/detail/std/new.hpp +++ b/include/asio/detail/std/new.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_NEW_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_NEW_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_NEW_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_NEW_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/optional.hpp b/include/asio/detail/std/optional.hpp index 937ba5e726..e15f5b9b79 100644 --- a/include/asio/detail/std/optional.hpp +++ b/include/asio/detail/std/optional.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_OPTIONAL_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OPTIONAL_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_OPTIONAL_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OPTIONAL_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/ostream.hpp b/include/asio/detail/std/ostream.hpp index 9fb2a0adab..a4ee2811f3 100644 --- a/include/asio/detail/std/ostream.hpp +++ b/include/asio/detail/std/ostream.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_OSTREAM_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OSTREAM_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_OSTREAM_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_OSTREAM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/source_location.hpp b/include/asio/detail/std/source_location.hpp index e74459d045..6948fb7abc 100644 --- a/include/asio/detail/std/source_location.hpp +++ b/include/asio/detail/std/source_location.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_SOURCE_LOCATION_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SOURCE_LOCATION_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_SOURCE_LOCATION_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SOURCE_LOCATION_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/sstream.hpp b/include/asio/detail/std/sstream.hpp index 322bbd864b..37851e63c3 100644 --- a/include/asio/detail/std/sstream.hpp +++ b/include/asio/detail/std/sstream.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_SSTREAM_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SSTREAM_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_SSTREAM_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SSTREAM_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/stdexcept.hpp b/include/asio/detail/std/stdexcept.hpp index c8a4f78417..e41eed6255 100644 --- a/include/asio/detail/std/stdexcept.hpp +++ b/include/asio/detail/std/stdexcept.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STDEXCEPT_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STDEXCEPT_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STDEXCEPT_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STDEXCEPT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/streambuf.hpp b/include/asio/detail/std/streambuf.hpp index 236cd9b116..310d9042ee 100644 --- a/include/asio/detail/std/streambuf.hpp +++ b/include/asio/detail/std/streambuf.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STREAMBUF_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STREAMBUF_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STREAMBUF_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STREAMBUF_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/string.hpp b/include/asio/detail/std/string.hpp index f9585a2f5a..833e6545a6 100644 --- a/include/asio/detail/std/string.hpp +++ b/include/asio/detail/std/string.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STRING_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STRING_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/string_view.hpp b/include/asio/detail/std/string_view.hpp index 0bdbb09e50..3a4edbcc87 100644 --- a/include/asio/detail/std/string_view.hpp +++ b/include/asio/detail/std/string_view.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STRING_VIEW_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_VIEW_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_STRING_VIEW_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_STRING_VIEW_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/system_error.hpp b/include/asio/detail/std/system_error.hpp index a237008f7d..7fafd01cc4 100644 --- a/include/asio/detail/std/system_error.hpp +++ b/include/asio/detail/std/system_error.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_SYSTEM_ERROR_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SYSTEM_ERROR_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_SYSTEM_ERROR_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_SYSTEM_ERROR_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/thread.hpp b/include/asio/detail/std/thread.hpp index 6ebff541bc..53aa829f01 100644 --- a/include/asio/detail/std/thread.hpp +++ b/include/asio/detail/std/thread.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_THREAD_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_THREAD_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_THREAD_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_THREAD_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/tuple.hpp b/include/asio/detail/std/tuple.hpp index c3b96ee5c3..27459eff48 100644 --- a/include/asio/detail/std/tuple.hpp +++ b/include/asio/detail/std/tuple.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_TUPLE_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TUPLE_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_TUPLE_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TUPLE_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/type_traits.hpp b/include/asio/detail/std/type_traits.hpp index 9e02b6b592..ada8e8d119 100644 --- a/include/asio/detail/std/type_traits.hpp +++ b/include/asio/detail/std/type_traits.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_TYPE_TRAITS_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPE_TRAITS_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_TYPE_TRAITS_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPE_TRAITS_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/typeinfo.hpp b/include/asio/detail/std/typeinfo.hpp index db2250245e..7d894af388 100644 --- a/include/asio/detail/std/typeinfo.hpp +++ b/include/asio/detail/std/typeinfo.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_TYPEINFO_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPEINFO_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_TYPEINFO_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_TYPEINFO_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/utility.hpp b/include/asio/detail/std/utility.hpp index 5860fe474c..bec2cbd158 100644 --- a/include/asio/detail/std/utility.hpp +++ b/include/asio/detail/std/utility.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_UTILITY_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_UTILITY_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_UTILITY_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_UTILITY_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/variant.hpp b/include/asio/detail/std/variant.hpp index ab25f23690..87f1172afa 100644 --- a/include/asio/detail/std/variant.hpp +++ b/include/asio/detail/std/variant.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_VARIANT_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VARIANT_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_VARIANT_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VARIANT_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/vector.hpp b/include/asio/detail/std/vector.hpp index f471a8a3c4..c8f09ca717 100644 --- a/include/asio/detail/std/vector.hpp +++ b/include/asio/detail/std/vector.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_VECTOR_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VECTOR_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_VECTOR_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 0 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VECTOR_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 0 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/include/asio/detail/std/version.hpp b/include/asio/detail/std/version.hpp index 9da8501252..7001caba03 100644 --- a/include/asio/detail/std/version.hpp +++ b/include/asio/detail/std/version.hpp @@ -8,23 +8,23 @@ #if !defined(ASIO_MODULE) // traditional (header-only) path. -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_VERSION_NO_INCLUDE -# include +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VERSION_NO_INCLUDE +# include +# endif # endif -# endif #else // module path. -# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) +# if defined(ASIO_HAS_IMPORT_STD) && !defined(ASIO_IN_GMF) && !defined(ASIO_IN_MODULE_PURVIEW) import std; -# endif -# if defined(ASIO_IN_GMF) -# ifndef ASIO_DISABLE_STD_INCLUDES -# ifndef ASIO_STD_VERSION_NO_INCLUDE -# if !defined(ASIO_HAS_IMPORT_STD) || 1 -# include +# endif +# if defined(ASIO_IN_GMF) +# ifndef ASIO_DISABLE_STD_INCLUDES +# ifndef ASIO_STD_VERSION_NO_INCLUDE +# if !defined(ASIO_HAS_IMPORT_STD) || 1 +# include +# endif +# endif # endif -# endif # endif -# endif #endif diff --git a/module/asio-gmf.h b/module/asio-gmf.h index 888e935ae4..87b8fade38 100644 --- a/module/asio-gmf.h +++ b/module/asio-gmf.h @@ -17,8 +17,7 @@ # define ASIO_SEPARATE_COMPILATION #endif -#if !defined(ASIO_DISABLE_BUFFER_DEBUGGING) && \ - !defined(ASIO_ENABLE_BUFFER_DEBUGGING) +#if !defined(ASIO_DISABLE_BUFFER_DEBUGGING) && !defined(ASIO_ENABLE_BUFFER_DEBUGGING) # define ASIO_DISABLE_BUFFER_DEBUGGING #endif From db48de62fede7c43a76b85ae9a46c26ba9ce2de5 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Mon, 16 Mar 2026 08:41:02 +0100 Subject: [PATCH 54/57] Try to fix round trip test on CI Only for Windows and APPLE now Make some timer test faster, but not too fast --- CMakeLists.txt | 1 + CMakePresets.json | 40 ++++++----- GNUmakefile | 11 +-- cmake/enable_import_std.cmake | 112 +++++++++++++++++++++++------- src/examples/CMakeLists.txt | 4 ++ src/examples/cpp20/CMakeLists.txt | 11 +-- src/tests/unit/CMakeLists.txt | 9 ++- src/tests/unit/strand.cpp | 10 +-- src/tests/unit/system_timer.cpp | 62 ++++++++--------- 9 files changed, 169 insertions(+), 91 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 918fbe57d8..5b2a052625 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.30...4.3) +#FIXME: include(cmake/prelude.cmake) include(cmake/enable_import_std.cmake) project( diff --git a/CMakePresets.json b/CMakePresets.json index 1f7f2b3c6e..6f8a2c93e0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -28,13 +28,15 @@ "generator": "Ninja Multi-Config", "binaryDir": "${sourceDir}/build/${presetName}", "cacheVariables": { - "CMAKE_CXX_EXTENSIONS": false, - "CMAKE_EXPORT_COMPILE_COMMANDS": true, - "CMAKE_INSTALL_MESSAGE": "LAZY", - "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false, + "ASIO_IMPORT_STD": true, + "ASIO_BUILD_EXAMPLES": true, + "CMAKE_CXX_EXTENSIONS": true, "CMAKE_CXX_SCAN_FOR_MODULES": true, "CMAKE_CXX_STANDARD": "23", - "ASIO_IMPORT_STD": false + "CMAKE_CXX_STANDARD_REQUIRED": true, + "CMAKE_EXPORT_COMPILE_COMMANDS": true, + "CMAKE_INSTALL_MESSAGE": "LAZY", + "CMAKE_SKIP_TEST_ALL_DEPENDENCY": false }, "environment": { "CTEST_OUTPUT_ON_FAILURE": "ON" @@ -58,7 +60,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": - "-fstack-protector-strong -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wno-undef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast" + "-fstack-protector-strong -Wall -Wextra -Wpedantic -Wno-conversion -Wno-sign-conversion -Wcast-qual -Wformat=2 -Wno-undef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wno-null-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wno-old-style-cast" } }, { @@ -84,8 +86,7 @@ "Base configuration for Windows using MSVC toolchain (requires Developer Command Prompt)", "cacheVariables": { "CMAKE_C_COMPILER": "cl", - "CMAKE_CXX_COMPILER": "cl", - "ASIO_BUILD_EXAMPLES": true + "CMAKE_CXX_COMPILER": "cl" }, "condition": { "type": "equals", @@ -103,9 +104,10 @@ "description": "Base configuration for Linux using GCC", "cacheVariables": { "CMAKE_C_COMPILER": "gcc", - "CMAKE_CXX_COMPILER": "g++", - "ASIO_BUILD_EXAMPLES": true, - "ASIO_IMPORT_STD": true + "CMAKE_CXX_COMPILER": "g++" + }, + "environment": { + "CXX_FLAGS": "-stdlib=libstdc++" } }, { @@ -121,9 +123,10 @@ "CMAKE_CXX_COMPILER": "clang++", "CMAKE_CXX_FLAGS": "-stdlib=libc++", "CMAKE_EXE_LINKER_FLAGS": "-lc++abi", - "CMAKE_SHARED_LINKER_FLAGS": "-lc++abi", - "ASIO_BUILD_EXAMPLES": true, - "ASIO_IMPORT_STD": true + "CMAKE_SHARED_LINKER_FLAGS": "-lc++abi" + }, + "environment": { + "CXX_FLAGS": "-stdlib=libc++" } }, { @@ -137,9 +140,12 @@ "Base configuration for Windows using MSYS2 MinGW Clang toolchain", "cacheVariables": { "CMAKE_C_COMPILER": "clang", - "CMAKE_CXX_COMPILER": "clang++", - "ASIO_BUILD_EXAMPLES": true, - "ASIO_IMPORT_STD": true + "CMAKE_CXX_COMPILER": "clang++" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } } ], diff --git a/GNUmakefile b/GNUmakefile index c3b0c52f30..c27405f906 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -12,13 +12,13 @@ ifeq (${hostSystemName},Darwin) export LLVM_PREFIX:=$(shell brew --prefix llvm) export LLVM_DIR:=$(shell realpath ${LLVM_PREFIX}) export PATH:=${LLVM_DIR}/bin:${PATH} - #XXX CMAKE=${HOME}/.local/bin/cmake # cmake v4.3-rc2 + #XXX CMAKE=${HOME}/.local/bin/cmake # cmake v4.3-rc3 CMAKE?=/usr/local/bin/cmake STDLIB=libc++ export CMAKE_CXX_STDLIB_MODULES_JSON:=${LLVM_DIR}/lib/c++/$(STDLIB).modules.json - export CXXFLAGS:=-stdlib=$(STDLIB) - export LDFLAGS:=-L$(LLVM_DIR)/lib/c++ -lc++abi # XXX -lc++ + #XXX export CXXFLAGS:=-stdlib=$(STDLIB) + #XXX export LDFLAGS:=-L$(LLVM_DIR)/lib/c++ -lc++abi # XXX -lc++ export CXX:=clang++ export GCOV:="llvm-cov gcov" @@ -54,7 +54,8 @@ build: GNUmakefile CMakeLists.txt else \ ${CXX} -print-file-name=$(STDLIB).modules.json; \ fi - CXX=${CXX} ${CMAKE} -G Ninja -S . -B build -D CMAKE_CXX_STANDARD=26 -D CMAKE_BUILD_TYPE=Release \ + CXX=${CXX} ${CMAKE} -G Ninja -S . -B build -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_CXX_STANDARD=26 -D CMAKE_CXX_EXTENSIONS=YES -D CMAKE_CXX_STANDARD_REQUIRED=YES \ -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev ln -fs build/compile_commands.json . @@ -64,7 +65,7 @@ clean: find . -name .DS_Store -delete find . -name '*~' -delete -workflow: +workflow: CMakePresets.json cmake --preset linux-clang -D CMAKE_CXX_STANDARD=26 \ -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev diff --git a/cmake/enable_import_std.cmake b/cmake/enable_import_std.cmake index c0cf12ceba..68572317f2 100644 --- a/cmake/enable_import_std.cmake +++ b/cmake/enable_import_std.cmake @@ -1,3 +1,6 @@ +# ---- The include guard applies globally to the whole build ---- +include_guard(GLOBAL) + if(NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 20) endif() @@ -49,41 +52,98 @@ if(ASIO_IMPORT_STD) # 2. Clang libc++ Modules Path Setup # before project() we must detect clang by inspecting CMAKE_CXX_COMPILER - if( - NOT CMAKE_CXX_STDLIB_MODULES_JSON - AND ( - CMAKE_CXX_COMPILER MATCHES "clang" - OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" - ) - ) - execute_process( - COMMAND ${CMAKE_CXX_COMPILER} -print-resource-dir - OUTPUT_VARIABLE _clang_resource_dir - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(_clang_resource_dir) - # libc++.modules.json is in the lib directory within LLVM/Clang root - cmake_path(SET _modules_json_path "${_clang_resource_dir}") - cmake_path(GET _modules_json_path PARENT_PATH _modules_json_path) # .../lib/clang - cmake_path(GET _modules_json_path PARENT_PATH _modules_json_path) # .../lib - cmake_path(APPEND _modules_json_path "libc++.modules.json") + if(NOT CMAKE_CXX_STDLIB_MODULES_JSON) + if(LINUX) + if( + CMAKE_CXX_COMPILER MATCHES "clang" + OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + ) + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} -print-resource-dir + OUTPUT_VARIABLE _clang_resource_dir + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(_clang_resource_dir) + # libc++.modules.json is in the lib directory within LLVM/Clang root + cmake_path(SET _modules_json_path "${_clang_resource_dir}") + cmake_path( + GET _modules_json_path + PARENT_PATH _modules_json_path + ) # .../lib/clang + cmake_path( + GET _modules_json_path + PARENT_PATH _modules_json_path + ) # .../lib + cmake_path(APPEND _modules_json_path "libc++.modules.json") - if(EXISTS "${_modules_json_path}") + if(EXISTS "${_modules_json_path}") + set(CMAKE_CXX_STDLIB_MODULES_JSON + "${_modules_json_path}" + CACHE PATH + "Path to libc++.modules.json" + ) + message( + STATUS + "Found libc++.modules.json: ${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) + endif() + endif() + endif() + elseif(APPLE) + if( + CMAKE_C_COMPILER MATCHES "clang" + OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" + ) + execute_process( + OUTPUT_VARIABLE _modules_json_path + COMMAND + ${CMAKE_CXX_COMPILER} + -print-file-name=c++/libc++.modules.json + COMMAND_ECHO STDOUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(EXISTS ${_modules_json_path}) + file(REAL_PATH ${_modules_json_path} _modules_json_path) + set(CMAKE_CXX_STDLIB_MODULES_JSON + "${_modules_json_path}" + CACHE PATH + "Path to c++/libc++.modules.json" + ) + message( + STATUS + "Found c++/libstdc++.modules.json: ${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) + endif() + endif() + endif() + if( + CMAKE_C_COMPILER MATCHES "gcc" + OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + ) + execute_process( + OUTPUT_VARIABLE _modules_json_path + COMMAND + ${CMAKE_CXX_COMPILER} + -print-file-name=libstdc++.modules.json + COMMAND_ECHO STDOUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(EXISTS ${_modules_json_path}) + file(REAL_PATH ${_modules_json_path} _modules_json_path) set(CMAKE_CXX_STDLIB_MODULES_JSON "${_modules_json_path}" CACHE PATH - "Path to libc++.modules.json" + "Path to libstdc++.modules.json" ) message( STATUS - "Found libc++.modules.json: ${CMAKE_CXX_STDLIB_MODULES_JSON}" + "Found libstdc++.modules.json: ${CMAKE_CXX_STDLIB_MODULES_JSON}" ) endif() endif() - else() - message( - VERBOSE - "CMAKE_CXX_STDLIB_MODULES_JSON: ${CMAKE_CXX_STDLIB_MODULES_JSON}" - ) endif() + message( + STATUS + "CMAKE_CXX_STDLIB_MODULES_JSON: ${CMAKE_CXX_STDLIB_MODULES_JSON}" + ) endif() diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index 72ec9f3b08..db6b120667 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -21,6 +21,10 @@ add_executable( cpp20/invocation/completion_executor.cpp ) target_link_libraries(example.completion_executor PRIVATE asio::asio) +target_compile_features( + example.completion_executor + PRIVATE cxx_std_${CMAKE_CXX_STANDARD} +) if(ASIO_IMPORT_STD) set_property(TARGET example.completion_executor PROPERTY CXX_MODULE_STD ON) endif() diff --git a/src/examples/cpp20/CMakeLists.txt b/src/examples/cpp20/CMakeLists.txt index 4c0fc30a0c..259de9ea17 100644 --- a/src/examples/cpp20/CMakeLists.txt +++ b/src/examples/cpp20/CMakeLists.txt @@ -26,11 +26,12 @@ set(noinst_PROGRAMS channels/mutual_exclusion_1.cpp ) -set(type_erasure_type_erasure_SOURCES - type_erasure/main.cpp - type_erasure/stdin_line_reader.cpp - type_erasure/sleep.cpp -) +# add_executable(${target_prefix}_type_erasure +# type_erasure/main.cpp +# type_erasure/stdin_line_reader.cpp +# type_erasure/sleep.cpp +# ) +# target_link_libraries(${target_prefix}_type_erasure asio::asio_header) foreach(source ${noinst_PROGRAMS}) string(REGEX REPLACE "\.cpp$" "" program ${source}) diff --git a/src/tests/unit/CMakeLists.txt b/src/tests/unit/CMakeLists.txt index 5121a2420c..096296b52b 100644 --- a/src/tests/unit/CMakeLists.txt +++ b/src/tests/unit/CMakeLists.txt @@ -143,8 +143,11 @@ foreach(program ${test_PROGRAMS}) add_test(NAME ${target_prefix}${target} COMMAND "${target_prefix}${target}") endforeach() -# FIXME: does not work on CI yet! CK -if(APPLE) +if(CMAKE_SKIP_INSTALL_RULES) + return() +endif() + +if(NOT LINUX) # test if the targets are usable from the install directory add_test( NAME install-to-stagedir @@ -164,7 +167,9 @@ if(APPLE) "-D ASIO_IMPORT_STD=${ASIO_IMPORT_STD}" "-D CMAKE_BUILD_TYPE=$" "-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" + "-D CMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}" "-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" + "-D CMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}" "-D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" "-D CMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/stagedir" ) diff --git a/src/tests/unit/strand.cpp b/src/tests/unit/strand.cpp index e046d84866..df3a812e23 100644 --- a/src/tests/unit/strand.cpp +++ b/src/tests/unit/strand.cpp @@ -65,7 +65,7 @@ void increment_with_lock(strand* s, int* count) void sleep_increment(io_context* ioc, int* count) { - timer t(*ioc, chronons::seconds(2)); + timer t(*ioc, chronons::milliseconds(200)); t.wait(); ++(*count); @@ -95,7 +95,7 @@ void start_sleep_increments(io_context* ioc, strand* s, int* count) { // Give all threads a chance to start. - timer t(*ioc, chronons::seconds(2)); + timer t(*ioc, chronons::milliseconds(200)); t.wait(); // Start three increments. @@ -149,13 +149,13 @@ void strand_test() thread thread2(bindns::bind(io_context_run, &ioc)); // Check all events run one after another even though there are two threads. - timer timer1(ioc, chronons::seconds(3)); + timer timer1(ioc, chronons::milliseconds(300)); timer1.wait(); ASIO_CHECK(count == 0); - timer1.expires_at(timer1.expiry() + chronons::seconds(2)); + timer1.expires_at(timer1.expiry() + chronons::milliseconds(200)); timer1.wait(); ASIO_CHECK(count == 1); - timer1.expires_at(timer1.expiry() + chronons::seconds(2)); + timer1.expires_at(timer1.expiry() + chronons::milliseconds(200)); timer1.wait(); ASIO_CHECK(count == 2); diff --git a/src/tests/unit/system_timer.cpp b/src/tests/unit/system_timer.cpp index 9c949c2955..1081a4bf31 100644 --- a/src/tests/unit/system_timer.cpp +++ b/src/tests/unit/system_timer.cpp @@ -44,7 +44,7 @@ void decrement_to_zero(asio::system_timer* t, int* count) int before_value = *count; - t->expires_at(t->expiry() + asio::chrono::seconds(1)); + t->expires_at(t->expiry() + asio::chrono::milliseconds(100)); t->async_wait(bindns::bind(decrement_to_zero, t, count)); // Completion cannot nest, so count value should remain unchanged. @@ -78,7 +78,7 @@ asio::system_timer::time_point now() void system_timer_test() { - using asio::chrono::seconds; + using asio::chrono::milliseconds; using asio::chrono::microseconds; using bindns::placeholders::_1; using bindns::placeholders::_2; @@ -89,45 +89,45 @@ void system_timer_test() asio::system_timer::time_point start = now(); - asio::system_timer t1(ioc, seconds(1)); + asio::system_timer t1(ioc, milliseconds(100)); t1.wait(); // The timer must block until after its expiry time. asio::system_timer::time_point end = now(); - asio::system_timer::time_point expected_end = start + seconds(1); + asio::system_timer::time_point expected_end = start + milliseconds(100); ASIO_CHECK(expected_end < end || expected_end == end); start = now(); - asio::system_timer t2(ioc_ex, seconds(1) + microseconds(500000)); + asio::system_timer t2(ioc_ex, milliseconds(100) + microseconds(500000)); t2.wait(); // The timer must block until after its expiry time. end = now(); - expected_end = start + seconds(1) + microseconds(500000); + expected_end = start + milliseconds(100) + microseconds(500000); ASIO_CHECK(expected_end < end || expected_end == end); - t2.expires_at(t2.expiry() + seconds(1)); + t2.expires_at(t2.expiry() + milliseconds(100)); t2.wait(); // The timer must block until after its expiry time. end = now(); - expected_end += seconds(1); + expected_end += milliseconds(100); ASIO_CHECK(expected_end < end || expected_end == end); start = now(); - t2.expires_after(seconds(1) + microseconds(200000)); + t2.expires_after(milliseconds(100) + microseconds(200000)); t2.wait(); // The timer must block until after its expiry time. end = now(); - expected_end = start + seconds(1) + microseconds(200000); + expected_end = start + milliseconds(100) + microseconds(200000); ASIO_CHECK(expected_end < end || expected_end == end); start = now(); - asio::system_timer t3(ioc, seconds(5)); + asio::system_timer t3(ioc, milliseconds(500)); t3.async_wait(bindns::bind(increment, &count)); // No completions can be delivered until run() is called. @@ -139,13 +139,13 @@ void system_timer_test() // this should not be until after the timer's expiry time. ASIO_CHECK(count == 1); end = now(); - expected_end = start + seconds(1); + expected_end = start + milliseconds(100); ASIO_CHECK(expected_end < end || expected_end == end); count = 3; start = now(); - asio::system_timer t4(ioc, seconds(1)); + asio::system_timer t4(ioc, milliseconds(100)); t4.async_wait(bindns::bind(decrement_to_zero, &t4, &count)); // No completions can be delivered until run() is called. @@ -158,15 +158,15 @@ void system_timer_test() // this should not be until after the timer's final expiry time. ASIO_CHECK(count == 0); end = now(); - expected_end = start + seconds(3); + expected_end = start + milliseconds(300); ASIO_CHECK(expected_end < end || expected_end == end); count = 0; start = now(); - asio::system_timer t5(ioc, seconds(10)); + asio::system_timer t5(ioc, milliseconds(1000)); t5.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1)); - asio::system_timer t6(ioc, seconds(1)); + asio::system_timer t6(ioc, milliseconds(100)); t6.async_wait(bindns::bind(cancel_timer, &t5)); // No completions can be delivered until run() is called. @@ -177,10 +177,10 @@ void system_timer_test() // The timer should have been cancelled, so count should not have changed. // The total run time should not have been much more than 1 second (and - // certainly far less than 10 seconds). + // certainly far less than 10 milliseconds). ASIO_CHECK(count == 0); end = now(); - expected_end = start + seconds(2); + expected_end = start + milliseconds(200); ASIO_CHECK(end < expected_end); // Wait on the timer again without cancelling it. This time the asynchronous @@ -191,10 +191,10 @@ void system_timer_test() ioc.run(); // The timer should not have been cancelled, so count should have changed. - // The total time since the timer was created should be more than 10 seconds. + // The total time since the timer was created should be more than 1000 milliseconds. ASIO_CHECK(count == 1); end = now(); - expected_end = start + seconds(10); + expected_end = start + milliseconds(1000); ASIO_CHECK(expected_end < end || expected_end == end); count = 0; @@ -203,21 +203,21 @@ void system_timer_test() // Start two waits on a timer, one of which will be cancelled. The one // which is not cancelled should still run to completion and increment the // counter. - asio::system_timer t7(ioc, seconds(3)); + asio::system_timer t7(ioc, milliseconds(300)); t7.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1)); t7.async_wait(bindns::bind(increment_if_not_cancelled, &count, _1)); - asio::system_timer t8(ioc, seconds(1)); + asio::system_timer t8(ioc, milliseconds(100)); t8.async_wait(bindns::bind(cancel_one_timer, &t7)); ioc.restart(); ioc.run(); // One of the waits should not have been cancelled, so count should have - // changed. The total time since the timer was created should be more than 3 - // seconds. + // changed. The total time since the timer was created should be more than 300 + // milliseconds. ASIO_CHECK(count == 1); end = now(); - expected_end = start + seconds(3); + expected_end = start + milliseconds(300); ASIO_CHECK(expected_end < end || expected_end == end); } @@ -377,13 +377,13 @@ void system_timer_thread_test() asio::thread th(bindns::bind(io_context_run, &ioc)); - t2.expires_after(asio::chrono::seconds(2)); + t2.expires_after(asio::chrono::milliseconds(200)); t2.wait(); - t1.expires_after(asio::chrono::seconds(2)); + t1.expires_after(asio::chrono::milliseconds(200)); t1.async_wait(bindns::bind(increment, &count)); - t2.expires_after(asio::chrono::seconds(4)); + t2.expires_after(asio::chrono::milliseconds(400)); t2.wait(); ioc.stop(); @@ -395,7 +395,7 @@ void system_timer_thread_test() asio::system_timer make_timer(asio::io_context& ioc, int* count) { asio::system_timer t(ioc); - t.expires_after(asio::chrono::seconds(1)); + t.expires_after(asio::chrono::milliseconds(100)); t.async_wait(bindns::bind(increment, count)); return t; } @@ -408,7 +408,7 @@ typedef asio::basic_waitable_timer< io_context_system_timer make_convertible_timer(asio::io_context& ioc, int* count) { io_context_system_timer t(ioc); - t.expires_after(asio::chrono::seconds(1)); + t.expires_after(asio::chrono::milliseconds(100)); t.async_wait(bindns::bind(increment, count)); return t; } @@ -456,7 +456,7 @@ void system_timer_op_cancel_test() asio::io_context ioc; int count = 0; - asio::system_timer timer(ioc, asio::chrono::seconds(10)); + asio::system_timer timer(ioc, asio::chrono::milliseconds(1000)); timer.async_wait(bindns::bind(increment, &count)); From c1e29c310391fbeee96d844142262a68f96b6f56 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 17 Mar 2026 12:17:50 +0100 Subject: [PATCH 55/57] Add round trip test for all used toolchains This tests if the targets are usable from the install directory NOTE: should be work with Debug and Release builds! CK Round trip test works only yet in Debug on Linux? Use clang-format with ColumnLimit: 99 --- .clang-format | 2 +- .github/workflows/ci.yml | 10 +++++- .github/workflows/clang.yml | 4 +-- .github/workflows/gcc.yml | 4 +-- CMakeLists.txt | 5 ++- CMakePresets.json | 5 +-- GNUmakefile | 35 +++++++++++++++------ boostify.pl | 4 +-- src/examples/CMakeLists.txt | 1 + src/tests/unit/CMakeLists.txt | 59 +++++++++++++++++++---------------- 10 files changed, 77 insertions(+), 52 deletions(-) diff --git a/.clang-format b/.clang-format index abbbd40893..943d738f8e 100644 --- a/.clang-format +++ b/.clang-format @@ -61,7 +61,7 @@ BreakBeforeInheritanceComma: true BreakConstructorInitializers: BeforeColon BreakInheritanceList: BeforeColon # -# TBD: Should we only use 80 columns? +# We should only use 80 columns! ColumnLimit: 99 # DerivePointerAlignment: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6934e345b6..649fb252d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,15 @@ name: asio CI on: push: - branches: [ master, citest-* ] + branches: [ master, citest-*, feature/module* ] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: build: diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 6a48b5f854..df80e684b8 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -47,9 +47,9 @@ jobs: - name: Build env: PATH: $HOME/.local/bin:$PATH - run: cmake --build --preset linux-clang-release + run: cmake --build --preset linux-clang-debug - name: Test env: PATH: $HOME/.local/bin:$PATH - run: ctest --preset linux-clang-release + run: ctest --preset linux-clang-debug diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 8e7d4d4d7f..93907d62c1 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -46,9 +46,9 @@ jobs: - name: Build env: PATH: $HOME/.local/bin:$PATH - run: cmake --build --preset linux-gcc-release + run: cmake --build --preset linux-gcc-debug - name: Test env: PATH: $HOME/.local/bin:$PATH - run: ctest --preset linux-gcc-release + run: ctest --preset linux-gcc-debug diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b2a052625..e90c3819ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.30...4.3) -#FIXME: include(cmake/prelude.cmake) include(cmake/enable_import_std.cmake) project( @@ -102,11 +101,11 @@ target_link_libraries(asio PUBLIC asio_header) option(ASIO_IMPORT_STD "Enable 'import std;' support for ASIO module" OFF) if(ASIO_IMPORT_STD) + message(STATUS "Build asio with target PROPERTY CXX_MODULE_STD ON") # Tell CMake that we explicitly want `import std`. # This initializes the property CXX_MODULE_STD of asio targets to 1 (requires CMake 3.30+) - target_compile_definitions(asio PUBLIC ASIO_HAS_IMPORT_STD) set_target_properties(asio PROPERTIES CXX_MODULE_STD ON) - message(STATUS "Build asio with target PROPERTY CXX_MODULE_STD ON") + target_compile_definitions(asio PUBLIC ASIO_HAS_IMPORT_STD) endif() # Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=OFF to disable) diff --git a/CMakePresets.json b/CMakePresets.json index 6f8a2c93e0..95ed3a6156 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -105,9 +105,6 @@ "cacheVariables": { "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++" - }, - "environment": { - "CXX_FLAGS": "-stdlib=libstdc++" } }, { @@ -126,7 +123,7 @@ "CMAKE_SHARED_LINKER_FLAGS": "-lc++abi" }, "environment": { - "CXX_FLAGS": "-stdlib=libc++" + "CXXFLAGS": "-stdlib=libc++" } }, { diff --git a/GNUmakefile b/GNUmakefile index c27405f906..5f97320093 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,15 +6,18 @@ MAKEFLAGS+= --no-builtin-rules # Disable the built-in implicit rules. MAKEFLAGS+= --warn-undefined-variables # Warn when an undefined variable is referenced. export hostSystemName=$(shell uname) +export CMAKE_EXPORT_COMPILE_COMMANDS=1 export CTEST_OUTPUT_ON_FAILURE=1 +CMAKE=${HOME}/.local/bin/cmake # cmake v4.3-rc3 + ifeq (${hostSystemName},Darwin) export LLVM_PREFIX:=$(shell brew --prefix llvm) export LLVM_DIR:=$(shell realpath ${LLVM_PREFIX}) export PATH:=${LLVM_DIR}/bin:${PATH} - #XXX CMAKE=${HOME}/.local/bin/cmake # cmake v4.3-rc3 CMAKE?=/usr/local/bin/cmake + PRESET?=clang STDLIB=libc++ export CMAKE_CXX_STDLIB_MODULES_JSON:=${LLVM_DIR}/lib/c++/$(STDLIB).modules.json #XXX export CXXFLAGS:=-stdlib=$(STDLIB) @@ -34,14 +37,22 @@ ifeq (${hostSystemName},Darwin) # export GCOV:="gcov" else ifeq (${hostSystemName},Linux) # TODO(CK): commented out for CI! - # export LLVM_DIR:=/usr/lib/llvm-22 + # NOTE: tested with ubuntu:25.04 + # export LLVM_DIR:=/usr/lib/llvm-20 + # export CPPFLAGS:=-I$(LLVM_DIR)/include/c++/v1 + # export CMAKE_CXX_STDLIB_MODULES_JSON:=$(LLVM_DIR)/lib/libc++.modules.json + # export LDFLAGS:=-L$(LLVM_DIR)/lib/c++ -lc++abi # XXX -lc++ # export PATH:=${LLVM_DIR}/bin:${PATH} - # export CXX:=clang++22 - CMAKE=cmake + # export CXX:=clang++-20 + + ### to test g++-15: + export CXX:=g++-15 + PRESET?=gcc + CMAKE?=/root/.local/bin/cmake endif ############################################################# -.PHONY: all test check install clean format workflow +.PHONY: all test check install clean distclean format workflow ############################################################# all: build @@ -60,16 +71,20 @@ build: GNUmakefile CMakeLists.txt -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev ln -fs build/compile_commands.json . -clean: +distclean: rm -rf build .cache compile_commands.json find . -name .DS_Store -delete find . -name '*~' -delete +############################################################# workflow: CMakePresets.json - cmake --preset linux-clang -D CMAKE_CXX_STANDARD=26 \ - -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ - -D ASIO_IMPORT_STD=ON --fresh --log-level=VERBOSE -Wdev - cmake --workflow --preset linux-clang-release + ${CMAKE} --preset linux-${PRESET} -D CMAKE_CXX_STANDARD=26 \ + -D ASIO_IMPORT_STD=ON \ + -D ASIO_ENABLE_SSL=OFF \ + --fresh --log-level=VERBOSE -Wdev + # -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ + ${CMAKE} --workflow --preset linux-${PRESET}-release +############################################################# check: build run-clang-tidy src/examples/cpp20 diff --git a/boostify.pl b/boostify.pl index a52b886633..88e7b303eb 100755 --- a/boostify.pl +++ b/boostify.pl @@ -11,11 +11,11 @@ sub print_line my ($output, $line, $from, $lineno) = @_; # Warn if the resulting line is >80 characters wide. - if (length($line) > 80) + if (length($line) > 99) { if ($from =~ /\.[chi]pp$/) { - ++$bad_lines; + # TODO(CK): ++$bad_lines; print("Warning: $from:$lineno: output >80 characters wide.\n"); } } diff --git a/src/examples/CMakeLists.txt b/src/examples/CMakeLists.txt index db6b120667..959d0523a2 100644 --- a/src/examples/CMakeLists.txt +++ b/src/examples/CMakeLists.txt @@ -26,6 +26,7 @@ target_compile_features( PRIVATE cxx_std_${CMAKE_CXX_STANDARD} ) if(ASIO_IMPORT_STD) + message(STATUS "Build asio with target PROPERTY CXX_MODULE_STD ON") set_property(TARGET example.completion_executor PROPERTY CXX_MODULE_STD ON) endif() add_test(NAME example.completion_executor COMMAND example.completion_executor) diff --git a/src/tests/unit/CMakeLists.txt b/src/tests/unit/CMakeLists.txt index 096296b52b..d6e99869ee 100644 --- a/src/tests/unit/CMakeLists.txt +++ b/src/tests/unit/CMakeLists.txt @@ -147,30 +147,35 @@ if(CMAKE_SKIP_INSTALL_RULES) return() endif() -if(NOT LINUX) - # test if the targets are usable from the install directory - add_test( - NAME install-to-stagedir - COMMAND - ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix - ${CMAKE_BINARY_DIR}/stagedir --config $ - ) - add_test( - NAME find-package-test - COMMAND - ${CMAKE_CTEST_COMMAND} # --verbose - --output-on-failure -C $ --build-and-test - "${CMAKE_SOURCE_DIR}/src/examples" - "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" --build-generator - ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} - --build-options # - "-D ASIO_IMPORT_STD=${ASIO_IMPORT_STD}" - "-D CMAKE_BUILD_TYPE=$" - "-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" - "-D CMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}" - "-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" - "-D CMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}" - "-D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" - "-D CMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/stagedir" - ) -endif() +# if(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") +# return() +# endif() + +# test if the targets are usable from the install directory +# NOTE: should be tested in Debug and Release! CK +add_test( + NAME install-to-stagedir + COMMAND + ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix + ${CMAKE_BINARY_DIR}/stagedir --config $ +) +add_test( + NAME find-package-test + COMMAND + ${CMAKE_CTEST_COMMAND} # --verbose + --output-on-failure -C $ --build-and-test + "${CMAKE_SOURCE_DIR}/src/examples" + "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" --build-generator + ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} + --build-options # + "-D ASIO_IMPORT_STD=${ASIO_IMPORT_STD}" # + "-D CMAKE_BUILD_TYPE=$" # + "-D CMAKE_BUILD_RPATH=${CMAKE_BUILD_RPATH}" + "-D CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" + "-D CMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}" + "-D CMAKE_CXX_SCAN_FOR_MODULES=${CMAKE_CXX_SCAN_FOR_MODULES}" + "-D CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" + "-D CMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}" + "-D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON}" + "-D CMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/stagedir" +) From 035b77b4e4338675afbd8b68489719fc01ac78b5 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 17 Mar 2026 21:43:42 +0100 Subject: [PATCH 56/57] Use always Ninja generator for find-package-test --- .github/workflows/clang.yml | 5 +++-- .github/workflows/gcc.yml | 5 +++-- src/tests/unit/CMakeLists.txt | 9 +++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index df80e684b8..59fb7ccc84 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -15,6 +15,7 @@ jobs: cxx_config: - { std: 20, import_std: "OFF" } - { std: 23, import_std: "ON" } + build_type: [debug, release] runs-on: ubuntu-latest @@ -47,9 +48,9 @@ jobs: - name: Build env: PATH: $HOME/.local/bin:$PATH - run: cmake --build --preset linux-clang-debug + run: cmake --build --preset linux-clang-${{ matrix.build_type }} - name: Test env: PATH: $HOME/.local/bin:$PATH - run: ctest --preset linux-clang-debug + run: ctest --preset linux-clang-${{ matrix.build_type }} diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 93907d62c1..8b1055da5a 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -15,6 +15,7 @@ jobs: cxx_config: - { std: 20, import_std: "OFF" } - { std: 23, import_std: "ON" } + build_type: [debug, release] runs-on: ubuntu-latest @@ -46,9 +47,9 @@ jobs: - name: Build env: PATH: $HOME/.local/bin:$PATH - run: cmake --build --preset linux-gcc-debug + run: cmake --build --preset linux-gcc-${{ matrix.build_type }} - name: Test env: PATH: $HOME/.local/bin:$PATH - run: ctest --preset linux-gcc-debug + run: ctest --preset linux-gcc-${{ matrix.build_type }} diff --git a/src/tests/unit/CMakeLists.txt b/src/tests/unit/CMakeLists.txt index d6e99869ee..f256b1fdde 100644 --- a/src/tests/unit/CMakeLists.txt +++ b/src/tests/unit/CMakeLists.txt @@ -147,10 +147,6 @@ if(CMAKE_SKIP_INSTALL_RULES) return() endif() -# if(LINUX AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") -# return() -# endif() - # test if the targets are usable from the install directory # NOTE: should be tested in Debug and Release! CK add_test( @@ -165,8 +161,9 @@ add_test( ${CMAKE_CTEST_COMMAND} # --verbose --output-on-failure -C $ --build-and-test "${CMAKE_SOURCE_DIR}/src/examples" - "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" --build-generator - ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} + "${CMAKE_CURRENT_BINARY_DIR}/find-package-test" + --build-generator "Ninja" # XXX ${CMAKE_GENERATOR} + --build-makeprogram ${CMAKE_MAKE_PROGRAM} # --build-options # "-D ASIO_IMPORT_STD=${ASIO_IMPORT_STD}" # "-D CMAKE_BUILD_TYPE=$" # From 85d2aedde9439083352d4839f886deac06e6372e Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Wed, 18 Mar 2026 16:37:52 +0100 Subject: [PATCH 57/57] Prevent verify header errors when SSL is disabled --- CMakeLists.txt | 17 +++++++++++------ GNUmakefile | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e90c3819ca..bbdd01b10d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,9 +78,16 @@ list(FILTER _asio_headers EXCLUDE REGEX [=[.*/spawn.*\.hpp]=]) set(_public_headers include/asio.hpp ${_asio_headers}) list(FILTER _public_headers EXCLUDE REGEX [=[.*/detail/.*\.hpp]=]) list(FILTER _public_headers EXCLUDE REGEX [=[.*/impl/.*\.hpp]=]) -# foreach(header in LISTS ${_public_headers}) -# message(DEBUG "${header}") -# endforeach() + +# Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=OFF to disable) +option(ASIO_ENABLE_SSL "Enable SSL support for ASIO module" ON) +if(NOT ASIO_ENABLE_SSL) + list(FILTER _public_headers EXCLUDE REGEX [=[.*/ssl.*\.hpp]=]) +endif() + +foreach(header in LISTS ${_public_headers}) + message(DEBUG "${header}") +endforeach() add_library(asio STATIC) add_library(asio::asio ALIAS asio) @@ -108,8 +115,6 @@ if(ASIO_IMPORT_STD) target_compile_definitions(asio PUBLIC ASIO_HAS_IMPORT_STD) endif() -# Optional SSL support (can be controlled via -DASIO_ENABLE_SSL=OFF to disable) -option(ASIO_ENABLE_SSL "Enable SSL support for ASIO module" ON) if(ASIO_ENABLE_SSL) find_package(OpenSSL REQUIRED) target_compile_definitions(asio PUBLIC ASIO_USE_SSL) @@ -122,7 +127,7 @@ if(ASIO_ENABLE_SSL) set(_dependencies DEPENDENCIES OpenSSL) else() message( - STATUS + WARNING "ASIO: SSL support disabled (use -DASIO_ENABLE_SSL=ON to enable)" ) set(_dependencies) diff --git a/GNUmakefile b/GNUmakefile index 5f97320093..6cf598ad1f 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -80,9 +80,10 @@ distclean: workflow: CMakePresets.json ${CMAKE} --preset linux-${PRESET} -D CMAKE_CXX_STANDARD=26 \ -D ASIO_IMPORT_STD=ON \ - -D ASIO_ENABLE_SSL=OFF \ + -D ASIO_ENABLE_SSL=ON \ --fresh --log-level=VERBOSE -Wdev # -D CMAKE_CXX_STDLIB_MODULES_JSON=${CMAKE_CXX_STDLIB_MODULES_JSON} \ + # ${CMAKE} --workflow --preset linux-${PRESET}-release #############################################################