diff --git a/asio/include/asio/detail/config.hpp b/asio/include/asio/detail/config.hpp index b1f24078eb..cbbb2dbdb7 100644 --- a/asio/include/asio/detail/config.hpp +++ b/asio/include/asio/detail/config.hpp @@ -2072,25 +2072,25 @@ // Support the co_await keyword on compilers known to allow it. #if !defined(ASIO_HAS_CO_AWAIT) # if !defined(ASIO_DISABLE_CO_AWAIT) -# if defined(ASIO_MSVC) -# if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) && !defined(__clang__) +# if ((defined(__cpp_coroutines) && (__cpp_coroutines >= 201707L)) || (defined(__cpp_impl_coroutine) && (__cpp_impl_coroutine >= 201902L))) +# define ASIO_HAS_CO_AWAIT 1 +# elif !defined(ASIO_HAS_CO_AWAIT) && defined(ASIO_MSVC) +# if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) # define ASIO_HAS_CO_AWAIT 1 # elif (_MSC_FULL_VER >= 190023506) # if defined(_RESUMABLE_FUNCTIONS_SUPPORTED) # define ASIO_HAS_CO_AWAIT 1 # endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED) # endif // (_MSC_FULL_VER >= 190023506) -# elif defined(__clang__) +# endif // !defined(ASIO_HAS_CO_AWAIT) && defined(ASIO_MSVC) +# if !defined(ASIO_HAS_CO_AWAIT) && defined(__clang__) # if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) -# if __has_include() -# define ASIO_HAS_CO_AWAIT 1 -# endif // __has_include() +# define ASIO_HAS_CO_AWAIT 1 # endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703) -# elif defined(__GNUC__) +# endif // !defined(ASIO_HAS_CO_AWAIT) && defined(__clang__) +# if !defined(ASIO_HAS_CO_AWAIT) && defined(__GNUC__) # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902) -# if __has_include() -# define ASIO_HAS_CO_AWAIT 1 -# endif // __has_include() +# define ASIO_HAS_CO_AWAIT 1 # endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902) # endif // defined(__GNUC__) # endif // !defined(ASIO_DISABLE_CO_AWAIT) @@ -2099,12 +2099,20 @@ // Standard library support for coroutines. #if !defined(ASIO_HAS_STD_COROUTINE) # if !defined(ASIO_DISABLE_STD_COROUTINE) -# if defined(ASIO_MSVC) +# if __has_include() +# include +# elif __has_include() +# include +# endif //__has_include() +# if defined(__cpp_lib_coroutine) && (__cpp_lib_coroutine >= 201902) +# define ASIO_HAS_STD_COROUTINE 1 +# endif // defined(__cpp_lib_coroutine) && (__cpp_lib_coroutine >= 201902) +# if !defined(ASIO_HAS_STD_COROUTINE) && defined(ASIO_MSVC) # if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) # define ASIO_HAS_STD_COROUTINE 1 # endif // (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) # endif // defined(ASIO_MSVC) -# if defined(__GNUC__) +# if !defined(ASIO_HAS_STD_COROUTINE) && defined(__GNUC__) # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902) # if __has_include() # define ASIO_HAS_STD_COROUTINE 1