config.hpp 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435
  1. //
  2. // detail/config.hpp
  3. // ~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2025 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_DETAIL_CONFIG_HPP
  11. #define BOOST_ASIO_DETAIL_CONFIG_HPP
  12. #if defined(BOOST_ASIO_STANDALONE)
  13. # define BOOST_ASIO_DISABLE_BOOST_ALIGN 1
  14. # define BOOST_ASIO_DISABLE_BOOST_ARRAY 1
  15. # define BOOST_ASIO_DISABLE_BOOST_ASSERT 1
  16. # define BOOST_ASIO_DISABLE_BOOST_BIND 1
  17. # define BOOST_ASIO_DISABLE_BOOST_CHRONO 1
  18. # define BOOST_ASIO_DISABLE_BOOST_DATE_TIME 1
  19. # define BOOST_ASIO_DISABLE_BOOST_LIMITS 1
  20. # define BOOST_ASIO_DISABLE_BOOST_REGEX 1
  21. # define BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT 1
  22. # define BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION 1
  23. # define BOOST_ASIO_DISABLE_BOOST_WORKAROUND 1
  24. #else // defined(BOOST_ASIO_STANDALONE)
  25. // Boost.Config library is available.
  26. # include <boost/config.hpp>
  27. # include <boost/version.hpp>
  28. # define BOOST_ASIO_HAS_BOOST_CONFIG 1
  29. #endif // defined(BOOST_ASIO_STANDALONE)
  30. // Default to a header-only implementation. The user must specifically request
  31. // separate compilation by defining either BOOST_ASIO_SEPARATE_COMPILATION or
  32. // BOOST_ASIO_DYN_LINK (as a DLL/shared library implies separate compilation).
  33. #if !defined(BOOST_ASIO_HEADER_ONLY)
  34. # if !defined(BOOST_ASIO_SEPARATE_COMPILATION)
  35. # if !defined(BOOST_ASIO_DYN_LINK)
  36. # define BOOST_ASIO_HEADER_ONLY 1
  37. # endif // !defined(BOOST_ASIO_DYN_LINK)
  38. # endif // !defined(BOOST_ASIO_SEPARATE_COMPILATION)
  39. #endif // !defined(BOOST_ASIO_HEADER_ONLY)
  40. #if defined(BOOST_ASIO_HEADER_ONLY)
  41. # define BOOST_ASIO_DECL inline
  42. #else // defined(BOOST_ASIO_HEADER_ONLY)
  43. # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
  44. // We need to import/export our code only if the user has specifically asked
  45. // for it by defining BOOST_ASIO_DYN_LINK.
  46. # if defined(BOOST_ASIO_DYN_LINK)
  47. // Export if this is our own source, otherwise import.
  48. # if defined(BOOST_ASIO_SOURCE)
  49. # define BOOST_ASIO_DECL __declspec(dllexport)
  50. # else // defined(BOOST_ASIO_SOURCE)
  51. # define BOOST_ASIO_DECL __declspec(dllimport)
  52. # endif // defined(BOOST_ASIO_SOURCE)
  53. # endif // defined(BOOST_ASIO_DYN_LINK)
  54. # endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
  55. #endif // defined(BOOST_ASIO_HEADER_ONLY)
  56. // If BOOST_ASIO_DECL isn't defined yet define it now.
  57. #if !defined(BOOST_ASIO_DECL)
  58. # define BOOST_ASIO_DECL
  59. #endif // !defined(BOOST_ASIO_DECL)
  60. // Helper macro for documentation.
  61. #define BOOST_ASIO_UNSPECIFIED(e) e
  62. // Microsoft Visual C++ detection.
  63. #if !defined(BOOST_ASIO_MSVC)
  64. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
  65. # define BOOST_ASIO_MSVC BOOST_MSVC
  66. # elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \
  67. || (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
  68. # define BOOST_ASIO_MSVC _MSC_VER
  69. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
  70. #endif // !defined(BOOST_ASIO_MSVC)
  71. // Clang / libc++ detection.
  72. #if defined(__clang__)
  73. # if (__cplusplus >= 201103)
  74. # if __has_include(<__config>)
  75. # include <__config>
  76. # if defined(_LIBCPP_VERSION)
  77. # define BOOST_ASIO_HAS_CLANG_LIBCXX 1
  78. # endif // defined(_LIBCPP_VERSION)
  79. # endif // __has_include(<__config>)
  80. # endif // (__cplusplus >= 201103)
  81. #endif // defined(__clang__)
  82. // Android platform detection.
  83. #if defined(__ANDROID__)
  84. # include <android/api-level.h>
  85. #endif // defined(__ANDROID__)
  86. // Always enabled. Retained for backwards compatibility in user code.
  87. #if !defined(BOOST_ASIO_DISABLE_CXX11_MACROS)
  88. # define BOOST_ASIO_HAS_MOVE 1
  89. # define BOOST_ASIO_MOVE_ARG(type) type&&
  90. # define BOOST_ASIO_MOVE_ARG2(type1, type2) type1, type2&&
  91. # define BOOST_ASIO_NONDEDUCED_MOVE_ARG(type) type&
  92. # define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
  93. # define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
  94. # define BOOST_ASIO_MOVE_OR_LVALUE(type) static_cast<type&&>
  95. # define BOOST_ASIO_MOVE_OR_LVALUE_ARG(type) type&&
  96. # define BOOST_ASIO_MOVE_OR_LVALUE_TYPE(type) type
  97. # define BOOST_ASIO_DELETED = delete
  98. # define BOOST_ASIO_HAS_VARIADIC_TEMPLATES 1
  99. # define BOOST_ASIO_HAS_CONSTEXPR 1
  100. # define BOOST_ASIO_STATIC_CONSTEXPR(type, assignment) \
  101. static constexpr type assignment
  102. # define BOOST_ASIO_HAS_NOEXCEPT 1
  103. # define BOOST_ASIO_NOEXCEPT noexcept(true)
  104. # define BOOST_ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
  105. # define BOOST_ASIO_NOEXCEPT_IF(c) noexcept(c)
  106. # define BOOST_ASIO_HAS_DECLTYPE 1
  107. # define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX(t) auto
  108. # define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(t0, t1) auto
  109. # define BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX3(t0, t1, t2) auto
  110. # define BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX(expr) -> decltype expr
  111. # define BOOST_ASIO_HAS_ALIAS_TEMPLATES 1
  112. # define BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS 1
  113. # define BOOST_ASIO_HAS_ENUM_CLASS 1
  114. # define BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS 1
  115. # define BOOST_ASIO_LVALUE_REF_QUAL &
  116. # define BOOST_ASIO_RVALUE_REF_QUAL &&
  117. # define BOOST_ASIO_HAS_USER_DEFINED_LITERALS 1
  118. # define BOOST_ASIO_HAS_ALIGNOF 1
  119. # define BOOST_ASIO_ALIGNOF(T) alignof(T)
  120. # define BOOST_ASIO_HAS_STD_ALIGN 1
  121. # define BOOST_ASIO_HAS_STD_SYSTEM_ERROR 1
  122. # define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
  123. # define BOOST_ASIO_HAS_STD_ARRAY 1
  124. # define BOOST_ASIO_HAS_STD_SHARED_PTR 1
  125. # define BOOST_ASIO_HAS_STD_ALLOCATOR_ARG 1
  126. # define BOOST_ASIO_HAS_STD_ATOMIC 1
  127. # define BOOST_ASIO_HAS_STD_CHRONO 1
  128. # define BOOST_ASIO_HAS_STD_ADDRESSOF 1
  129. # define BOOST_ASIO_HAS_STD_FUNCTION 1
  130. # define BOOST_ASIO_HAS_STD_REFERENCE_WRAPPER 1
  131. # define BOOST_ASIO_HAS_STD_TYPE_TRAITS 1
  132. # define BOOST_ASIO_HAS_NULLPTR 1
  133. # define BOOST_ASIO_HAS_CXX11_ALLOCATORS 1
  134. # define BOOST_ASIO_HAS_CSTDINT 1
  135. # define BOOST_ASIO_HAS_STD_THREAD 1
  136. # define BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  137. # define BOOST_ASIO_HAS_STD_CALL_ONCE 1
  138. # define BOOST_ASIO_HAS_STD_FUTURE 1
  139. # define BOOST_ASIO_HAS_STD_TUPLE 1
  140. # define BOOST_ASIO_HAS_STD_IOSTREAM_MOVE 1
  141. # define BOOST_ASIO_HAS_STD_EXCEPTION_PTR 1
  142. # define BOOST_ASIO_HAS_STD_NESTED_EXCEPTION 1
  143. # define BOOST_ASIO_HAS_STD_HASH 1
  144. #endif // !defined(BOOST_ASIO_DISABLE_CXX11_MACROS)
  145. // Support for static constexpr with default initialisation.
  146. #if !defined(BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
  147. # if defined(__GNUC__)
  148. # if (__GNUC__ >= 8)
  149. # define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  150. static constexpr const type name{}
  151. # else // (__GNUC__ >= 8)
  152. # define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  153. static const type name
  154. # endif // (__GNUC__ >= 8)
  155. # elif defined(BOOST_ASIO_MSVC)
  156. # define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  157. static const type name
  158. # else // defined(BOOST_ASIO_MSVC)
  159. # define BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  160. static constexpr const type name{}
  161. # endif // defined(BOOST_ASIO_MSVC)
  162. #endif // !defined(BOOST_ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
  163. // Support noexcept on function types on compilers known to allow it.
  164. #if !defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
  165. # if !defined(BOOST_ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
  166. # if defined(__clang__)
  167. # if (__cplusplus >= 202002)
  168. # define BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
  169. # endif // (__cplusplus >= 202002)
  170. # elif defined(__GNUC__)
  171. # if (__cplusplus >= 202002)
  172. # define BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
  173. # endif // (__cplusplus >= 202002)
  174. # elif defined(BOOST_ASIO_MSVC)
  175. # if (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
  176. # define BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
  177. # endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
  178. # endif // defined(BOOST_ASIO_MSVC)
  179. # endif // !defined(BOOST_ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
  180. #endif // !defined(BOOST_ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
  181. // Support return type deduction on compilers known to allow it.
  182. #if !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION)
  183. # if !defined(BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
  184. # if defined(__clang__)
  185. # if __has_feature(__cxx_return_type_deduction__)
  186. # define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
  187. # endif // __has_feature(__cxx_return_type_deduction__)
  188. # elif (__cplusplus >= 201402)
  189. # define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
  190. # elif defined(__cpp_return_type_deduction)
  191. # if (__cpp_return_type_deduction >= 201304)
  192. # define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
  193. # endif // (__cpp_return_type_deduction >= 201304)
  194. # elif defined(BOOST_ASIO_MSVC)
  195. # if (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
  196. # define BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION 1
  197. # endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201402)
  198. # endif // defined(BOOST_ASIO_MSVC)
  199. # endif // !defined(BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
  200. #endif // !defined(BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION)
  201. // Support concepts on compilers known to allow them.
  202. #if !defined(BOOST_ASIO_HAS_CONCEPTS)
  203. # if !defined(BOOST_ASIO_DISABLE_CONCEPTS)
  204. # if defined(__cpp_concepts)
  205. # define BOOST_ASIO_HAS_CONCEPTS 1
  206. # if (__cpp_concepts >= 201707)
  207. # define BOOST_ASIO_CONCEPT concept
  208. # else // (__cpp_concepts >= 201707)
  209. # define BOOST_ASIO_CONCEPT concept bool
  210. # endif // (__cpp_concepts >= 201707)
  211. # endif // defined(__cpp_concepts)
  212. # endif // !defined(BOOST_ASIO_DISABLE_CONCEPTS)
  213. #endif // !defined(BOOST_ASIO_HAS_CONCEPTS)
  214. // Support concepts on compilers known to allow them.
  215. #if !defined(BOOST_ASIO_HAS_STD_CONCEPTS)
  216. # if !defined(BOOST_ASIO_DISABLE_STD_CONCEPTS)
  217. # if defined(BOOST_ASIO_HAS_CONCEPTS)
  218. # if (__cpp_lib_concepts >= 202002L)
  219. # define BOOST_ASIO_HAS_STD_CONCEPTS 1
  220. # endif // (__cpp_concepts >= 202002L)
  221. # endif // defined(BOOST_ASIO_HAS_CONCEPTS)
  222. # endif // !defined(BOOST_ASIO_DISABLE_STD_CONCEPTS)
  223. #endif // !defined(BOOST_ASIO_HAS_STD_CONCEPTS)
  224. // Support template variables on compilers known to allow it.
  225. #if !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  226. # if !defined(BOOST_ASIO_DISABLE_VARIABLE_TEMPLATES)
  227. # if defined(__clang__)
  228. # if (__cplusplus >= 201402)
  229. # if __has_feature(__cxx_variable_templates__)
  230. # define BOOST_ASIO_HAS_VARIABLE_TEMPLATES 1
  231. # endif // __has_feature(__cxx_variable_templates__)
  232. # endif // (__cplusplus >= 201402)
  233. # elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
  234. # if (__GNUC__ >= 6)
  235. # if (__cplusplus >= 201402)
  236. # define BOOST_ASIO_HAS_VARIABLE_TEMPLATES 1
  237. # endif // (__cplusplus >= 201402)
  238. # endif // (__GNUC__ >= 6)
  239. # endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
  240. # if defined(BOOST_ASIO_MSVC)
  241. # if (_MSC_VER >= 1901)
  242. # define BOOST_ASIO_HAS_VARIABLE_TEMPLATES 1
  243. # endif // (_MSC_VER >= 1901)
  244. # endif // defined(BOOST_ASIO_MSVC)
  245. # endif // !defined(BOOST_ASIO_DISABLE_VARIABLE_TEMPLATES)
  246. #endif // !defined(BOOST_ASIO_HAS_VARIABLE_TEMPLATES)
  247. // Support SFINAEd template variables on compilers known to allow it.
  248. #if !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  249. # if !defined(BOOST_ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
  250. # if defined(__clang__)
  251. # if (__cplusplus >= 201703)
  252. # if __has_feature(__cxx_variable_templates__)
  253. # define BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
  254. # endif // __has_feature(__cxx_variable_templates__)
  255. # endif // (__cplusplus >= 201703)
  256. # elif defined(__GNUC__)
  257. # if ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
  258. # if (__cplusplus >= 201402)
  259. # define BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
  260. # endif // (__cplusplus >= 201402)
  261. # endif // ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
  262. # endif // defined(__GNUC__)
  263. # if defined(BOOST_ASIO_MSVC)
  264. # if (_MSC_VER >= 1901)
  265. # define BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
  266. # endif // (_MSC_VER >= 1901)
  267. # endif // defined(BOOST_ASIO_MSVC)
  268. # endif // !defined(BOOST_ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
  269. #endif // !defined(BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  270. // Support SFINAE use of constant expressions on compilers known to allow it.
  271. #if !defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
  272. # if !defined(BOOST_ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
  273. # if defined(__clang__)
  274. # if (__cplusplus >= 201402)
  275. # define BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
  276. # endif // (__cplusplus >= 201402)
  277. # elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
  278. # if (__GNUC__ >= 7)
  279. # if (__cplusplus >= 201402)
  280. # define BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
  281. # endif // (__cplusplus >= 201402)
  282. # endif // (__GNUC__ >= 7)
  283. # endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
  284. # if defined(BOOST_ASIO_MSVC)
  285. # if (_MSC_VER >= 1901)
  286. # define BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
  287. # endif // (_MSC_VER >= 1901)
  288. # endif // defined(BOOST_ASIO_MSVC)
  289. # endif // !defined(BOOST_ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
  290. #endif // !defined(BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
  291. // Enable workarounds for lack of working expression SFINAE.
  292. #if !defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
  293. # if !defined(BOOST_ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
  294. # if !defined(BOOST_ASIO_MSVC) && !defined(__INTEL_COMPILER)
  295. # if (__cplusplus >= 201103)
  296. # define BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
  297. # endif // (__cplusplus >= 201103)
  298. # elif defined(BOOST_ASIO_MSVC) && (_MSC_VER >= 1929)
  299. # if (_MSVC_LANG >= 202000)
  300. # define BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
  301. # endif // (_MSVC_LANG >= 202000)
  302. # endif // defined(BOOST_ASIO_MSVC) && (_MSC_VER >= 1929)
  303. # endif // !defined(BOOST_ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
  304. #endif // !defined(BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE)
  305. // Support for capturing parameter packs in lambdas.
  306. #if !defined(BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES)
  307. # if !defined(BOOST_ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES)
  308. # if defined(__GNUC__)
  309. # if (__GNUC__ >= 6)
  310. # define BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
  311. # endif // (__GNUC__ >= 6)
  312. # elif defined(BOOST_ASIO_MSVC)
  313. # if (_MSVC_LANG >= 201103)
  314. # define BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
  315. # endif // (_MSC_LANG >= 201103)
  316. # else // defined(BOOST_ASIO_MSVC)
  317. # if (__cplusplus >= 201103)
  318. # define BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES 1
  319. # endif // (__cplusplus >= 201103)
  320. # endif // defined(BOOST_ASIO_MSVC)
  321. # endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_LAMBDA_CAPTURES)
  322. #endif // !defined(BOOST_ASIO_HAS_VARIADIC_LAMBDA_CAPTURES)
  323. // Support for inline variables.
  324. #if !defined(BOOST_ASIO_HAS_INLINE_VARIABLES)
  325. # if !defined(BOOST_ASIO_DISABLE_INLINE_VARIABLES)
  326. # if (__cplusplus >= 201703) && (__cpp_inline_variables >= 201606)
  327. # define BOOST_ASIO_HAS_INLINE_VARIABLES 1
  328. # define BOOST_ASIO_INLINE_VARIABLE inline
  329. # endif // (__cplusplus >= 201703) && (__cpp_inline_variables >= 201606)
  330. # endif // !defined(BOOST_ASIO_DISABLE_INLINE_VARIABLES)
  331. #endif // !defined(BOOST_ASIO_HAS_INLINE_VARIABLES)
  332. #if !defined(BOOST_ASIO_INLINE_VARIABLE)
  333. # define BOOST_ASIO_INLINE_VARIABLE
  334. #endif // !defined(BOOST_ASIO_INLINE_VARIABLE)
  335. // Default alignment.
  336. #if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
  337. # define BOOST_ASIO_DEFAULT_ALIGN __STDCPP_DEFAULT_NEW_ALIGNMENT__
  338. #elif defined(__GNUC__)
  339. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  340. # define BOOST_ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
  341. # else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  342. # define BOOST_ASIO_DEFAULT_ALIGN alignof(max_align_t)
  343. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  344. #else // defined(__GNUC__)
  345. # define BOOST_ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
  346. #endif // defined(__GNUC__)
  347. // Standard library support for aligned allocation.
  348. #if !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC)
  349. # if !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC)
  350. # if (__cplusplus >= 201703)
  351. # if defined(__clang__)
  352. # if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  353. # if (_LIBCPP_STD_VER > 14)
  354. # if defined(__FreeBSD__) || defined(__Fuchsia__) || defined(__wasi__) \
  355. || defined(__NetBSD__) || defined(__OpenBSD__)
  356. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  357. # elif defined(__linux__)
  358. # if defined(_LIBCPP_HAS_MUSL_LIBC)
  359. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  360. # else // !defined(_LIBCPP_HAS_MUSL_LIBC)
  361. # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17)
  362. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  363. # endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17)
  364. # endif // !defined(_LIBCPP_HAS_MUSL_LIBC)
  365. # elif defined(__ANDROID__) && (__ANDROID_API__ >= 28)
  366. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  367. # elif defined(__APPLE__)
  368. # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  369. # if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
  370. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  371. # endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
  372. # elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
  373. # if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
  374. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  375. # endif // (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
  376. # elif defined(__TV_OS_VERSION_MIN_REQUIRED)
  377. # if (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
  378. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  379. # endif // (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
  380. # elif defined(__WATCH_OS_VERSION_MIN_REQUIRED)
  381. # if (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000)
  382. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  383. # endif // (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000)
  384. # endif // defined(__WATCH_OS_X_VERSION_MIN_REQUIRED)
  385. # endif // defined(__APPLE__)
  386. # endif // (_LIBCPP_STD_VER > 14)
  387. # elif defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  388. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  389. # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  390. # elif defined(__GNUC__)
  391. # if ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
  392. # if defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  393. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  394. # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  395. # endif // ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
  396. # endif // defined(__GNUC__)
  397. # endif // (__cplusplus >= 201703)
  398. # endif // !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC)
  399. #endif // !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC)
  400. // Boost support for chrono.
  401. #if !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  402. # if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
  403. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
  404. # define BOOST_ASIO_HAS_BOOST_CHRONO 1
  405. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
  406. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
  407. #endif // !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  408. // Some form of chrono library is available.
  409. #if !defined(BOOST_ASIO_HAS_CHRONO)
  410. # if defined(BOOST_ASIO_HAS_STD_CHRONO) \
  411. || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  412. # define BOOST_ASIO_HAS_CHRONO 1
  413. # endif // defined(BOOST_ASIO_HAS_STD_CHRONO)
  414. // || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  415. #endif // !defined(BOOST_ASIO_HAS_CHRONO)
  416. // Boost support for the DateTime library.
  417. #if !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
  418. # if !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
  419. # define BOOST_ASIO_HAS_BOOST_DATE_TIME 1
  420. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
  421. #endif // !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
  422. // Boost support for the Context library's fibers.
  423. #if !defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER)
  424. # if !defined(BOOST_ASIO_DISABLE_BOOST_CONTEXT_FIBER)
  425. # if defined(__clang__)
  426. # if (__cplusplus >= 201103)
  427. # define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
  428. # endif // (__cplusplus >= 201103)
  429. # elif defined(__GNUC__)
  430. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  431. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  432. # define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
  433. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  434. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  435. # endif // defined(__GNUC__)
  436. # if defined(BOOST_ASIO_MSVC)
  437. # if (_MSVC_LANG >= 201103)
  438. # define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
  439. # endif // (_MSC_LANG >= 201103)
  440. # endif // defined(BOOST_ASIO_MSVC)
  441. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_CONTEXT_FIBER)
  442. #endif // !defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER)
  443. // Standard library support for std::string_view.
  444. #if !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
  445. # if !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
  446. # if defined(__clang__)
  447. # if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  448. # if (__cplusplus >= 201402)
  449. # if __has_include(<string_view>)
  450. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  451. # endif // __has_include(<string_view>)
  452. # endif // (__cplusplus >= 201402)
  453. # else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  454. # if (__cplusplus >= 201703)
  455. # if __has_include(<string_view>)
  456. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  457. # endif // __has_include(<string_view>)
  458. # endif // (__cplusplus >= 201703)
  459. # endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  460. # elif defined(__GNUC__)
  461. # if (__GNUC__ >= 7)
  462. # if (__cplusplus >= 201703)
  463. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  464. # endif // (__cplusplus >= 201703)
  465. # endif // (__GNUC__ >= 7)
  466. # elif defined(BOOST_ASIO_MSVC)
  467. # if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
  468. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  469. # endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
  470. # endif // defined(BOOST_ASIO_MSVC)
  471. # endif // !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
  472. #endif // !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
  473. // Standard library support for std::experimental::string_view.
  474. #if !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  475. # if !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
  476. # if defined(__clang__)
  477. # if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  478. # if (_LIBCPP_VERSION < 7000)
  479. # if (__cplusplus >= 201402)
  480. # if __has_include(<experimental/string_view>)
  481. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  482. # endif // __has_include(<experimental/string_view>)
  483. # endif // (__cplusplus >= 201402)
  484. # endif // (_LIBCPP_VERSION < 7000)
  485. # else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  486. # if (__cplusplus >= 201402)
  487. # if __has_include(<experimental/string_view>)
  488. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  489. # endif // __has_include(<experimental/string_view>)
  490. # endif // (__cplusplus >= 201402)
  491. # endif // // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  492. # elif defined(__GNUC__)
  493. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  494. # if (__cplusplus >= 201402)
  495. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  496. # endif // (__cplusplus >= 201402)
  497. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  498. # endif // defined(__GNUC__)
  499. # endif // !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
  500. #endif // !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  501. // Standard library has a string_view that we can use.
  502. #if !defined(BOOST_ASIO_HAS_STRING_VIEW)
  503. # if !defined(BOOST_ASIO_DISABLE_STRING_VIEW)
  504. # if defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
  505. # define BOOST_ASIO_HAS_STRING_VIEW 1
  506. # elif defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  507. # define BOOST_ASIO_HAS_STRING_VIEW 1
  508. # endif // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  509. # endif // !defined(BOOST_ASIO_DISABLE_STRING_VIEW)
  510. #endif // !defined(BOOST_ASIO_HAS_STRING_VIEW)
  511. // Standard library has invoke_result (which supersedes result_of).
  512. #if !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  513. # if !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT)
  514. # if defined(BOOST_ASIO_MSVC)
  515. # if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
  516. # define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
  517. # endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
  518. # else // defined(BOOST_ASIO_MSVC)
  519. # if (__cplusplus >= 201703) && (__cpp_lib_is_invocable >= 201703)
  520. # define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
  521. # endif // (__cplusplus >= 201703) && (__cpp_lib_is_invocable >= 201703)
  522. # endif // defined(BOOST_ASIO_MSVC)
  523. # endif // !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT)
  524. #endif // !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  525. // Standard library support for std::any.
  526. #if !defined(BOOST_ASIO_HAS_STD_ANY)
  527. # if !defined(BOOST_ASIO_DISABLE_STD_ANY)
  528. # if defined(__clang__)
  529. # if (__cplusplus >= 201703)
  530. # if __has_include(<any>)
  531. # define BOOST_ASIO_HAS_STD_ANY 1
  532. # endif // __has_include(<any>)
  533. # endif // (__cplusplus >= 201703)
  534. # elif defined(__GNUC__)
  535. # if (__GNUC__ >= 7)
  536. # if (__cplusplus >= 201703)
  537. # define BOOST_ASIO_HAS_STD_ANY 1
  538. # endif // (__cplusplus >= 201703)
  539. # endif // (__GNUC__ >= 7)
  540. # endif // defined(__GNUC__)
  541. # if defined(BOOST_ASIO_MSVC)
  542. # if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  543. # define BOOST_ASIO_HAS_STD_ANY 1
  544. # endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  545. # endif // defined(BOOST_ASIO_MSVC)
  546. # endif // !defined(BOOST_ASIO_DISABLE_STD_ANY)
  547. #endif // !defined(BOOST_ASIO_HAS_STD_ANY)
  548. // Standard library support for std::variant.
  549. #if !defined(BOOST_ASIO_HAS_STD_VARIANT)
  550. # if !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
  551. # if defined(__clang__)
  552. # if (__cplusplus >= 201703)
  553. # if __has_include(<variant>)
  554. # define BOOST_ASIO_HAS_STD_VARIANT 1
  555. # endif // __has_include(<variant>)
  556. # endif // (__cplusplus >= 201703)
  557. # elif defined(__GNUC__)
  558. # if (__GNUC__ >= 7)
  559. # if (__cplusplus >= 201703)
  560. # define BOOST_ASIO_HAS_STD_VARIANT 1
  561. # endif // (__cplusplus >= 201703)
  562. # endif // (__GNUC__ >= 7)
  563. # endif // defined(__GNUC__)
  564. # if defined(BOOST_ASIO_MSVC)
  565. # if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  566. # define BOOST_ASIO_HAS_STD_VARIANT 1
  567. # endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  568. # endif // defined(BOOST_ASIO_MSVC)
  569. # endif // !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
  570. #endif // !defined(BOOST_ASIO_HAS_STD_VARIANT)
  571. // Standard library support for std::source_location.
  572. #if !defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
  573. # if !defined(BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION)
  574. # if (__cpp_lib_source_location >= 201907)
  575. # define BOOST_ASIO_HAS_STD_SOURCE_LOCATION 1
  576. # endif // (__cpp_lib_source_location >= 201907)
  577. # endif // !defined(BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION)
  578. #endif // !defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
  579. // Standard library support for std::experimental::source_location.
  580. #if !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  581. # if !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
  582. # if defined(__GNUC__)
  583. # if (__cplusplus >= 201709)
  584. # if __has_include(<experimental/source_location>)
  585. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION 1
  586. # endif // __has_include(<experimental/source_location>)
  587. # endif // (__cplusplus >= 201709)
  588. # endif // defined(__GNUC__)
  589. # endif // !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
  590. #endif // !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  591. // Standard library has a source_location that we can use.
  592. #if !defined(BOOST_ASIO_HAS_SOURCE_LOCATION)
  593. # if !defined(BOOST_ASIO_DISABLE_SOURCE_LOCATION)
  594. # if defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
  595. # define BOOST_ASIO_HAS_SOURCE_LOCATION 1
  596. # elif defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  597. # define BOOST_ASIO_HAS_SOURCE_LOCATION 1
  598. # endif // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  599. # endif // !defined(BOOST_ASIO_DISABLE_SOURCE_LOCATION)
  600. #endif // !defined(BOOST_ASIO_HAS_SOURCE_LOCATION)
  601. // Boost support for source_location and system errors.
  602. #if !defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  603. # if !defined(BOOST_ASIO_DISABLE_BOOST_SOURCE_LOCATION)
  604. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
  605. # define BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION 1
  606. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
  607. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_SOURCE_LOCATION)
  608. #endif // !defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  609. // Helper macros for working with Boost source locations.
  610. #if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  611. # define BOOST_ASIO_SOURCE_LOCATION_PARAM \
  612. , const boost::source_location& loc
  613. # define BOOST_ASIO_SOURCE_LOCATION_DEFAULTED_PARAM \
  614. , const boost::source_location& loc = BOOST_CURRENT_LOCATION
  615. # define BOOST_ASIO_SOURCE_LOCATION_ARG , loc
  616. #else // if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  617. # define BOOST_ASIO_SOURCE_LOCATION_PARAM
  618. # define BOOST_ASIO_SOURCE_LOCATION_DEFAULTED_PARAM
  619. # define BOOST_ASIO_SOURCE_LOCATION_ARG
  620. #endif // if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  621. // Standard library support for std::index_sequence.
  622. #if !defined(BOOST_ASIO_HAS_STD_INDEX_SEQUENCE)
  623. # if !defined(BOOST_ASIO_DISABLE_STD_INDEX_SEQUENCE)
  624. # if defined(__clang__)
  625. # if (__cplusplus >= 201402)
  626. # define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
  627. # endif // (__cplusplus >= 201402)
  628. # elif defined(__GNUC__)
  629. # if (__GNUC__ >= 7)
  630. # if (__cplusplus >= 201402)
  631. # define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
  632. # endif // (__cplusplus >= 201402)
  633. # endif // (__GNUC__ >= 7)
  634. # endif // defined(__GNUC__)
  635. # if defined(BOOST_ASIO_MSVC)
  636. # if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
  637. # define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
  638. # endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
  639. # endif // defined(BOOST_ASIO_MSVC)
  640. # endif // !defined(BOOST_ASIO_DISABLE_STD_INDEX_SEQUENCE)
  641. #endif // !defined(BOOST_ASIO_HAS_STD_INDEX_SEQUENCE)
  642. // Windows App target. Windows but with a limited API.
  643. #if !defined(BOOST_ASIO_WINDOWS_APP)
  644. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  645. # include <winapifamily.h>
  646. # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  647. || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)) \
  648. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  649. # define BOOST_ASIO_WINDOWS_APP 1
  650. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  651. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  652. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  653. #endif // !defined(BOOST_ASIO_WINDOWS_APP)
  654. // Legacy WinRT target. Windows App is preferred.
  655. #if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  656. # if !defined(BOOST_ASIO_WINDOWS_APP)
  657. # if defined(__cplusplus_winrt)
  658. # include <winapifamily.h>
  659. # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  660. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  661. # define BOOST_ASIO_WINDOWS_RUNTIME 1
  662. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  663. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  664. # endif // defined(__cplusplus_winrt)
  665. # endif // !defined(BOOST_ASIO_WINDOWS_APP)
  666. #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  667. // Windows target. Excludes WinRT but includes Windows App targets.
  668. #if !defined(BOOST_ASIO_WINDOWS)
  669. # if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  670. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  671. # define BOOST_ASIO_WINDOWS 1
  672. # elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  673. # define BOOST_ASIO_WINDOWS 1
  674. # elif defined(BOOST_ASIO_WINDOWS_APP)
  675. # define BOOST_ASIO_WINDOWS 1
  676. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  677. # endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  678. #endif // !defined(BOOST_ASIO_WINDOWS)
  679. // Windows: target OS version.
  680. #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  681. # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  682. # if defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  683. # pragma message( \
  684. "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
  685. "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
  686. "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
  687. "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
  688. # else // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  689. # warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
  690. # warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
  691. # warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
  692. # endif // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  693. # define _WIN32_WINNT 0x0601
  694. # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  695. # if defined(_MSC_VER)
  696. # if defined(_WIN32) && !defined(WIN32)
  697. # if !defined(_WINSOCK2API_)
  698. # define WIN32 // Needed for correct types in winsock2.h
  699. # else // !defined(_WINSOCK2API_)
  700. # error Please define the macro WIN32 in your compiler options
  701. # endif // !defined(_WINSOCK2API_)
  702. # endif // defined(_WIN32) && !defined(WIN32)
  703. # endif // defined(_MSC_VER)
  704. # if defined(__BORLANDC__)
  705. # if defined(__WIN32__) && !defined(WIN32)
  706. # if !defined(_WINSOCK2API_)
  707. # define WIN32 // Needed for correct types in winsock2.h
  708. # else // !defined(_WINSOCK2API_)
  709. # error Please define the macro WIN32 in your compiler options
  710. # endif // !defined(_WINSOCK2API_)
  711. # endif // defined(__WIN32__) && !defined(WIN32)
  712. # endif // defined(__BORLANDC__)
  713. # if defined(__CYGWIN__)
  714. # if !defined(__USE_W32_SOCKETS)
  715. # error You must add -D__USE_W32_SOCKETS to your compiler options.
  716. # endif // !defined(__USE_W32_SOCKETS)
  717. # endif // defined(__CYGWIN__)
  718. #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  719. // Windows: minimise header inclusion.
  720. #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  721. # if !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  722. # if !defined(WIN32_LEAN_AND_MEAN)
  723. # define WIN32_LEAN_AND_MEAN
  724. # endif // !defined(WIN32_LEAN_AND_MEAN)
  725. # endif // !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  726. #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  727. // Windows: suppress definition of "min" and "max" macros.
  728. #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  729. # if !defined(BOOST_ASIO_NO_NOMINMAX)
  730. # if !defined(NOMINMAX)
  731. # define NOMINMAX 1
  732. # endif // !defined(NOMINMAX)
  733. # endif // !defined(BOOST_ASIO_NO_NOMINMAX)
  734. #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  735. // Windows: IO Completion Ports.
  736. #if !defined(BOOST_ASIO_HAS_IOCP)
  737. # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  738. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  739. # if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  740. # if !defined(BOOST_ASIO_DISABLE_IOCP)
  741. # define BOOST_ASIO_HAS_IOCP 1
  742. # endif // !defined(BOOST_ASIO_DISABLE_IOCP)
  743. # endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  744. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  745. # endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  746. #endif // !defined(BOOST_ASIO_HAS_IOCP)
  747. // On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
  748. // get access to the various platform feature macros, e.g. to be able to test
  749. // for threads support.
  750. #if !defined(BOOST_ASIO_HAS_UNISTD_H)
  751. # if !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  752. # if defined(unix) \
  753. || defined(__unix) \
  754. || defined(_XOPEN_SOURCE) \
  755. || defined(_POSIX_SOURCE) \
  756. || (defined(__MACH__) && defined(__APPLE__)) \
  757. || defined(__FreeBSD__) \
  758. || defined(__NetBSD__) \
  759. || defined(__OpenBSD__) \
  760. || defined(__linux__) \
  761. || defined(__HAIKU__)
  762. # define BOOST_ASIO_HAS_UNISTD_H 1
  763. # endif
  764. # endif // !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  765. #endif // !defined(BOOST_ASIO_HAS_UNISTD_H)
  766. #if defined(BOOST_ASIO_HAS_UNISTD_H)
  767. # include <unistd.h>
  768. #endif // defined(BOOST_ASIO_HAS_UNISTD_H)
  769. // Linux: epoll, eventfd, timerfd and io_uring.
  770. #if defined(__linux__)
  771. # include <linux/version.h>
  772. # if !defined(BOOST_ASIO_HAS_EPOLL)
  773. # if !defined(BOOST_ASIO_DISABLE_EPOLL)
  774. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  775. # define BOOST_ASIO_HAS_EPOLL 1
  776. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  777. # endif // !defined(BOOST_ASIO_DISABLE_EPOLL)
  778. # endif // !defined(BOOST_ASIO_HAS_EPOLL)
  779. # if !defined(BOOST_ASIO_HAS_EVENTFD)
  780. # if !defined(BOOST_ASIO_DISABLE_EVENTFD)
  781. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  782. # define BOOST_ASIO_HAS_EVENTFD 1
  783. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  784. # endif // !defined(BOOST_ASIO_DISABLE_EVENTFD)
  785. # endif // !defined(BOOST_ASIO_HAS_EVENTFD)
  786. # if !defined(BOOST_ASIO_HAS_TIMERFD)
  787. # if !defined(BOOST_ASIO_DISABLE_TIMERFD)
  788. # if defined(BOOST_ASIO_HAS_EPOLL)
  789. # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  790. # define BOOST_ASIO_HAS_TIMERFD 1
  791. # endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  792. # endif // defined(BOOST_ASIO_HAS_EPOLL)
  793. # endif // !defined(BOOST_ASIO_DISABLE_TIMERFD)
  794. # endif // !defined(BOOST_ASIO_HAS_TIMERFD)
  795. # if defined(BOOST_ASIO_HAS_IO_URING)
  796. # if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
  797. # error Linux kernel 5.10 or later is required to support io_uring
  798. # endif // LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
  799. # endif // defined(BOOST_ASIO_HAS_IO_URING)
  800. #endif // defined(__linux__)
  801. // Linux: io_uring is used instead of epoll.
  802. #if !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
  803. # if !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING)
  804. # define BOOST_ASIO_HAS_IO_URING_AS_DEFAULT 1
  805. # endif // !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING)
  806. #endif // !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
  807. // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
  808. #if (defined(__MACH__) && defined(__APPLE__)) \
  809. || defined(__FreeBSD__) \
  810. || defined(__NetBSD__) \
  811. || defined(__OpenBSD__)
  812. # if !defined(BOOST_ASIO_HAS_KQUEUE)
  813. # if !defined(BOOST_ASIO_DISABLE_KQUEUE)
  814. # define BOOST_ASIO_HAS_KQUEUE 1
  815. # endif // !defined(BOOST_ASIO_DISABLE_KQUEUE)
  816. # endif // !defined(BOOST_ASIO_HAS_KQUEUE)
  817. #endif // (defined(__MACH__) && defined(__APPLE__))
  818. // || defined(__FreeBSD__)
  819. // || defined(__NetBSD__)
  820. // || defined(__OpenBSD__)
  821. // Solaris: /dev/poll.
  822. #if defined(__sun)
  823. # if !defined(BOOST_ASIO_HAS_DEV_POLL)
  824. # if !defined(BOOST_ASIO_DISABLE_DEV_POLL)
  825. # define BOOST_ASIO_HAS_DEV_POLL 1
  826. # endif // !defined(BOOST_ASIO_DISABLE_DEV_POLL)
  827. # endif // !defined(BOOST_ASIO_HAS_DEV_POLL)
  828. #endif // defined(__sun)
  829. // Serial ports.
  830. #if !defined(BOOST_ASIO_HAS_SERIAL_PORT)
  831. # if defined(BOOST_ASIO_HAS_IOCP) \
  832. || !defined(BOOST_ASIO_WINDOWS) \
  833. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  834. && !defined(__CYGWIN__)
  835. # if !defined(__SYMBIAN32__)
  836. # if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
  837. # define BOOST_ASIO_HAS_SERIAL_PORT 1
  838. # endif // !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
  839. # endif // !defined(__SYMBIAN32__)
  840. # endif // defined(BOOST_ASIO_HAS_IOCP)
  841. // || !defined(BOOST_ASIO_WINDOWS)
  842. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  843. // && !defined(__CYGWIN__)
  844. #endif // !defined(BOOST_ASIO_HAS_SERIAL_PORT)
  845. // Windows: stream handles.
  846. #if !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
  847. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  848. # if defined(BOOST_ASIO_HAS_IOCP)
  849. # define BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE 1
  850. # endif // defined(BOOST_ASIO_HAS_IOCP)
  851. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  852. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
  853. // Windows: random access handles.
  854. #if !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  855. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  856. # if defined(BOOST_ASIO_HAS_IOCP)
  857. # define BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
  858. # endif // defined(BOOST_ASIO_HAS_IOCP)
  859. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  860. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  861. // Windows: object handles.
  862. #if !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  863. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  864. # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  865. # if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  866. # define BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
  867. # endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  868. # endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  869. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  870. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  871. // Windows: OVERLAPPED wrapper.
  872. #if !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  873. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  874. # if defined(BOOST_ASIO_HAS_IOCP)
  875. # define BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
  876. # endif // defined(BOOST_ASIO_HAS_IOCP)
  877. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  878. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  879. // POSIX: stream-oriented file descriptors.
  880. #if !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  881. # if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  882. # if !defined(BOOST_ASIO_WINDOWS) \
  883. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  884. && !defined(__CYGWIN__)
  885. # define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
  886. # endif // !defined(BOOST_ASIO_WINDOWS)
  887. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  888. // && !defined(__CYGWIN__)
  889. # endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  890. #endif // !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  891. // UNIX domain sockets.
  892. #if !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
  893. # if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
  894. # if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  895. # define BOOST_ASIO_HAS_LOCAL_SOCKETS 1
  896. # endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  897. # endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
  898. #endif // !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
  899. // Files.
  900. #if !defined(BOOST_ASIO_HAS_FILE)
  901. # if !defined(BOOST_ASIO_DISABLE_FILE)
  902. # if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  903. # define BOOST_ASIO_HAS_FILE 1
  904. # elif defined(BOOST_ASIO_HAS_IO_URING)
  905. # define BOOST_ASIO_HAS_FILE 1
  906. # endif // defined(BOOST_ASIO_HAS_IO_URING)
  907. # endif // !defined(BOOST_ASIO_DISABLE_FILE)
  908. #endif // !defined(BOOST_ASIO_HAS_FILE)
  909. // Pipes.
  910. #if !defined(BOOST_ASIO_HAS_PIPE)
  911. # if defined(BOOST_ASIO_HAS_IOCP) \
  912. || !defined(BOOST_ASIO_WINDOWS) \
  913. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  914. && !defined(__CYGWIN__)
  915. # if !defined(__SYMBIAN32__)
  916. # if !defined(BOOST_ASIO_DISABLE_PIPE)
  917. # define BOOST_ASIO_HAS_PIPE 1
  918. # endif // !defined(BOOST_ASIO_DISABLE_PIPE)
  919. # endif // !defined(__SYMBIAN32__)
  920. # endif // defined(BOOST_ASIO_HAS_IOCP)
  921. // || !defined(BOOST_ASIO_WINDOWS)
  922. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  923. // && !defined(__CYGWIN__)
  924. #endif // !defined(BOOST_ASIO_HAS_PIPE)
  925. // Can use sigaction() instead of signal().
  926. #if !defined(BOOST_ASIO_HAS_SIGACTION)
  927. # if !defined(BOOST_ASIO_DISABLE_SIGACTION)
  928. # if !defined(BOOST_ASIO_WINDOWS) \
  929. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  930. && !defined(__CYGWIN__)
  931. # define BOOST_ASIO_HAS_SIGACTION 1
  932. # endif // !defined(BOOST_ASIO_WINDOWS)
  933. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  934. // && !defined(__CYGWIN__)
  935. # endif // !defined(BOOST_ASIO_DISABLE_SIGACTION)
  936. #endif // !defined(BOOST_ASIO_HAS_SIGACTION)
  937. // Can use signal().
  938. #if !defined(BOOST_ASIO_HAS_SIGNAL)
  939. # if !defined(BOOST_ASIO_DISABLE_SIGNAL)
  940. # if !defined(UNDER_CE)
  941. # define BOOST_ASIO_HAS_SIGNAL 1
  942. # endif // !defined(UNDER_CE)
  943. # endif // !defined(BOOST_ASIO_DISABLE_SIGNAL)
  944. #endif // !defined(BOOST_ASIO_HAS_SIGNAL)
  945. // Can use getaddrinfo() and getnameinfo().
  946. #if !defined(BOOST_ASIO_HAS_GETADDRINFO)
  947. # if !defined(BOOST_ASIO_DISABLE_GETADDRINFO)
  948. # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  949. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
  950. # define BOOST_ASIO_HAS_GETADDRINFO 1
  951. # elif defined(UNDER_CE)
  952. # define BOOST_ASIO_HAS_GETADDRINFO 1
  953. # endif // defined(UNDER_CE)
  954. # elif defined(__MACH__) && defined(__APPLE__)
  955. # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  956. # if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
  957. # define BOOST_ASIO_HAS_GETADDRINFO 1
  958. # endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
  959. # else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  960. # define BOOST_ASIO_HAS_GETADDRINFO 1
  961. # endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  962. # else // defined(__MACH__) && defined(__APPLE__)
  963. # define BOOST_ASIO_HAS_GETADDRINFO 1
  964. # endif // defined(__MACH__) && defined(__APPLE__)
  965. # endif // !defined(BOOST_ASIO_DISABLE_GETADDRINFO)
  966. #endif // !defined(BOOST_ASIO_HAS_GETADDRINFO)
  967. // Whether standard iostreams are disabled.
  968. #if !defined(BOOST_ASIO_NO_IOSTREAM)
  969. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
  970. # define BOOST_ASIO_NO_IOSTREAM 1
  971. # endif // !defined(BOOST_NO_IOSTREAM)
  972. #endif // !defined(BOOST_ASIO_NO_IOSTREAM)
  973. // Whether exception handling is disabled.
  974. #if !defined(BOOST_ASIO_NO_EXCEPTIONS)
  975. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
  976. # define BOOST_ASIO_NO_EXCEPTIONS 1
  977. # endif // !defined(BOOST_NO_EXCEPTIONS)
  978. #endif // !defined(BOOST_ASIO_NO_EXCEPTIONS)
  979. // Whether the typeid operator is supported.
  980. #if !defined(BOOST_ASIO_NO_TYPEID)
  981. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
  982. # define BOOST_ASIO_NO_TYPEID 1
  983. # endif // !defined(BOOST_NO_TYPEID)
  984. #endif // !defined(BOOST_ASIO_NO_TYPEID)
  985. // Threads.
  986. #if !defined(BOOST_ASIO_HAS_THREADS)
  987. # if !defined(BOOST_ASIO_DISABLE_THREADS)
  988. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  989. # define BOOST_ASIO_HAS_THREADS 1
  990. # elif defined(__GNUC__) && !defined(__MINGW32__) \
  991. && !defined(linux) && !defined(__linux) && !defined(__linux__)
  992. # define BOOST_ASIO_HAS_THREADS 1
  993. # elif defined(_MT) || defined(__MT__)
  994. # define BOOST_ASIO_HAS_THREADS 1
  995. # elif defined(_REENTRANT)
  996. # define BOOST_ASIO_HAS_THREADS 1
  997. # elif defined(__APPLE__)
  998. # define BOOST_ASIO_HAS_THREADS 1
  999. # elif defined(__HAIKU__)
  1000. # define BOOST_ASIO_HAS_THREADS 1
  1001. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  1002. # define BOOST_ASIO_HAS_THREADS 1
  1003. # elif defined(_PTHREADS)
  1004. # define BOOST_ASIO_HAS_THREADS 1
  1005. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  1006. # endif // !defined(BOOST_ASIO_DISABLE_THREADS)
  1007. #endif // !defined(BOOST_ASIO_HAS_THREADS)
  1008. // POSIX threads.
  1009. #if !defined(BOOST_ASIO_HAS_PTHREADS)
  1010. # if defined(BOOST_ASIO_HAS_THREADS)
  1011. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  1012. # define BOOST_ASIO_HAS_PTHREADS 1
  1013. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  1014. # define BOOST_ASIO_HAS_PTHREADS 1
  1015. # elif defined(__HAIKU__)
  1016. # define BOOST_ASIO_HAS_PTHREADS 1
  1017. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  1018. # endif // defined(BOOST_ASIO_HAS_THREADS)
  1019. #endif // !defined(BOOST_ASIO_HAS_PTHREADS)
  1020. // Helper to prevent macro expansion.
  1021. #define BOOST_ASIO_PREVENT_MACRO_SUBSTITUTION
  1022. // Helper to define in-class constants.
  1023. #if !defined(BOOST_ASIO_STATIC_CONSTANT)
  1024. # if !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1025. # define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
  1026. BOOST_STATIC_CONSTANT(type, assignment)
  1027. # else // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1028. # define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
  1029. static const type assignment
  1030. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1031. #endif // !defined(BOOST_ASIO_STATIC_CONSTANT)
  1032. // Boost align library.
  1033. #if !defined(BOOST_ASIO_HAS_BOOST_ALIGN)
  1034. # if !defined(BOOST_ASIO_DISABLE_BOOST_ALIGN)
  1035. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
  1036. # define BOOST_ASIO_HAS_BOOST_ALIGN 1
  1037. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
  1038. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_ALIGN)
  1039. #endif // !defined(BOOST_ASIO_HAS_BOOST_ALIGN)
  1040. // Boost array library.
  1041. #if !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
  1042. # if !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
  1043. # define BOOST_ASIO_HAS_BOOST_ARRAY 1
  1044. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
  1045. #endif // !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
  1046. // Boost assert macro.
  1047. #if !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
  1048. # if !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
  1049. # define BOOST_ASIO_HAS_BOOST_ASSERT 1
  1050. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
  1051. #endif // !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
  1052. // Boost limits header.
  1053. #if !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
  1054. # if !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
  1055. # define BOOST_ASIO_HAS_BOOST_LIMITS 1
  1056. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
  1057. #endif // !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
  1058. // Boost throw_exception function.
  1059. #if !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
  1060. # if !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1061. # define BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION 1
  1062. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1063. #endif // !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
  1064. // Boost regex library.
  1065. #if !defined(BOOST_ASIO_HAS_BOOST_REGEX)
  1066. # if !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
  1067. # define BOOST_ASIO_HAS_BOOST_REGEX 1
  1068. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
  1069. #endif // !defined(BOOST_ASIO_HAS_BOOST_REGEX)
  1070. // Boost bind function.
  1071. #if !defined(BOOST_ASIO_HAS_BOOST_BIND)
  1072. # if !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
  1073. # define BOOST_ASIO_HAS_BOOST_BIND 1
  1074. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
  1075. #endif // !defined(BOOST_ASIO_HAS_BOOST_BIND)
  1076. // Boost's BOOST_WORKAROUND macro.
  1077. #if !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
  1078. # if !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
  1079. # define BOOST_ASIO_HAS_BOOST_WORKAROUND 1
  1080. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
  1081. #endif // !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
  1082. // Microsoft Visual C++'s secure C runtime library.
  1083. #if !defined(BOOST_ASIO_HAS_SECURE_RTL)
  1084. # if !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
  1085. # if defined(BOOST_ASIO_MSVC) \
  1086. && (BOOST_ASIO_MSVC >= 1400) \
  1087. && !defined(UNDER_CE)
  1088. # define BOOST_ASIO_HAS_SECURE_RTL 1
  1089. # endif // defined(BOOST_ASIO_MSVC)
  1090. // && (BOOST_ASIO_MSVC >= 1400)
  1091. // && !defined(UNDER_CE)
  1092. # endif // !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
  1093. #endif // !defined(BOOST_ASIO_HAS_SECURE_RTL)
  1094. // Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
  1095. #if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
  1096. # if !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
  1097. # if defined(__GNUC__)
  1098. # if (__GNUC__ >= 3)
  1099. # define BOOST_ASIO_HAS_HANDLER_HOOKS 1
  1100. # endif // (__GNUC__ >= 3)
  1101. # elif !defined(__BORLANDC__) || defined(__clang__)
  1102. # define BOOST_ASIO_HAS_HANDLER_HOOKS 1
  1103. # endif // !defined(__BORLANDC__) || defined(__clang__)
  1104. # endif // !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
  1105. #endif // !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
  1106. // Support for the __thread keyword extension, or equivalent.
  1107. #if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1108. # if defined(__linux__)
  1109. # if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1110. # if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1111. # if !defined(__INTEL_COMPILER) && !defined(__ICL) \
  1112. && !(defined(__clang__) && defined(__ANDROID__))
  1113. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1114. # define BOOST_ASIO_THREAD_KEYWORD __thread
  1115. # elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1116. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1117. # endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1118. // && !(defined(__clang__) && defined(__ANDROID__))
  1119. # endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1120. # endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1121. # endif // defined(__linux__)
  1122. # if defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
  1123. # if (_MSC_VER >= 1700)
  1124. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1125. # define BOOST_ASIO_THREAD_KEYWORD __declspec(thread)
  1126. # endif // (_MSC_VER >= 1700)
  1127. # endif // defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
  1128. # if defined(__APPLE__)
  1129. # if defined(__clang__)
  1130. # if defined(__apple_build_version__)
  1131. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1132. # define BOOST_ASIO_THREAD_KEYWORD __thread
  1133. # endif // defined(__apple_build_version__)
  1134. # endif // defined(__clang__)
  1135. # endif // defined(__APPLE__)
  1136. # if !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
  1137. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  1138. # if !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  1139. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1140. # define BOOST_ASIO_THREAD_KEYWORD thread_local
  1141. # endif // !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  1142. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  1143. # endif // !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
  1144. #endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1145. #if !defined(BOOST_ASIO_THREAD_KEYWORD)
  1146. # define BOOST_ASIO_THREAD_KEYWORD __thread
  1147. #endif // !defined(BOOST_ASIO_THREAD_KEYWORD)
  1148. // Support for POSIX ssize_t typedef.
  1149. #if !defined(BOOST_ASIO_DISABLE_SSIZE_T)
  1150. # if defined(__linux__) \
  1151. || (defined(__MACH__) && defined(__APPLE__))
  1152. # define BOOST_ASIO_HAS_SSIZE_T 1
  1153. # endif // defined(__linux__)
  1154. // || (defined(__MACH__) && defined(__APPLE__))
  1155. #endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T)
  1156. // Helper macros to manage transition away from error_code return values.
  1157. #if defined(BOOST_ASIO_NO_DEPRECATED)
  1158. # define BOOST_ASIO_SYNC_OP_VOID void
  1159. # define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return
  1160. #else // defined(BOOST_ASIO_NO_DEPRECATED)
  1161. # define BOOST_ASIO_SYNC_OP_VOID boost::system::error_code
  1162. # define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return e
  1163. #endif // defined(BOOST_ASIO_NO_DEPRECATED)
  1164. // Newer gcc, clang need special treatment to suppress unused typedef warnings.
  1165. #if defined(__clang__)
  1166. # if defined(__apple_build_version__)
  1167. # if (__clang_major__ >= 7)
  1168. # define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1169. # endif // (__clang_major__ >= 7)
  1170. # elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
  1171. || (__clang_major__ > 3)
  1172. # define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1173. # endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
  1174. // || (__clang_major__ > 3)
  1175. #elif defined(__GNUC__)
  1176. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  1177. # define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1178. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  1179. #endif // defined(__GNUC__)
  1180. #if !defined(BOOST_ASIO_UNUSED_TYPEDEF)
  1181. # define BOOST_ASIO_UNUSED_TYPEDEF
  1182. #endif // !defined(BOOST_ASIO_UNUSED_TYPEDEF)
  1183. // Some versions of gcc generate spurious warnings about unused variables.
  1184. #if defined(__GNUC__)
  1185. # if (__GNUC__ >= 4)
  1186. # define BOOST_ASIO_UNUSED_VARIABLE __attribute__((__unused__))
  1187. # endif // (__GNUC__ >= 4)
  1188. #endif // defined(__GNUC__)
  1189. #if !defined(BOOST_ASIO_UNUSED_VARIABLE)
  1190. # define BOOST_ASIO_UNUSED_VARIABLE
  1191. #endif // !defined(BOOST_ASIO_UNUSED_VARIABLE)
  1192. // Helper macro to tell the optimiser what may be assumed to be true.
  1193. #if defined(BOOST_ASIO_MSVC)
  1194. # define BOOST_ASIO_ASSUME(expr) __assume(expr)
  1195. #elif defined(__clang__)
  1196. # if __has_builtin(__builtin_assume)
  1197. # define BOOST_ASIO_ASSUME(expr) __builtin_assume(expr)
  1198. # endif // __has_builtin(__builtin_assume)
  1199. #elif defined(__GNUC__)
  1200. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  1201. # define BOOST_ASIO_ASSUME(expr) if (expr) {} else { __builtin_unreachable(); }
  1202. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  1203. #endif // defined(__GNUC__)
  1204. #if !defined(BOOST_ASIO_ASSUME)
  1205. # define BOOST_ASIO_ASSUME(expr) (void)0
  1206. #endif // !defined(BOOST_ASIO_ASSUME)
  1207. // Support the co_await keyword on compilers known to allow it.
  1208. #if !defined(BOOST_ASIO_HAS_CO_AWAIT)
  1209. # if !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
  1210. # if (__cplusplus >= 202002) \
  1211. && (__cpp_impl_coroutine >= 201902) && (__cpp_lib_coroutine >= 201902)
  1212. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1213. # elif defined(BOOST_ASIO_MSVC)
  1214. # if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) && !defined(__clang__)
  1215. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1216. # elif (_MSC_FULL_VER >= 190023506)
  1217. # if defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
  1218. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1219. # endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
  1220. # endif // (_MSC_FULL_VER >= 190023506)
  1221. # elif defined(__clang__)
  1222. # if (__clang_major__ >= 14)
  1223. # if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
  1224. # if __has_include(<coroutine>)
  1225. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1226. # endif // __has_include(<coroutine>)
  1227. # elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1228. # if __has_include(<experimental/coroutine>)
  1229. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1230. # endif // __has_include(<experimental/coroutine>)
  1231. # endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1232. # else // (__clang_major__ >= 14)
  1233. # if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1234. # if __has_include(<experimental/coroutine>)
  1235. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1236. # endif // __has_include(<experimental/coroutine>)
  1237. # endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1238. # endif // (__clang_major__ >= 14)
  1239. # elif defined(__GNUC__)
  1240. # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1241. # if __has_include(<coroutine>)
  1242. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1243. # endif // __has_include(<coroutine>)
  1244. # endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1245. # endif // defined(__GNUC__)
  1246. # endif // !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
  1247. #endif // !defined(BOOST_ASIO_HAS_CO_AWAIT)
  1248. // Standard library support for coroutines.
  1249. #if !defined(BOOST_ASIO_HAS_STD_COROUTINE)
  1250. # if !defined(BOOST_ASIO_DISABLE_STD_COROUTINE)
  1251. # if defined(BOOST_ASIO_MSVC)
  1252. # if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
  1253. # define BOOST_ASIO_HAS_STD_COROUTINE 1
  1254. # endif // (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
  1255. # elif defined(__clang__)
  1256. # if (__clang_major__ >= 14)
  1257. # if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
  1258. # if __has_include(<coroutine>)
  1259. # define BOOST_ASIO_HAS_STD_COROUTINE 1
  1260. # endif // __has_include(<coroutine>)
  1261. # endif // (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
  1262. # endif // (__clang_major__ >= 14)
  1263. # elif defined(__GNUC__)
  1264. # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1265. # if __has_include(<coroutine>)
  1266. # define BOOST_ASIO_HAS_STD_COROUTINE 1
  1267. # endif // __has_include(<coroutine>)
  1268. # endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1269. # endif // defined(__GNUC__)
  1270. # endif // !defined(BOOST_ASIO_DISABLE_STD_COROUTINE)
  1271. #endif // !defined(BOOST_ASIO_HAS_STD_COROUTINE)
  1272. // Compiler support for the the [[nodiscard]] attribute.
  1273. #if !defined(BOOST_ASIO_NODISCARD)
  1274. # if defined(__has_cpp_attribute)
  1275. # if __has_cpp_attribute(nodiscard)
  1276. # if (__cplusplus >= 201703)
  1277. # define BOOST_ASIO_NODISCARD [[nodiscard]]
  1278. # endif // (__cplusplus >= 201703)
  1279. # endif // __has_cpp_attribute(nodiscard)
  1280. # endif // defined(__has_cpp_attribute)
  1281. #endif // !defined(BOOST_ASIO_NODISCARD)
  1282. #if !defined(BOOST_ASIO_NODISCARD)
  1283. # define BOOST_ASIO_NODISCARD
  1284. #endif // !defined(BOOST_ASIO_NODISCARD)
  1285. // Compiler support for the the [[deprecated(msg)]] attribute.
  1286. #if !defined(BOOST_ASIO_DEPRECATED_MSG)
  1287. # if !defined(BOOST_ASIO_DISABLE_DEPRECATED_MSG)
  1288. # if defined(BOOST_ASIO_MSVC) && (BOOST_ASIO_MSVC >= 1400)
  1289. # define BOOST_ASIO_DEPRECATED_MSG(msg) __declspec(deprecated(msg))
  1290. # elif (__cplusplus >= 201402)
  1291. # if defined(__has_cpp_attribute)
  1292. # if __has_cpp_attribute(deprecated)
  1293. # define BOOST_ASIO_DEPRECATED_MSG(msg) [[deprecated(msg)]]
  1294. # endif // __has_cpp_attribute(deprecated)
  1295. # endif // defined(__has_cpp_attribute)
  1296. # endif // __cplusplus >= 201402
  1297. # endif // !defined(BOOST_ASIO_DISABLE_DEPRECATED_MSG)
  1298. #endif // !defined(BOOST_ASIO_DEPRECATED_MSG)
  1299. #if !defined(BOOST_ASIO_DEPRECATED_MSG)
  1300. # define BOOST_ASIO_DEPRECATED_MSG(msg)
  1301. #endif // !defined(BOOST_ASIO_DEPRECATED_MSG)
  1302. // Kernel support for MSG_NOSIGNAL.
  1303. #if !defined(BOOST_ASIO_HAS_MSG_NOSIGNAL)
  1304. # if defined(__linux__)
  1305. # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1
  1306. # elif defined(_POSIX_VERSION)
  1307. # if (_POSIX_VERSION >= 200809L)
  1308. # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1
  1309. # endif // _POSIX_VERSION >= 200809L
  1310. # endif // defined(_POSIX_VERSION)
  1311. #endif // !defined(BOOST_ASIO_HAS_MSG_NOSIGNAL)
  1312. // Standard library support for std::to_address.
  1313. #if !defined(BOOST_ASIO_HAS_STD_TO_ADDRESS)
  1314. # if !defined(BOOST_ASIO_DISABLE_STD_TO_ADDRESS)
  1315. # if defined(__clang__)
  1316. # if (__cplusplus >= 202002)
  1317. # define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
  1318. # endif // (__cplusplus >= 202002)
  1319. # elif defined(__GNUC__)
  1320. # if (__GNUC__ >= 8)
  1321. # if (__cplusplus >= 202002)
  1322. # define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
  1323. # endif // (__cplusplus >= 202002)
  1324. # endif // (__GNUC__ >= 8)
  1325. # endif // defined(__GNUC__)
  1326. # if defined(BOOST_ASIO_MSVC)
  1327. # if (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
  1328. # define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
  1329. # endif // (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
  1330. # endif // defined(BOOST_ASIO_MSVC)
  1331. # endif // !defined(BOOST_ASIO_DISABLE_STD_TO_ADDRESS)
  1332. #endif // !defined(BOOST_ASIO_HAS_STD_TO_ADDRESS)
  1333. // Standard library support for snprintf.
  1334. #if !defined(BOOST_ASIO_HAS_SNPRINTF)
  1335. # if !defined(BOOST_ASIO_DISABLE_SNPRINTF)
  1336. # if defined(__APPLE__)
  1337. # define BOOST_ASIO_HAS_SNPRINTF 1
  1338. # endif // defined(__APPLE__)
  1339. # endif // !defined(BOOST_ASIO_DISABLE_SNPRINTF)
  1340. #endif // !defined(BOOST_ASIO_HAS_SNPRINTF)
  1341. #endif // BOOST_ASIO_DETAIL_CONFIG_HPP