summaryrefslogtreecommitdiff
path: root/boost/asio/detail/config.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/detail/config.hpp')
-rw-r--r--boost/asio/detail/config.hpp323
1 files changed, 315 insertions, 8 deletions
diff --git a/boost/asio/detail/config.hpp b/boost/asio/detail/config.hpp
index afe400e5b7..b3272a666f 100644
--- a/boost/asio/detail/config.hpp
+++ b/boost/asio/detail/config.hpp
@@ -83,6 +83,11 @@
# endif // (__cplusplus >= 201103)
#endif // defined(__clang__)
+// Android platform detection.
+#if defined(__ANDROID__)
+# include <android/api-level.h>
+#endif // defined(__ANDROID__)
+
// Support move construction and assignment on compilers known to allow it.
#if !defined(BOOST_ASIO_HAS_MOVE)
# if !defined(BOOST_ASIO_DISABLE_MOVE)
@@ -111,6 +116,7 @@
// references and perfect forwarding.
#if defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
# define BOOST_ASIO_MOVE_ARG(type) type&&
+# define BOOST_ASIO_MOVE_ARG2(type1, type2) type1, type2&&
# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
#endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
@@ -163,6 +169,30 @@
# endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES)
#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES)
+// Support deleted functions on compilers known to allow it.
+#if !defined(BOOST_ASIO_DELETED)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_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 BOOST_ASIO_DELETED = delete
+# endif // __has_feature(__cxx_deleted_functions__)
+# endif // defined(__clang__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1900)
+# define BOOST_ASIO_DELETED = delete
+# endif // (_MSC_VER >= 1900)
+# endif // defined(BOOST_ASIO_MSVC)
+# if !defined(BOOST_ASIO_DELETED)
+# define BOOST_ASIO_DELETED
+# endif // !defined(BOOST_ASIO_DELETED)
+#endif // !defined(BOOST_ASIO_DELETED)
+
// Support constexpr on compilers known to allow it.
#if !defined(BOOST_ASIO_HAS_CONSTEXPR)
# if !defined(BOOST_ASIO_DISABLE_CONSTEXPR)
@@ -193,6 +223,85 @@
# endif // defined(BOOST_ASIO_HAS_CONSTEXPR)
#endif // !defined(BOOST_ASIO_CONSTEXPR)
+// Support noexcept on compilers known to allow it.
+#if !defined(BOOST_ASIO_NOEXCEPT)
+# if !defined(BOOST_ASIO_DISABLE_NOEXCEPT)
+# if (BOOST_VERSION >= 105300)
+# define BOOST_ASIO_NOEXCEPT BOOST_NOEXCEPT
+# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW
+# elif defined(__clang__)
+# if __has_feature(__cxx_noexcept__)
+# define BOOST_ASIO_NOEXCEPT noexcept(true)
+# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
+# endif // __has_feature(__cxx_noexcept__)
+# elif defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_NOEXCEPT noexcept(true)
+# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# elif defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1900)
+# define BOOST_ASIO_NOEXCEPT noexcept(true)
+# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
+# endif // (_MSC_VER >= 1900)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_NOEXCEPT)
+# if !defined(BOOST_ASIO_NOEXCEPT)
+# define BOOST_ASIO_NOEXCEPT
+# endif // !defined(BOOST_ASIO_NOEXCEPT)
+# if !defined(BOOST_ASIO_NOEXCEPT_OR_NOTHROW)
+# define BOOST_ASIO_NOEXCEPT_OR_NOTHROW throw()
+# endif // !defined(BOOST_ASIO_NOEXCEPT_OR_NOTHROW)
+#endif // !defined(BOOST_ASIO_NOEXCEPT)
+
+// Support automatic type deduction on compilers known to support it.
+#if !defined(BOOST_ASIO_HAS_DECLTYPE)
+# if !defined(BOOST_ASIO_DISABLE_DECLTYPE)
+# if defined(__clang__)
+# if __has_feature(__cxx_decltype__)
+# define BOOST_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 BOOST_ASIO_HAS_DECLTYPE 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_DECLTYPE 1
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_DECLTYPE)
+#endif // !defined(BOOST_ASIO_HAS_DECLTYPE)
+
+// Support alias templates on compilers known to allow it.
+#if !defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
+# if !defined(BOOST_ASIO_DISABLE_ALIAS_TEMPLATES)
+# if defined(__clang__)
+# if __has_feature(__cxx_alias_templates__)
+# define BOOST_ASIO_HAS_ALIAS_TEMPLATES 1
+# endif // __has_feature(__cxx_alias_templates__)
+# endif // defined(__clang__)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_ALIAS_TEMPLATES 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1900)
+# define BOOST_ASIO_HAS_ALIAS_TEMPLATES 1
+# endif // (_MSC_VER >= 1900)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_ALIAS_TEMPLATES)
+#endif // !defined(BOOST_ASIO_HAS_ALIAS_TEMPLATES)
+
// Standard library support for system errors.
# if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR)
# if defined(__clang__)
@@ -294,6 +403,31 @@
# endif // !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
#endif // !defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
+// Standard library support for allocator_arg_t.
+#if !defined(BOOST_ASIO_HAS_STD_ALLOCATOR_ARG)
+# if !defined(BOOST_ASIO_DISABLE_STD_ALLOCATOR_ARG)
+# if defined(__clang__)
+# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
+# define BOOST_ASIO_HAS_STD_ALLOCATOR_ARG 1
+# elif (__cplusplus >= 201103)
+# define BOOST_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 BOOST_ASIO_HAS_STD_ALLOCATOR_ARG 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1600)
+# define BOOST_ASIO_HAS_STD_ALLOCATOR_ARG 1
+# endif // (_MSC_VER >= 1600)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_STD_ALLOCATOR_ARG)
+#endif // !defined(BOOST_ASIO_HAS_STD_ALLOCATOR_ARG)
+
// Standard library support for atomic operations.
#if !defined(BOOST_ASIO_HAS_STD_ATOMIC)
# if !defined(BOOST_ASIO_DISABLE_STD_ATOMIC)
@@ -362,6 +496,15 @@
# endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
#endif // !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+// Some form of chrono library is available.
+#if !defined(BOOST_ASIO_HAS_CHRONO)
+# if defined(BOOST_ASIO_HAS_STD_CHRONO) \
+ || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+# define BOOST_ASIO_HAS_CHRONO 1
+# endif // defined(BOOST_ASIO_HAS_STD_CHRONO)
+ // || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
+#endif // !defined(BOOST_ASIO_HAS_CHRONO)
+
// Boost support for the DateTime library.
#if !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
# if !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
@@ -446,6 +589,28 @@
# endif // !defined(BOOST_ASIO_DISABLE_STD_TYPE_TRAITS)
#endif // !defined(BOOST_ASIO_HAS_STD_TYPE_TRAITS)
+// Standard library support for the nullptr_t type.
+#if !defined(BOOST_ASIO_HAS_NULLPTR)
+# if !defined(BOOST_ASIO_DISABLE_NULLPTR)
+# if defined(__clang__)
+# if __has_feature(__cxx_nullptr__)
+# define BOOST_ASIO_HAS_NULLPTR 1
+# endif // __has_feature(__cxx_rvalue_references__)
+# elif defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_NULLPTR 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_NULLPTR 1
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_NULLPTR)
+#endif // !defined(BOOST_ASIO_HAS_NULLPTR)
+
// Standard library support for the C++11 allocator additions.
#if !defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
# if !defined(BOOST_ASIO_DISABLE_CXX11_ALLOCATORS)
@@ -456,16 +621,16 @@
# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1
# endif // (__cplusplus >= 201103)
# elif defined(__GNUC__)
-# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
# if defined(__GXX_EXPERIMENTAL_CXX0X__)
# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1
# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
-# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
# endif // defined(__GNUC__)
# if defined(BOOST_ASIO_MSVC)
-# if (_MSC_VER >= 1700)
+# if (_MSC_VER >= 1800)
# define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1
-# endif // (_MSC_VER >= 1700)
+# endif // (_MSC_VER >= 1800)
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_CXX11_ALLOCATORS)
#endif // !defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
@@ -549,6 +714,105 @@
# endif // !defined(BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
#endif // !defined(BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR)
+// Standard library support for the call_once function.
+#if !defined(BOOST_ASIO_HAS_STD_CALL_ONCE)
+# if !defined(BOOST_ASIO_DISABLE_STD_CALL_ONCE)
+# if defined(__clang__)
+# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
+# define BOOST_ASIO_HAS_STD_CALL_ONCE 1
+# elif (__cplusplus >= 201103)
+# if __has_include(<mutex>)
+# define BOOST_ASIO_HAS_STD_CALL_ONCE 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 BOOST_ASIO_HAS_STD_CALL_ONCE 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_STD_CALL_ONCE 1
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_STD_CALL_ONCE)
+#endif // !defined(BOOST_ASIO_HAS_STD_CALL_ONCE)
+
+// Standard library support for futures.
+#if !defined(BOOST_ASIO_HAS_STD_FUTURE)
+# if !defined(BOOST_ASIO_DISABLE_STD_FUTURE)
+# if defined(__clang__)
+# if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
+# define BOOST_ASIO_HAS_STD_FUTURE 1
+# elif (__cplusplus >= 201103)
+# if __has_include(<future>)
+# define BOOST_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 BOOST_ASIO_HAS_STD_FUTURE 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_STD_FUTURE 1
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_STD_FUTURE)
+#endif // !defined(BOOST_ASIO_HAS_STD_FUTURE)
+
+// Standard library support for experimental::string_view.
+#if !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
+# if !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
+# if defined(__clang__)
+# if (__cplusplus >= 201402)
+# if __has_include(<experimental/string_view>)
+# define BOOST_ASIO_HAS_STD_STRING_VIEW 1
+# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
+# endif // __has_include(<experimental/string_view>)
+# endif // (__cplusplus >= 201402)
+# endif // defined(__clang__)
+# if defined(__GNUC__)
+# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
+# if (__cplusplus >= 201402)
+# define BOOST_ASIO_HAS_STD_STRING_VIEW 1
+# define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
+# endif // (__cplusplus >= 201402)
+# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1910 && _HAS_CXX17)
+# define BOOST_ASIO_HAS_STD_STRING_VIEW
+# endif // (_MSC_VER >= 1910)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
+#endif // !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
+
+// Standard library support for iostream move construction and assignment.
+#if !defined(BOOST_ASIO_HAS_STD_IOSTREAM_MOVE)
+# if !defined(BOOST_ASIO_DISABLE_STD_IOSTREAM_MOVE)
+# if defined(__GNUC__)
+# if (__GNUC__ > 4)
+# if defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define BOOST_ASIO_HAS_STD_IOSTREAM_MOVE 1
+# endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
+# endif // (__GNUC__ > 4)
+# endif // defined(__GNUC__)
+# if defined(BOOST_ASIO_MSVC)
+# if (_MSC_VER >= 1700)
+# define BOOST_ASIO_HAS_STD_IOSTREAM_MOVE 1
+# endif // (_MSC_VER >= 1700)
+# endif // defined(BOOST_ASIO_MSVC)
+# endif // !defined(BOOST_ASIO_DISABLE_STD_IOSTREAM_MOVE)
+#endif // !defined(BOOST_ASIO_HAS_STD_IOSTREAM_MOVE)
+
// Windows App target. Windows but with a limited API.
#if !defined(BOOST_ASIO_WINDOWS_APP)
# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
@@ -884,11 +1148,18 @@
# if !defined(BOOST_ASIO_DISABLE_THREADS)
# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
# define BOOST_ASIO_HAS_THREADS 1
-# elif defined(_MSC_VER) && defined(_MT)
+# elif defined(__GNUC__) && !defined(__MINGW32__) \
+ && !defined(linux) && !defined(__linux) && !defined(__linux__)
# define BOOST_ASIO_HAS_THREADS 1
-# elif defined(__BORLANDC__) && defined(__MT__)
+# elif defined(_MT) || defined(__MT__)
# define BOOST_ASIO_HAS_THREADS 1
-# elif defined(_POSIX_THREADS)
+# elif defined(_REENTRANT)
+# define BOOST_ASIO_HAS_THREADS 1
+# elif defined(__APPLE__)
+# define BOOST_ASIO_HAS_THREADS 1
+# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
+# define BOOST_ASIO_HAS_THREADS 1
+# elif defined(_PTHREADS)
# define BOOST_ASIO_HAS_THREADS 1
# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
# endif // !defined(BOOST_ASIO_DISABLE_THREADS)
@@ -899,7 +1170,7 @@
# if defined(BOOST_ASIO_HAS_THREADS)
# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
# define BOOST_ASIO_HAS_PTHREADS 1
-# elif defined(_POSIX_THREADS)
+# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
# define BOOST_ASIO_HAS_PTHREADS 1
# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
# endif // defined(BOOST_ASIO_HAS_THREADS)
@@ -1030,6 +1301,42 @@
// || (defined(__MACH__) && defined(__APPLE__))
#endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T)
+// Helper macros to manage the transition away from the old services-based API.
+#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
+# define BOOST_ASIO_SVC_TPARAM , typename Service
+# define BOOST_ASIO_SVC_TPARAM_DEF1(d1) , typename Service d1
+# define BOOST_ASIO_SVC_TPARAM_DEF2(d1, d2) , typename Service d1, d2
+# define BOOST_ASIO_SVC_TARG , Service
+# define BOOST_ASIO_SVC_T Service
+# define BOOST_ASIO_SVC_TPARAM1 , typename Service1
+# define BOOST_ASIO_SVC_TPARAM1_DEF1(d1) , typename Service1 d1
+# define BOOST_ASIO_SVC_TPARAM1_DEF2(d1, d2) , typename Service1 d1, d2
+# define BOOST_ASIO_SVC_TARG1 , Service1
+# define BOOST_ASIO_SVC_T1 Service1
+# define BOOST_ASIO_SVC_ACCESS public
+#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
+# define BOOST_ASIO_SVC_TPARAM
+# define BOOST_ASIO_SVC_TPARAM_DEF1(d1)
+# define BOOST_ASIO_SVC_TPARAM_DEF2(d1, d2)
+# define BOOST_ASIO_SVC_TARG
+// BOOST_ASIO_SVC_T is defined at each point of use.
+# define BOOST_ASIO_SVC_TPARAM1
+# define BOOST_ASIO_SVC_TPARAM1_DEF1(d1)
+# define BOOST_ASIO_SVC_TPARAM1_DEF2(d1, d2)
+# define BOOST_ASIO_SVC_TARG1
+// BOOST_ASIO_SVC_T1 is defined at each point of use.
+# define BOOST_ASIO_SVC_ACCESS protected
+#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
+
+// Helper macros to manage transition away from error_code return values.
+#if defined(BOOST_ASIO_NO_DEPRECATED)
+# define BOOST_ASIO_SYNC_OP_VOID void
+# define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return
+#else // defined(BOOST_ASIO_NO_DEPRECATED)
+# define BOOST_ASIO_SYNC_OP_VOID boost::system::error_code
+# define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return e
+#endif // defined(BOOST_ASIO_NO_DEPRECATED)
+
// Newer gcc, clang need special treatment to suppress unused typedef warnings.
#if defined(__clang__)
# if defined(__apple_build_version__)