summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/include/asio/detail/config.hpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/include/asio/detail/config.hpp')
-rw-r--r--3rdparty/asio/include/asio/detail/config.hpp1385
1 files changed, 772 insertions, 613 deletions
diff --git a/3rdparty/asio/include/asio/detail/config.hpp b/3rdparty/asio/include/asio/detail/config.hpp
index 0c651bed71d..cd345eac2cd 100644
--- a/3rdparty/asio/include/asio/detail/config.hpp
+++ b/3rdparty/asio/include/asio/detail/config.hpp
@@ -2,7 +2,7 @@
// detail/config.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// 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)
@@ -11,7 +11,33 @@
#ifndef ASIO_DETAIL_CONFIG_HPP
#define ASIO_DETAIL_CONFIG_HPP
+// boostify: non-boost code starts here
+#if !defined(ASIO_STANDALONE)
+# if !defined(ASIO_ENABLE_BOOST)
+# if (__cplusplus >= 201103)
+# define ASIO_STANDALONE 1
+# elif defined(_MSC_VER) && defined(_MSVC_LANG)
+# if (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
+# define ASIO_STANDALONE 1
+# endif // (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
+# endif // defined(_MSC_VER) && defined(_MSVC_LANG)
+# endif // !defined(ASIO_ENABLE_BOOST)
+#endif // !defined(ASIO_STANDALONE)
+
+// Make standard library feature macros available.
+#if defined(__has_include)
+# if __has_include(<version>)
+# include <version>
+# else // __has_include(<version>)
+# include <cstddef>
+# endif // __has_include(<version>)
+#else // defined(__has_include)
+# include <cstddef>
+#endif // defined(__has_include)
+
+// boostify: non-boost code ends here
#if defined(ASIO_STANDALONE)
+# define ASIO_DISABLE_BOOST_ALIGN 1
# define ASIO_DISABLE_BOOST_ARRAY 1
# define ASIO_DISABLE_BOOST_ASSERT 1
# define ASIO_DISABLE_BOOST_BIND 1
@@ -23,6 +49,7 @@
# define ASIO_DISABLE_BOOST_THROW_EXCEPTION 1
# define ASIO_DISABLE_BOOST_WORKAROUND 1
#else // defined(ASIO_STANDALONE)
+// Boost.Config library is available.
# include <boost/config.hpp>
# include <boost/version.hpp>
# define ASIO_HAS_BOOST_CONFIG 1
@@ -61,6 +88,9 @@
# define ASIO_DECL
#endif // !defined(ASIO_DECL)
+// Helper macro for documentation.
+#define ASIO_UNSPECIFIED(e) e
+
// Microsoft Visual C++ detection.
#if !defined(ASIO_MSVC)
# if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
@@ -69,7 +99,7 @@
|| (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
# define ASIO_MSVC _MSC_VER
# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
-#endif // defined(ASIO_MSVC)
+#endif // !defined(ASIO_MSVC)
// Clang / libc++ detection.
#if defined(__clang__)
@@ -83,375 +113,323 @@
# endif // (__cplusplus >= 201103)
#endif // defined(__clang__)
-// Support move construction and assignment on compilers known to allow it.
-#if !defined(ASIO_HAS_MOVE)
-# if !defined(ASIO_DISABLE_MOVE)
-# if defined(__clang__)
-# if __has_feature(__cxx_rvalue_references__)
-# define ASIO_HAS_MOVE 1
-# endif // __has_feature(__cxx_rvalue_references__)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_MOVE 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_MOVE 1
-# endif // (_MSC_VER >= 1700)
-# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_MOVE)
-#endif // !defined(ASIO_HAS_MOVE)
+// Android platform detection.
+#if defined(__ANDROID__)
+# include <android/api-level.h>
+#endif // defined(__ANDROID__)
-// If ASIO_MOVE_CAST isn't defined, and move support is available, define
-// ASIO_MOVE_ARG and ASIO_MOVE_CAST to take advantage of rvalue
-// references and perfect forwarding.
-#if defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
+// Always enabled. Retained for backwards compatibility in user code.
+#if !defined(ASIO_DISABLE_CXX11_MACROS)
+# define ASIO_HAS_MOVE 1
# define ASIO_MOVE_ARG(type) type&&
# define ASIO_MOVE_ARG2(type1, type2) type1, type2&&
+# define ASIO_NONDEDUCED_MOVE_ARG(type) type&
# define ASIO_MOVE_CAST(type) static_cast<type&&>
# define ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
-#endif // defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
-
-// If ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible
-// implementation. Note that older g++ and MSVC versions don't like it when you
-// pass a non-member function through a const reference, so for most compilers
-// we'll play it safe and stick with the old approach of passing the handler by
-// value.
-#if !defined(ASIO_MOVE_CAST)
+# define ASIO_MOVE_OR_LVALUE(type) static_cast<type&&>
+# define ASIO_MOVE_OR_LVALUE_ARG(type) type&&
+# define ASIO_MOVE_OR_LVALUE_TYPE(type) type
+# define ASIO_DELETED = delete
+# define ASIO_HAS_VARIADIC_TEMPLATES 1
+# define ASIO_HAS_CONSTEXPR 1
+# define ASIO_STATIC_CONSTEXPR(type, assignment) \
+ static constexpr type assignment
+# define ASIO_HAS_NOEXCEPT 1
+# define ASIO_NOEXCEPT noexcept(true)
+# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
+# define ASIO_NOEXCEPT_IF(c) noexcept(c)
+# define ASIO_HAS_DECLTYPE 1
+# define ASIO_AUTO_RETURN_TYPE_PREFIX(t) auto
+# define ASIO_AUTO_RETURN_TYPE_PREFIX2(t0, t1) auto
+# define ASIO_AUTO_RETURN_TYPE_PREFIX3(t0, t1, t2) auto
+# define ASIO_AUTO_RETURN_TYPE_SUFFIX(expr) -> decltype expr
+# define ASIO_HAS_ALIAS_TEMPLATES 1
+# define ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS 1
+# define ASIO_HAS_ENUM_CLASS 1
+# define ASIO_HAS_REF_QUALIFIED_FUNCTIONS 1
+# define ASIO_LVALUE_REF_QUAL &
+# define ASIO_RVALUE_REF_QUAL &&
+# define ASIO_HAS_USER_DEFINED_LITERALS 1
+# define ASIO_HAS_ALIGNOF 1
+# define ASIO_ALIGNOF(T) alignof(T)
+# define ASIO_HAS_STD_ALIGN 1
+# define ASIO_HAS_STD_SYSTEM_ERROR 1
+# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
+# define ASIO_HAS_STD_ARRAY 1
+# define ASIO_HAS_STD_SHARED_PTR 1
+# define ASIO_HAS_STD_ALLOCATOR_ARG 1
+# define ASIO_HAS_STD_ATOMIC 1
+# define ASIO_HAS_STD_CHRONO 1
+# define ASIO_HAS_STD_ADDRESSOF 1
+# define ASIO_HAS_STD_FUNCTION 1
+# define ASIO_HAS_STD_REFERENCE_WRAPPER 1
+# define ASIO_HAS_STD_TYPE_TRAITS 1
+# define ASIO_HAS_NULLPTR 1
+# define ASIO_HAS_CXX11_ALLOCATORS 1
+# define ASIO_HAS_CSTDINT 1
+# define ASIO_HAS_STD_THREAD 1
+# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
+# define ASIO_HAS_STD_CALL_ONCE 1
+# define ASIO_HAS_STD_FUTURE 1
+# define ASIO_HAS_STD_TUPLE 1
+# define ASIO_HAS_STD_IOSTREAM_MOVE 1
+# define ASIO_HAS_STD_EXCEPTION_PTR 1
+# define ASIO_HAS_STD_NESTED_EXCEPTION 1
+# define ASIO_HAS_STD_HASH 1
+#endif // !defined(ASIO_DISABLE_CXX11_MACROS)
+
+// Support for static constexpr with default initialisation.
+#if !defined(ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
-# define ASIO_MOVE_ARG(type) const type&
-# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
-# define ASIO_MOVE_ARG(type) type
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
+# if (__GNUC__ >= 8)
+# define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
+ static constexpr const type name{}
+# else // (__GNUC__ >= 8)
+# define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
+ static const type name
+# endif // (__GNUC__ >= 8)
# elif defined(ASIO_MSVC)
-# if (_MSC_VER >= 1400)
-# define ASIO_MOVE_ARG(type) const type&
-# else // (_MSC_VER >= 1400)
-# define ASIO_MOVE_ARG(type) type
-# endif // (_MSC_VER >= 1400)
-# else
-# define ASIO_MOVE_ARG(type) type
-# endif
-# define ASIO_MOVE_CAST(type) static_cast<const type&>
-# define ASIO_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
-#endif // !defined(ASIO_MOVE_CAST)
-
-// Support variadic templates on compilers known to allow it.
-#if !defined(ASIO_HAS_VARIADIC_TEMPLATES)
-# if !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
-# if defined(__clang__)
-# if __has_feature(__cxx_variadic_templates__)
-# define ASIO_HAS_VARIADIC_TEMPLATES 1
-# endif // __has_feature(__cxx_variadic_templates__)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_VARIADIC_TEMPLATES 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# endif // !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
-#endif // !defined(ASIO_HAS_VARIADIC_TEMPLATES)
+# define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
+ static const type name
+# else // defined(ASIO_MSVC)
+# define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
+ static constexpr const type name{}
+# endif // defined(ASIO_MSVC)
+#endif // !defined(ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
-// Support deleted functions on compilers known to allow it.
-#if !defined(ASIO_DELETED)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_DELETED = delete
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(__clang__)
-# if __has_feature(__cxx_deleted_functions__)
-# define ASIO_DELETED = delete
-# endif // __has_feature(__cxx_deleted_functions__)
-# endif // defined(__clang__)
-# if !defined(ASIO_DELETED)
-# define ASIO_DELETED
-# endif // !defined(ASIO_DELETED)
-#endif // !defined(ASIO_DELETED)
-
-// Support constexpr on compilers known to allow it.
-#if !defined(ASIO_HAS_CONSTEXPR)
-# if !defined(ASIO_DISABLE_CONSTEXPR)
+// Support noexcept on function types on compilers known to allow it.
+#if !defined(ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
+# if !defined(ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
# if defined(__clang__)
-# if __has_feature(__cxx_constexpr__)
-# define ASIO_HAS_CONSTEXPR 1
-# endif // __has_feature(__cxx_constexr__)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_CONSTEXPR 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# endif // !defined(ASIO_DISABLE_CONSTEXPR)
-#endif // !defined(ASIO_HAS_CONSTEXPR)
-#if !defined(ASIO_CONSTEXPR)
-# if defined(ASIO_HAS_CONSTEXPR)
-# define ASIO_CONSTEXPR constexpr
-# else // defined(ASIO_HAS_CONSTEXPR)
-# define ASIO_CONSTEXPR
-# endif // defined(ASIO_HAS_CONSTEXPR)
-#endif // !defined(ASIO_CONSTEXPR)
-
-// Support noexcept on compilers known to allow it.
-#if !defined(ASIO_NOEXCEPT)
-# if !defined(ASIO_DISABLE_NOEXCEPT)
-# if (BOOST_VERSION >= 105300)
-# define ASIO_NOEXCEPT BOOST_NOEXCEPT
-# define ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW
-# elif defined(__clang__)
-# if __has_feature(__cxx_noexcept__)
-# define ASIO_NOEXCEPT noexcept(true)
-# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
-# endif // __has_feature(__cxx_noexcept__)
+# if (__cplusplus >= 202002)
+# define ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
+# endif // (__cplusplus >= 202002)
# elif defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_NOEXCEPT noexcept(true)
-# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if (__cplusplus >= 202002)
+# define ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
+# endif // (__cplusplus >= 202002)
# elif defined(ASIO_MSVC)
-# if (_MSC_VER >= 1900)
-# define ASIO_NOEXCEPT noexcept(true)
-# define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
-# endif // (_MSC_VER >= 1900)
-# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_NOEXCEPT)
-# if !defined(ASIO_NOEXCEPT)
-# define ASIO_NOEXCEPT
-# endif // !defined(ASIO_NOEXCEPT)
-# if !defined(ASIO_NOEXCEPT_OR_NOTHROW)
-# define ASIO_NOEXCEPT_OR_NOTHROW throw()
-# endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW)
-#endif // !defined(ASIO_NOEXCEPT)
-
-// Support automatic type deduction on compilers known to support it.
-#if !defined(ASIO_HAS_DECLTYPE)
-# if !defined(ASIO_DISABLE_DECLTYPE)
-# if defined(__clang__)
-# if __has_feature(__cxx_decltype__)
-# define ASIO_HAS_DECLTYPE 1
-# endif // __has_feature(__cxx_decltype__)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_DECLTYPE 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_DECLTYPE 1
-# endif // (_MSC_VER >= 1700)
+# if (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
+# define ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
+# endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_DECLTYPE)
-#endif // !defined(ASIO_HAS_DECLTYPE)
+# endif // !defined(ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
+#endif // !defined(ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
-// Standard library support for system errors.
-#if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
-# if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
+// Support return type deduction on compilers known to allow it.
+#if !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
+# if !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_SYSTEM_ERROR 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<system_error>)
-# define ASIO_HAS_STD_SYSTEM_ERROR 1
-# endif // __has_include(<system_error>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_SYSTEM_ERROR 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_SYSTEM_ERROR 1
-# endif // (_MSC_VER >= 1700)
+# if __has_feature(__cxx_return_type_deduction__)
+# define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
+# endif // __has_feature(__cxx_return_type_deduction__)
+# elif (__cplusplus >= 201402)
+# define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
+# elif defined(__cpp_return_type_deduction)
+# if (__cpp_return_type_deduction >= 201304)
+# define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
+# endif // (__cpp_return_type_deduction >= 201304)
+# elif defined(ASIO_MSVC)
+# if (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
+# define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
+# endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
-#endif // !defined(ASIO_HAS_STD_SYSTEM_ERROR)
-
-// Compliant C++11 compilers put noexcept specifiers on error_category members.
-#if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
-# if (BOOST_VERSION >= 105300)
-# define ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
-# elif defined(__clang__)
-# if __has_feature(__cxx_noexcept__)
-# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
-# endif // __has_feature(__cxx_noexcept__)
-# elif defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# elif defined(ASIO_MSVC)
-# if (_MSC_VER >= 1900)
-# define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
-# endif // (_MSC_VER >= 1900)
-# endif // defined(ASIO_MSVC)
-# if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
-# define ASIO_ERROR_CATEGORY_NOEXCEPT
-# endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
-#endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
-
-// Standard library support for arrays.
-#if !defined(ASIO_HAS_STD_ARRAY)
-# if !defined(ASIO_DISABLE_STD_ARRAY)
+# endif // !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
+#endif // !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
+
+// Support concepts on compilers known to allow them.
+#if !defined(ASIO_HAS_CONCEPTS)
+# if !defined(ASIO_DISABLE_CONCEPTS)
+# if defined(__cpp_concepts)
+# define ASIO_HAS_CONCEPTS 1
+# if (__cpp_concepts >= 201707)
+# define ASIO_CONCEPT concept
+# else // (__cpp_concepts >= 201707)
+# define ASIO_CONCEPT concept bool
+# endif // (__cpp_concepts >= 201707)
+# endif // defined(__cpp_concepts)
+# endif // !defined(ASIO_DISABLE_CONCEPTS)
+#endif // !defined(ASIO_HAS_CONCEPTS)
+
+// Support concepts on compilers known to allow them.
+#if !defined(ASIO_HAS_STD_CONCEPTS)
+# if !defined(ASIO_DISABLE_STD_CONCEPTS)
+# if defined(ASIO_HAS_CONCEPTS)
+# if (__cpp_lib_concepts >= 202002L)
+# define ASIO_HAS_STD_CONCEPTS 1
+# endif // (__cpp_concepts >= 202002L)
+# endif // defined(ASIO_HAS_CONCEPTS)
+# endif // !defined(ASIO_DISABLE_STD_CONCEPTS)
+#endif // !defined(ASIO_HAS_STD_CONCEPTS)
+
+// Support template variables on compilers known to allow it.
+#if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
+# if !defined(ASIO_DISABLE_VARIABLE_TEMPLATES)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_ARRAY 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<array>)
-# define ASIO_HAS_STD_ARRAY 1
-# endif // __has_include(<array>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_ARRAY 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
+# if (__cplusplus >= 201402)
+# if __has_feature(__cxx_variable_templates__)
+# define ASIO_HAS_VARIABLE_TEMPLATES 1
+# endif // __has_feature(__cxx_variable_templates__)
+# endif // (__cplusplus >= 201402)
+# elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
+# if (__GNUC__ >= 6)
+# if (__cplusplus >= 201402)
+# define ASIO_HAS_VARIABLE_TEMPLATES 1
+# endif // (__cplusplus >= 201402)
+# endif // (__GNUC__ >= 6)
+# endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1600)
-# define ASIO_HAS_STD_ARRAY 1
-# endif // (_MSC_VER >= 1600)
+# if (_MSC_VER >= 1901)
+# define ASIO_HAS_VARIABLE_TEMPLATES 1
+# endif // (_MSC_VER >= 1901)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_ARRAY)
-#endif // !defined(ASIO_HAS_STD_ARRAY)
+# endif // !defined(ASIO_DISABLE_VARIABLE_TEMPLATES)
+#endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
-// Standard library support for shared_ptr and weak_ptr.
-#if !defined(ASIO_HAS_STD_SHARED_PTR)
-# if !defined(ASIO_DISABLE_STD_SHARED_PTR)
+// Support SFINAEd template variables on compilers known to allow it.
+#if !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
+# if !defined(ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_SHARED_PTR 1
-# elif (__cplusplus >= 201103)
-# define ASIO_HAS_STD_SHARED_PTR 1
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_SHARED_PTR 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201703)
+# if __has_feature(__cxx_variable_templates__)
+# define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
+# endif // __has_feature(__cxx_variable_templates__)
+# endif // (__cplusplus >= 201703)
+# elif defined(__GNUC__)
+# if ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
+# if (__cplusplus >= 201402)
+# define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
+# endif // (__cplusplus >= 201402)
+# endif // ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
# endif // defined(__GNUC__)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1600)
-# define ASIO_HAS_STD_SHARED_PTR 1
-# endif // (_MSC_VER >= 1600)
+# if (_MSC_VER >= 1901)
+# define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
+# endif // (_MSC_VER >= 1901)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_SHARED_PTR)
-#endif // !defined(ASIO_HAS_STD_SHARED_PTR)
+# endif // !defined(ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
+#endif // !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
-// Standard library support for allocator_arg_t.
-#if !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
-# if !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
+// Support SFINAE use of constant expressions on compilers known to allow it.
+#if !defined(ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
+# if !defined(ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_ALLOCATOR_ARG 1
-# elif (__cplusplus >= 201103)
-# define ASIO_HAS_STD_ALLOCATOR_ARG 1
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_ALLOCATOR_ARG 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
+# if (__cplusplus >= 201402)
+# define ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
+# endif // (__cplusplus >= 201402)
+# elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
+# if (__GNUC__ >= 7)
+# if (__cplusplus >= 201402)
+# define ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
+# endif // (__cplusplus >= 201402)
+# endif // (__GNUC__ >= 7)
+# endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1600)
-# define ASIO_HAS_STD_ALLOCATOR_ARG 1
-# endif // (_MSC_VER >= 1600)
+# if (_MSC_VER >= 1901)
+# define ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
+# endif // (_MSC_VER >= 1901)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
-#endif // !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
+# endif // !defined(ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
+#endif // !defined(ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
-// Standard library support for atomic operations.
-#if !defined(ASIO_HAS_STD_ATOMIC)
-# if !defined(ASIO_DISABLE_STD_ATOMIC)
-# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_ATOMIC 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<atomic>)
-# define ASIO_HAS_STD_ATOMIC 1
-# endif // __has_include(<atomic>)
+// Enable workarounds for lack of working expression SFINAE.
+#if !defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
+# if !defined(ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
+# if !defined(ASIO_MSVC) && !defined(__INTEL_COMPILER)
+# if (__cplusplus >= 201103)
+# define ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
+# elif defined(ASIO_MSVC) && (_MSC_VER >= 1929)
+# if (_MSVC_LANG >= 202000)
+# define ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
+# endif // (_MSVC_LANG >= 202000)
+# endif // defined(ASIO_MSVC) && (_MSC_VER >= 1929)
+# endif // !defined(ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
+#endif // !defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
+
+// Support for capturing parameter packs in lambdas.
+#if !defined(ASIO_HAS_VARIADIC_LAMBDA_CAPTURES)
+# if !defined(ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES)
# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_ATOMIC 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_ATOMIC 1
-# endif // (_MSC_VER >= 1700)
-# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_ATOMIC)
-#endif // !defined(ASIO_HAS_STD_ATOMIC)
-
-// Standard library support for chrono. Some standard libraries (such as the
-// libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
-// drafts, rather than the eventually standardised name of steady_clock.
-#if !defined(ASIO_HAS_STD_CHRONO)
-# if !defined(ASIO_DISABLE_STD_CHRONO)
-# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_CHRONO 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<chrono>)
-# define ASIO_HAS_STD_CHRONO 1
-# endif // __has_include(<chrono>)
+# if (__GNUC__ >= 6)
+# define ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
+# endif // (__GNUC__ >= 6)
+# elif defined(ASIO_MSVC)
+# if (_MSVC_LANG >= 201103)
+# define ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
+# endif // (_MSC_LANG >= 201103)
+# else // defined(ASIO_MSVC)
+# if (__cplusplus >= 201103)
+# define ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_CHRONO 1
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
-# define ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK 1
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_CHRONO 1
-# endif // (_MSC_VER >= 1700)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_CHRONO)
-#endif // !defined(ASIO_HAS_STD_CHRONO)
+# endif // !defined(ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES)
+#endif // !defined(ASIO_HAS_VARIADIC_LAMBDA_CAPTURES)
+
+// Default alignment.
+#if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
+# define ASIO_DEFAULT_ALIGN __STDCPP_DEFAULT_NEW_ALIGNMENT__
+#elif defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
+# define ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
+# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
+# define ASIO_DEFAULT_ALIGN alignof(max_align_t)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
+#else // defined(__GNUC__)
+# define ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
+#endif // defined(__GNUC__)
+
+// Standard library support for aligned allocation.
+#if !defined(ASIO_HAS_STD_ALIGNED_ALLOC)
+# if !defined(ASIO_DISABLE_STD_ALIGNED_ALLOC)
+# 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(__APPLE__)
+# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
+# if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
+# define ASIO_HAS_STD_ALIGNED_ALLOC 1
+# endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
+# elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
+# if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
+# define ASIO_HAS_STD_ALIGNED_ALLOC 1
+# endif // (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
+# elif defined(__TV_OS_VERSION_MIN_REQUIRED)
+# if (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
+# define ASIO_HAS_STD_ALIGNED_ALLOC 1
+# endif // (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
+# elif defined(__WATCH_OS_VERSION_MIN_REQUIRED)
+# if (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000)
+# 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__)
+# elif defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+# define ASIO_HAS_STD_ALIGNED_ALLOC 1
+# endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+# elif defined(__GNUC__)
+# if ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
+# if defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+# define ASIO_HAS_STD_ALIGNED_ALLOC 1
+# endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
+# endif // ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
+# endif // defined(__GNUC__)
+# endif // (__cplusplus >= 201703)
+# endif // !defined(ASIO_DISABLE_STD_ALIGNED_ALLOC)
+#endif // !defined(ASIO_HAS_STD_ALIGNED_ALLOC)
// Boost support for chrono.
#if !defined(ASIO_HAS_BOOST_CHRONO)
# if !defined(ASIO_DISABLE_BOOST_CHRONO)
-# if (BOOST_VERSION >= 104700)
+# if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
# define ASIO_HAS_BOOST_CHRONO 1
-# endif // (BOOST_VERSION >= 104700)
+# endif // defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
# endif // !defined(ASIO_DISABLE_BOOST_CHRONO)
#endif // !defined(ASIO_HAS_BOOST_CHRONO)
@@ -471,276 +449,250 @@
# endif // !defined(ASIO_DISABLE_BOOST_DATE_TIME)
#endif // !defined(ASIO_HAS_BOOST_DATE_TIME)
-// Standard library support for addressof.
-#if !defined(ASIO_HAS_STD_ADDRESSOF)
-# if !defined(ASIO_DISABLE_STD_ADDRESSOF)
-# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_ADDRESSOF 1
-# elif (__cplusplus >= 201103)
-# define ASIO_HAS_STD_ADDRESSOF 1
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_ADDRESSOF 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_ADDRESSOF 1
-# endif // (_MSC_VER >= 1700)
-# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_ADDRESSOF)
-#endif // !defined(ASIO_HAS_STD_ADDRESSOF)
+// Boost support for the Coroutine library.
+#if !defined(ASIO_HAS_BOOST_COROUTINE)
+# if !defined(ASIO_DISABLE_BOOST_COROUTINE)
+# define ASIO_HAS_BOOST_COROUTINE 1
+# endif // !defined(ASIO_DISABLE_BOOST_COROUTINE)
+#endif // !defined(ASIO_HAS_BOOST_COROUTINE)
-// Standard library support for the function class.
-#if !defined(ASIO_HAS_STD_FUNCTION)
-# if !defined(ASIO_DISABLE_STD_FUNCTION)
+// Boost support for the Context library's fibers.
+#if !defined(ASIO_HAS_BOOST_CONTEXT_FIBER)
+# if !defined(ASIO_DISABLE_BOOST_CONTEXT_FIBER)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_FUNCTION 1
-# elif (__cplusplus >= 201103)
-# define ASIO_HAS_STD_FUNCTION 1
+# if (__cplusplus >= 201103)
+# define ASIO_HAS_BOOST_CONTEXT_FIBER 1
# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_FUNCTION 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# elif defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define ASIO_HAS_BOOST_CONTEXT_FIBER 1
+# endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
# endif // defined(__GNUC__)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_FUNCTION 1
-# endif // (_MSC_VER >= 1700)
+# if (_MSVC_LANG >= 201103)
+# define ASIO_HAS_BOOST_CONTEXT_FIBER 1
+# endif // (_MSC_LANG >= 201103)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_FUNCTION)
-#endif // !defined(ASIO_HAS_STD_FUNCTION)
+# endif // !defined(ASIO_DISABLE_BOOST_CONTEXT_FIBER)
+#endif // !defined(ASIO_HAS_BOOST_CONTEXT_FIBER)
-// Standard library support for type traits.
-#if !defined(ASIO_HAS_STD_TYPE_TRAITS)
-# if !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
+// Standard library support for std::string_view.
+#if !defined(ASIO_HAS_STD_STRING_VIEW)
+# if !defined(ASIO_DISABLE_STD_STRING_VIEW)
# if defined(__clang__)
# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_TYPE_TRAITS 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<type_traits>)
-# define ASIO_HAS_STD_TYPE_TRAITS 1
-# endif // __has_include(<type_traits>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_TYPE_TRAITS 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_TYPE_TRAITS 1
-# endif // (_MSC_VER >= 1700)
-# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
-#endif // !defined(ASIO_HAS_STD_TYPE_TRAITS)
-
-// Standard library support for the nullptr_t type.
-#if !defined(ASIO_HAS_NULLPTR)
-# if !defined(ASIO_DISABLE_NULLPTR)
-# if defined(__clang__)
-# if __has_feature(__cxx_nullptr__)
-# define ASIO_HAS_NULLPTR 1
-# endif // __has_feature(__cxx_rvalue_references__)
+# if (__cplusplus >= 201402)
+# if __has_include(<string_view>)
+# define ASIO_HAS_STD_STRING_VIEW 1
+# endif // __has_include(<string_view>)
+# endif // (__cplusplus >= 201402)
+# else // defined(ASIO_HAS_CLANG_LIBCXX)
+# if (__cplusplus >= 201703)
+# if __has_include(<string_view>)
+# define ASIO_HAS_STD_STRING_VIEW 1
+# endif // __has_include(<string_view>)
+# endif // (__cplusplus >= 201703)
+# endif // defined(ASIO_HAS_CLANG_LIBCXX)
# elif defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_NULLPTR 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_NULLPTR 1
-# endif // (_MSC_VER >= 1700)
+# if (__GNUC__ >= 7)
+# if (__cplusplus >= 201703)
+# define ASIO_HAS_STD_STRING_VIEW 1
+# endif // (__cplusplus >= 201703)
+# endif // (__GNUC__ >= 7)
+# elif defined(ASIO_MSVC)
+# if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
+# define ASIO_HAS_STD_STRING_VIEW 1
+# endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_NULLPTR)
-#endif // !defined(ASIO_HAS_NULLPTR)
+# endif // !defined(ASIO_DISABLE_STD_STRING_VIEW)
+#endif // !defined(ASIO_HAS_STD_STRING_VIEW)
-// Standard library support for the cstdint header.
-#if !defined(ASIO_HAS_CSTDINT)
-# if !defined(ASIO_DISABLE_CSTDINT)
+// Standard library support for std::experimental::string_view.
+#if !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
+# if !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
# if defined(__clang__)
# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_CSTDINT 1
-# elif (__cplusplus >= 201103)
-# define ASIO_HAS_CSTDINT 1
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_CSTDINT 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# if (_LIBCPP_VERSION < 7000)
+# if (__cplusplus >= 201402)
+# if __has_include(<experimental/string_view>)
+# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
+# endif // __has_include(<experimental/string_view>)
+# endif // (__cplusplus >= 201402)
+# endif // (_LIBCPP_VERSION < 7000)
+# else // defined(ASIO_HAS_CLANG_LIBCXX)
+# if (__cplusplus >= 201402)
+# if __has_include(<experimental/string_view>)
+# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
+# endif // __has_include(<experimental/string_view>)
+# endif // (__cplusplus >= 201402)
+# endif // // defined(ASIO_HAS_CLANG_LIBCXX)
+# elif defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201402)
+# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
+# endif // (__cplusplus >= 201402)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
# endif // defined(__GNUC__)
+# endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
+#endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
+
+// Standard library has a string_view that we can use.
+#if !defined(ASIO_HAS_STRING_VIEW)
+# if !defined(ASIO_DISABLE_STRING_VIEW)
+# if defined(ASIO_HAS_STD_STRING_VIEW)
+# define ASIO_HAS_STRING_VIEW 1
+# elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
+# define ASIO_HAS_STRING_VIEW 1
+# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
+# endif // !defined(ASIO_DISABLE_STRING_VIEW)
+#endif // !defined(ASIO_HAS_STRING_VIEW)
+
+// Standard library has invoke_result (which supersedes result_of).
+#if !defined(ASIO_HAS_STD_INVOKE_RESULT)
+# if !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_CSTDINT 1
-# endif // (_MSC_VER >= 1700)
+# if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
+# define ASIO_HAS_STD_INVOKE_RESULT 1
+# endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
+# else // defined(ASIO_MSVC)
+# if (__cplusplus >= 201703)
+# define ASIO_HAS_STD_INVOKE_RESULT 1
+# endif // (__cplusplus >= 201703)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_CSTDINT)
-#endif // !defined(ASIO_HAS_CSTDINT)
+# endif // !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
+#endif // !defined(ASIO_HAS_STD_INVOKE_RESULT)
-// Standard library support for the thread class.
-#if !defined(ASIO_HAS_STD_THREAD)
-# if !defined(ASIO_DISABLE_STD_THREAD)
+// Standard library support for std::any.
+#if !defined(ASIO_HAS_STD_ANY)
+# if !defined(ASIO_DISABLE_STD_ANY)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_THREAD 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<thread>)
-# define ASIO_HAS_STD_THREAD 1
-# endif // __has_include(<thread>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_THREAD 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201703)
+# if __has_include(<any>)
+# define ASIO_HAS_STD_ANY 1
+# endif // __has_include(<any>)
+# endif // (__cplusplus >= 201703)
+# elif defined(__GNUC__)
+# if (__GNUC__ >= 7)
+# if (__cplusplus >= 201703)
+# define ASIO_HAS_STD_ANY 1
+# endif // (__cplusplus >= 201703)
+# endif // (__GNUC__ >= 7)
# endif // defined(__GNUC__)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_THREAD 1
-# endif // (_MSC_VER >= 1700)
+# if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
+# define ASIO_HAS_STD_ANY 1
+# endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_THREAD)
-#endif // !defined(ASIO_HAS_STD_THREAD)
+# endif // !defined(ASIO_DISABLE_STD_ANY)
+#endif // !defined(ASIO_HAS_STD_ANY)
-// Standard library support for the mutex and condition variable classes.
-#if !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
-# if !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
+// Standard library support for std::variant.
+#if !defined(ASIO_HAS_STD_VARIANT)
+# if !defined(ASIO_DISABLE_STD_VARIANT)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<mutex>)
-# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
-# endif // __has_include(<mutex>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201703)
+# if __has_include(<variant>)
+# define ASIO_HAS_STD_VARIANT 1
+# endif // __has_include(<variant>)
+# endif // (__cplusplus >= 201703)
+# elif defined(__GNUC__)
+# if (__GNUC__ >= 7)
+# if (__cplusplus >= 201703)
+# define ASIO_HAS_STD_VARIANT 1
+# endif // (__cplusplus >= 201703)
+# endif // (__GNUC__ >= 7)
# endif // defined(__GNUC__)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
-# endif // (_MSC_VER >= 1700)
+# if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
+# define ASIO_HAS_STD_VARIANT 1
+# endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
-#endif // !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
-
-// Standard library support for the call_once function.
-#if !defined(ASIO_HAS_STD_CALL_ONCE)
-# if !defined(ASIO_DISABLE_STD_CALL_ONCE)
-# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_CALL_ONCE 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<mutex>)
-# define ASIO_HAS_STD_CALL_ONCE 1
-# endif // __has_include(<mutex>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
+# endif // !defined(ASIO_DISABLE_STD_VARIANT)
+#endif // !defined(ASIO_HAS_STD_VARIANT)
+
+// Standard library support for std::source_location.
+#if !defined(ASIO_HAS_STD_SOURCE_LOCATION)
+# if !defined(ASIO_DISABLE_STD_SOURCE_LOCATION)
+// ...
+# endif // !defined(ASIO_DISABLE_STD_SOURCE_LOCATION)
+#endif // !defined(ASIO_HAS_STD_SOURCE_LOCATION)
+
+// Standard library support for std::experimental::source_location.
+#if !defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
+# if !defined(ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_CALL_ONCE 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201709)
+# if __has_include(<experimental/source_location>)
+# define ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION 1
+# endif // __has_include(<experimental/source_location>)
+# endif // (__cplusplus >= 201709)
# endif // defined(__GNUC__)
-# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_CALL_ONCE 1
-# endif // (_MSC_VER >= 1700)
-# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_CALL_ONCE)
-#endif // !defined(ASIO_HAS_STD_CALL_ONCE)
-
-// Standard library support for futures.
-#if !defined(ASIO_HAS_STD_FUTURE)
-# if !defined(ASIO_DISABLE_STD_FUTURE)
+# endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
+#endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
+
+// Standard library has a source_location that we can use.
+#if !defined(ASIO_HAS_SOURCE_LOCATION)
+# if !defined(ASIO_DISABLE_SOURCE_LOCATION)
+# if defined(ASIO_HAS_STD_SOURCE_LOCATION)
+# define ASIO_HAS_SOURCE_LOCATION 1
+# elif defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
+# define ASIO_HAS_SOURCE_LOCATION 1
+# endif // defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
+# endif // !defined(ASIO_DISABLE_SOURCE_LOCATION)
+#endif // !defined(ASIO_HAS_SOURCE_LOCATION)
+
+// Boost support for source_location and system errors.
+#if !defined(ASIO_HAS_BOOST_SOURCE_LOCATION)
+# if !defined(ASIO_DISABLE_BOOST_SOURCE_LOCATION)
+# if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
+# define ASIO_HAS_BOOST_SOURCE_LOCATION 1
+# endif // defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
+# endif // !defined(ASIO_DISABLE_BOOST_SOURCE_LOCATION)
+#endif // !defined(ASIO_HAS_BOOST_SOURCE_LOCATION)
+
+// Helper macros for working with Boost source locations.
+#if defined(ASIO_HAS_BOOST_SOURCE_LOCATION)
+# define ASIO_SOURCE_LOCATION_PARAM \
+ , const boost::source_location& loc
+# define ASIO_SOURCE_LOCATION_DEFAULTED_PARAM \
+ , const boost::source_location& loc = BOOST_CURRENT_LOCATION
+# define ASIO_SOURCE_LOCATION_ARG , loc
+#else // if defined(ASIO_HAS_BOOST_SOURCE_LOCATION)
+# define ASIO_SOURCE_LOCATION_PARAM
+# define ASIO_SOURCE_LOCATION_DEFAULTED_PARAM
+# define ASIO_SOURCE_LOCATION_ARG
+#endif // if defined(ASIO_HAS_BOOST_SOURCE_LOCATION)
+
+// Standard library support for std::index_sequence.
+#if !defined(ASIO_HAS_STD_INDEX_SEQUENCE)
+# if !defined(ASIO_DISABLE_STD_INDEX_SEQUENCE)
# if defined(__clang__)
-# if defined(ASIO_HAS_CLANG_LIBCXX)
-# define ASIO_HAS_STD_FUTURE 1
-# elif (__cplusplus >= 201103)
-# if __has_include(<future>)
-# define ASIO_HAS_STD_FUTURE 1
-# endif // __has_include(<mutex>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# if defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define ASIO_HAS_STD_FUTURE 1
-# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201402)
+# define ASIO_HAS_STD_INDEX_SEQUENCE 1
+# endif // (__cplusplus >= 201402)
+# elif defined(__GNUC__)
+# if (__GNUC__ >= 7)
+# if (__cplusplus >= 201402)
+# define ASIO_HAS_STD_INDEX_SEQUENCE 1
+# endif // (__cplusplus >= 201402)
+# endif // (__GNUC__ >= 7)
# endif // defined(__GNUC__)
# if defined(ASIO_MSVC)
-# if (_MSC_VER >= 1700)
-# define ASIO_HAS_STD_FUTURE 1
-# endif // (_MSC_VER >= 1700)
+# if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
+# define ASIO_HAS_STD_INDEX_SEQUENCE 1
+# endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
# endif // defined(ASIO_MSVC)
-# endif // !defined(ASIO_DISABLE_STD_FUTURE)
-#endif // !defined(ASIO_HAS_STD_FUTURE)
-
-// Standard library support for experimental::string_view.
-#if !defined(ASIO_HAS_STD_STRING_VIEW)
-# if !defined(ASIO_DISABLE_STD_STRING_VIEW)
-# if defined(__clang__)
-# if (__cplusplus >= 201103)
-# ifdef _LIBCPP_VERSION
-# if _LIBCPP_VERSION >= 8000
-# define ASIO_HAS_STD_STRING_VIEW 1
-# endif
-# endif
-# if !defined(ASIO_HAS_STD_STRING_VIEW) && __has_include(<experimental/string_view>)
-# define ASIO_HAS_STD_STRING_VIEW 1
-# if defined(__APPLE__)
-# if ((__clang_major__ < 10) || ((__clang_major__ == 10) && (__clang_minor__ == 0) && (__clang_patchlevel__ < 1)))
-# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
-# endif // clang < 10.0.1
-# else // for non-Xcode Clang
-# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
-# endif
-# endif // __has_include(<experimental/string_view>)
-# endif // (__cplusplus >= 201103)
-# endif // defined(__clang__)
-# if defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
-# if (__cplusplus >= 201300)
-# define ASIO_HAS_STD_STRING_VIEW 1
-# define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
-# endif // (__cplusplus >= 201300)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
-# endif // defined(__GNUC__)
-# endif // !defined(ASIO_DISABLE_STD_STRING_VIEW)
-#endif // !defined(ASIO_HAS_STD_STRING_VIEW)
+# endif // !defined(ASIO_DISABLE_STD_INDEX_SEQUENCE)
+#endif // !defined(ASIO_HAS_STD_INDEX_SEQUENCE)
// Windows App target. Windows but with a limited API.
#if !defined(ASIO_WINDOWS_APP)
# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
# include <winapifamily.h>
-# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
+# if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
+ || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)) \
&& !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# define ASIO_WINDOWS_APP 1
# endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
@@ -778,18 +730,18 @@
// Windows: target OS version.
#if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
# if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
-# if defined(_MSC_VER) || defined(__BORLANDC__)
+# if defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
# pragma message( \
"Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
- "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\
- "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\
- "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).")
-# else // defined(_MSC_VER) || defined(__BORLANDC__)
+ "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
+ "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
+ "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
+# else // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
-# warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
-# warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
-# endif // defined(_MSC_VER) || defined(__BORLANDC__)
-# define _WIN32_WINNT 0x0501
+# warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
+# warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
+# endif // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
+# define _WIN32_WINNT 0x0601
# endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
# if defined(_MSC_VER)
# if defined(_WIN32) && !defined(WIN32)
@@ -860,7 +812,8 @@
|| defined(__FreeBSD__) \
|| defined(__NetBSD__) \
|| defined(__OpenBSD__) \
- || defined(__linux__)
+ || defined(__linux__) \
+ || defined(__HAIKU__)
# define ASIO_HAS_UNISTD_H 1
# endif
# endif // !defined(ASIO_HAS_BOOST_CONFIG)
@@ -869,7 +822,7 @@
# include <unistd.h>
#endif // defined(ASIO_HAS_UNISTD_H)
-// Linux: epoll, eventfd and timerfd.
+// Linux: epoll, eventfd, timerfd and io_uring.
#if defined(__linux__)
# include <linux/version.h>
# if !defined(ASIO_HAS_EPOLL)
@@ -893,8 +846,20 @@
# endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
# endif // defined(ASIO_HAS_EPOLL)
# endif // !defined(ASIO_HAS_TIMERFD)
+# if defined(ASIO_HAS_IO_URING)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
+# error Linux kernel 5.10 or later is required to support io_uring
+# endif // LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
+# endif // defined(ASIO_HAS_IO_URING)
#endif // defined(__linux__)
+// Linux: io_uring is used instead of epoll.
+#if !defined(ASIO_HAS_IO_URING_AS_DEFAULT)
+# if !defined(ASIO_HAS_EPOLL) && defined(ASIO_HAS_IO_URING)
+# define ASIO_HAS_IO_URING_AS_DEFAULT 1
+# endif // !defined(ASIO_HAS_EPOLL) && defined(ASIO_HAS_IO_URING)
+#endif // !defined(ASIO_HAS_IO_URING_AS_DEFAULT)
+
// Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
#if (defined(__MACH__) && defined(__APPLE__)) \
|| defined(__FreeBSD__) \
@@ -990,16 +955,40 @@
// UNIX domain sockets.
#if !defined(ASIO_HAS_LOCAL_SOCKETS)
# if !defined(ASIO_DISABLE_LOCAL_SOCKETS)
-# if !defined(ASIO_WINDOWS) \
- && !defined(ASIO_WINDOWS_RUNTIME) \
- && !defined(__CYGWIN__)
+# if !defined(ASIO_WINDOWS_RUNTIME)
# define ASIO_HAS_LOCAL_SOCKETS 1
-# endif // !defined(ASIO_WINDOWS)
- // && !defined(ASIO_WINDOWS_RUNTIME)
- // && !defined(__CYGWIN__)
+# endif // !defined(ASIO_WINDOWS_RUNTIME)
# endif // !defined(ASIO_DISABLE_LOCAL_SOCKETS)
#endif // !defined(ASIO_HAS_LOCAL_SOCKETS)
+// Files.
+#if !defined(ASIO_HAS_FILE)
+# if !defined(ASIO_DISABLE_FILE)
+# if defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
+# define ASIO_HAS_FILE 1
+# elif defined(ASIO_HAS_IO_URING)
+# define ASIO_HAS_FILE 1
+# endif // defined(ASIO_HAS_IO_URING)
+# endif // !defined(ASIO_DISABLE_FILE)
+#endif // !defined(ASIO_HAS_FILE)
+
+// Pipes.
+#if !defined(ASIO_HAS_PIPE)
+# if defined(ASIO_HAS_IOCP) \
+ || !defined(ASIO_WINDOWS) \
+ && !defined(ASIO_WINDOWS_RUNTIME) \
+ && !defined(__CYGWIN__)
+# if !defined(__SYMBIAN32__)
+# if !defined(ASIO_DISABLE_PIPE)
+# define ASIO_HAS_PIPE 1
+# endif // !defined(ASIO_DISABLE_PIPE)
+# endif // !defined(__SYMBIAN32__)
+# endif // defined(ASIO_HAS_IOCP)
+ // || !defined(ASIO_WINDOWS)
+ // && !defined(ASIO_WINDOWS_RUNTIME)
+ // && !defined(__CYGWIN__)
+#endif // !defined(ASIO_HAS_PIPE)
+
// Can use sigaction() instead of signal().
#if !defined(ASIO_HAS_SIGACTION)
# if !defined(ASIO_DISABLE_SIGACTION)
@@ -1080,6 +1069,8 @@
# define ASIO_HAS_THREADS 1
# elif defined(__APPLE__)
# define ASIO_HAS_THREADS 1
+# elif defined(__HAIKU__)
+# define ASIO_HAS_THREADS 1
# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
# define ASIO_HAS_THREADS 1
# elif defined(_PTHREADS)
@@ -1095,6 +1086,8 @@
# define ASIO_HAS_PTHREADS 1
# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
# define ASIO_HAS_PTHREADS 1
+# elif defined(__HAIKU__)
+# define ASIO_HAS_PTHREADS 1
# endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
# endif // defined(ASIO_HAS_THREADS)
#endif // !defined(ASIO_HAS_PTHREADS)
@@ -1113,6 +1106,15 @@
# endif // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
#endif // !defined(ASIO_STATIC_CONSTANT)
+// Boost align library.
+#if !defined(ASIO_HAS_BOOST_ALIGN)
+# if !defined(ASIO_DISABLE_BOOST_ALIGN)
+# if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
+# define ASIO_HAS_BOOST_ALIGN 1
+# endif // defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
+# endif // !defined(ASIO_DISABLE_BOOST_ALIGN)
+#endif // !defined(ASIO_HAS_BOOST_ALIGN)
+
// Boost array library.
#if !defined(ASIO_HAS_BOOST_ARRAY)
# if !defined(ASIO_DISABLE_BOOST_ARRAY)
@@ -1182,13 +1184,13 @@
# if (__GNUC__ >= 3)
# define ASIO_HAS_HANDLER_HOOKS 1
# endif // (__GNUC__ >= 3)
-# elif !defined(__BORLANDC__)
+# elif !defined(__BORLANDC__) || defined(__clang__)
# define ASIO_HAS_HANDLER_HOOKS 1
-# endif // !defined(__BORLANDC__)
+# endif // !defined(__BORLANDC__) || defined(__clang__)
# endif // !defined(ASIO_DISABLE_HANDLER_HOOKS)
#endif // !defined(ASIO_HAS_HANDLER_HOOKS)
-// Support for the __thread keyword extension.
+// Support for the __thread keyword extension, or equivalent.
#if !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
# if defined(__linux__)
# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
@@ -1210,6 +1212,22 @@
# define ASIO_THREAD_KEYWORD __declspec(thread)
# endif // (_MSC_VER >= 1700)
# endif // defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
+# if defined(__APPLE__)
+# if defined(__clang__)
+# if defined(__apple_build_version__)
+# define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
+# define ASIO_THREAD_KEYWORD __thread
+# endif // defined(__apple_build_version__)
+# endif // defined(__clang__)
+# endif // defined(__APPLE__)
+# if !defined(ASIO_HAS_THREAD_KEYWORD_EXTENSION)
+# if defined(ASIO_HAS_BOOST_CONFIG)
+# if !defined(BOOST_NO_CXX11_THREAD_LOCAL)
+# define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
+# define ASIO_THREAD_KEYWORD thread_local
+# endif // !defined(BOOST_NO_CXX11_THREAD_LOCAL)
+# endif // defined(ASIO_HAS_BOOST_CONFIG)
+# endif // !defined(ASIO_HAS_THREAD_KEYWORD_EXTENSION)
#endif // !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
#if !defined(ASIO_THREAD_KEYWORD)
# define ASIO_THREAD_KEYWORD __thread
@@ -1224,33 +1242,6 @@
// || (defined(__MACH__) && defined(__APPLE__))
#endif // !defined(ASIO_DISABLE_SSIZE_T)
-// Helper macros to manage the transition away from the old services-based API.
-#if defined(ASIO_ENABLE_OLD_SERVICES)
-# define ASIO_SVC_TPARAM , typename Service
-# define ASIO_SVC_TPARAM_DEF1(d1) , typename Service d1
-# define ASIO_SVC_TPARAM_DEF2(d1, d2) , typename Service d1, d2
-# define ASIO_SVC_TARG , Service
-# define ASIO_SVC_T Service
-# define ASIO_SVC_TPARAM1 , typename Service1
-# define ASIO_SVC_TPARAM1_DEF1(d1) , typename Service1 d1
-# define ASIO_SVC_TPARAM1_DEF2(d1, d2) , typename Service1 d1, d2
-# define ASIO_SVC_TARG1 , Service1
-# define ASIO_SVC_T1 Service1
-# define ASIO_SVC_ACCESS public
-#else // defined(ASIO_ENABLE_OLD_SERVICES)
-# define ASIO_SVC_TPARAM
-# define ASIO_SVC_TPARAM_DEF1(d1)
-# define ASIO_SVC_TPARAM_DEF2(d1, d2)
-# define ASIO_SVC_TARG
-// ASIO_SVC_T is defined at each point of use.
-# define ASIO_SVC_TPARAM1
-# define ASIO_SVC_TPARAM1_DEF1(d1)
-# define ASIO_SVC_TPARAM1_DEF2(d1, d2)
-# define ASIO_SVC_TARG1
-// ASIO_SVC_T1 is defined at each point of use.
-# define ASIO_SVC_ACCESS protected
-#endif // defined(ASIO_ENABLE_OLD_SERVICES)
-
// Helper macros to manage transition away from error_code return values.
#if defined(ASIO_NO_DEPRECATED)
# define ASIO_SYNC_OP_VOID void
@@ -1260,4 +1251,172 @@
# define ASIO_SYNC_OP_VOID_RETURN(e) return e
#endif // defined(ASIO_NO_DEPRECATED)
+// Newer gcc, clang need special treatment to suppress unused typedef warnings.
+#if defined(__clang__)
+# if defined(__apple_build_version__)
+# if (__clang_major__ >= 7)
+# define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
+# endif // (__clang_major__ >= 7)
+# elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
+ || (__clang_major__ > 3)
+# define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
+# endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
+ // || (__clang_major__ > 3)
+#elif defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
+# define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
+#endif // defined(__GNUC__)
+#if !defined(ASIO_UNUSED_TYPEDEF)
+# define ASIO_UNUSED_TYPEDEF
+#endif // !defined(ASIO_UNUSED_TYPEDEF)
+
+// Some versions of gcc generate spurious warnings about unused variables.
+#if defined(__GNUC__)
+# if (__GNUC__ >= 4)
+# define ASIO_UNUSED_VARIABLE __attribute__((__unused__))
+# endif // (__GNUC__ >= 4)
+#endif // defined(__GNUC__)
+#if !defined(ASIO_UNUSED_VARIABLE)
+# define ASIO_UNUSED_VARIABLE
+#endif // !defined(ASIO_UNUSED_VARIABLE)
+
+// Helper macro to tell the optimiser what may be assumed to be true.
+#if defined(ASIO_MSVC)
+# define ASIO_ASSUME(expr) __assume(expr)
+#elif defined(__clang__)
+# if __has_builtin(__builtin_assume)
+# define ASIO_ASSUME(expr) __builtin_assume(expr)
+# endif // __has_builtin(__builtin_assume)
+#elif defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+# define ASIO_ASSUME(expr) if (expr) {} else { __builtin_unreachable(); }
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
+#endif // defined(__GNUC__)
+#if !defined(ASIO_ASSUME)
+# define ASIO_ASSUME(expr) (void)0
+#endif // !defined(ASIO_ASSUME)
+
+// 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__)
+# 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__)
+# if (__clang_major__ >= 14)
+# if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
+# if __has_include(<coroutine>)
+# define ASIO_HAS_CO_AWAIT 1
+# endif // __has_include(<coroutine>)
+# elif (__cplusplus >= 201703) && defined(__cpp_coroutines) && (__cpp_coroutines >= 201703)
+# if __has_include(<experimental/coroutine>)
+# define ASIO_HAS_CO_AWAIT 1
+# endif // __has_include(<experimental/coroutine>)
+# endif // (__cplusplus >= 201703) && defined(__cpp_coroutines) && (__cpp_coroutines >= 201703)
+# else // (__clang_major__ >= 14)
+# if (__cplusplus >= 201703) && defined(__cpp_coroutines) && (__cpp_coroutines >= 201703)
+# if __has_include(<experimental/coroutine>)
+# define ASIO_HAS_CO_AWAIT 1
+# endif // __has_include(<experimental/coroutine>)
+# endif // (__cplusplus >= 201703) && defined(__cpp_coroutines) && (__cpp_coroutines >= 201703)
+# endif // (__clang_major__ >= 14)
+# elif defined(__GNUC__)
+# if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
+# if __has_include(<coroutine>)
+# define ASIO_HAS_CO_AWAIT 1
+# endif // __has_include(<coroutine>)
+# endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
+# endif // defined(__GNUC__)
+# endif // !defined(ASIO_DISABLE_CO_AWAIT)
+#endif // !defined(ASIO_HAS_CO_AWAIT)
+
+// Standard library support for coroutines.
+#if !defined(ASIO_HAS_STD_COROUTINE)
+# if !defined(ASIO_DISABLE_STD_COROUTINE)
+# if defined(ASIO_MSVC)
+# if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
+# define ASIO_HAS_STD_COROUTINE 1
+# endif // (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
+# elif defined(__clang__)
+# if (__clang_major__ >= 14)
+# if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
+# if __has_include(<coroutine>)
+# define ASIO_HAS_STD_COROUTINE 1
+# endif // __has_include(<coroutine>)
+# endif // (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
+# endif // (__clang_major__ >= 14)
+# elif defined(__GNUC__)
+# if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
+# if __has_include(<coroutine>)
+# define ASIO_HAS_STD_COROUTINE 1
+# endif // __has_include(<coroutine>)
+# endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
+# endif // defined(__GNUC__)
+# endif // !defined(ASIO_DISABLE_STD_COROUTINE)
+#endif // !defined(ASIO_HAS_STD_COROUTINE)
+
+// Compiler support for the the [[nodiscard]] attribute.
+#if !defined(ASIO_NODISCARD)
+# if defined(__has_cpp_attribute)
+# if __has_cpp_attribute(nodiscard)
+# if (__cplusplus >= 201703)
+# define ASIO_NODISCARD [[nodiscard]]
+# endif // (__cplusplus >= 201703)
+# endif // __has_cpp_attribute(nodiscard)
+# endif // defined(__has_cpp_attribute)
+#endif // !defined(ASIO_NODISCARD)
+#if !defined(ASIO_NODISCARD)
+# define ASIO_NODISCARD
+#endif // !defined(ASIO_NODISCARD)
+
+// Kernel support for MSG_NOSIGNAL.
+#if !defined(ASIO_HAS_MSG_NOSIGNAL)
+# if defined(__linux__)
+# define ASIO_HAS_MSG_NOSIGNAL 1
+# elif defined(_POSIX_VERSION)
+# if (_POSIX_VERSION >= 200809L)
+# define ASIO_HAS_MSG_NOSIGNAL 1
+# endif // _POSIX_VERSION >= 200809L
+# endif // defined(_POSIX_VERSION)
+#endif // !defined(ASIO_HAS_MSG_NOSIGNAL)
+
+// Standard library support for std::to_address.
+#if !defined(ASIO_HAS_STD_TO_ADDRESS)
+# if !defined(ASIO_DISABLE_STD_TO_ADDRESS)
+# if defined(__clang__)
+# if (__cplusplus >= 202002)
+# define ASIO_HAS_STD_TO_ADDRESS 1
+# endif // (__cplusplus >= 202002)
+# elif defined(__GNUC__)
+# if (__GNUC__ >= 8)
+# if (__cplusplus >= 202002)
+# define ASIO_HAS_STD_TO_ADDRESS 1
+# endif // (__cplusplus >= 202002)
+# endif // (__GNUC__ >= 8)
+# endif // defined(__GNUC__)
+# if defined(ASIO_MSVC)
+# if (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
+# define ASIO_HAS_STD_TO_ADDRESS 1
+# endif // (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
+# endif // defined(ASIO_MSVC)
+# endif // !defined(ASIO_DISABLE_STD_TO_ADDRESS)
+#endif // !defined(ASIO_HAS_STD_TO_ADDRESS)
+
+// Standard library support for snprintf.
+#if !defined(ASIO_HAS_SNPRINTF)
+# if !defined(ASIO_DISABLE_SNPRINTF)
+# if defined(__apple_build_version__)
+# if (__clang_major__ >= 14)
+# define ASIO_HAS_SNPRINTF 1
+# endif // (__clang_major__ >= 14)
+# endif // defined(__apple_build_version__)
+# endif // !defined(ASIO_DISABLE_SNPRINTF)
+#endif // !defined(ASIO_HAS_SNPRINTF)
+
#endif // ASIO_DETAIL_CONFIG_HPP