config.hpp 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  1. //
  2. // detail/config.hpp
  3. // ~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) \
  354. && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__)
  355. # if defined(__ANDROID__) && (__ANDROID_API__ >= 28)
  356. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  357. # elif defined(__APPLE__)
  358. # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  359. # if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
  360. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  361. # endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
  362. # elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
  363. # if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
  364. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  365. # endif // (__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000)
  366. # elif defined(__TV_OS_VERSION_MIN_REQUIRED)
  367. # if (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
  368. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  369. # endif // (__TV_OS_VERSION_MIN_REQUIRED >= 130000)
  370. # elif defined(__WATCH_OS_VERSION_MIN_REQUIRED)
  371. # if (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000)
  372. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  373. # endif // (__WATCH_OS_VERSION_MIN_REQUIRED >= 60000)
  374. # endif // defined(__WATCH_OS_X_VERSION_MIN_REQUIRED)
  375. # else // defined(__APPLE__)
  376. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  377. # endif // defined(__APPLE__)
  378. # endif // (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC)
  379. // && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__)
  380. # elif defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  381. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  382. # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  383. # elif defined(__GNUC__)
  384. # if ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
  385. # if defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  386. # define BOOST_ASIO_HAS_STD_ALIGNED_ALLOC 1
  387. # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  388. # endif // ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 7)
  389. # endif // defined(__GNUC__)
  390. # endif // (__cplusplus >= 201703)
  391. # endif // !defined(BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC)
  392. #endif // !defined(BOOST_ASIO_HAS_STD_ALIGNED_ALLOC)
  393. // Boost support for chrono.
  394. #if !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  395. # if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
  396. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
  397. # define BOOST_ASIO_HAS_BOOST_CHRONO 1
  398. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
  399. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
  400. #endif // !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  401. // Some form of chrono library is available.
  402. #if !defined(BOOST_ASIO_HAS_CHRONO)
  403. # if defined(BOOST_ASIO_HAS_STD_CHRONO) \
  404. || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  405. # define BOOST_ASIO_HAS_CHRONO 1
  406. # endif // defined(BOOST_ASIO_HAS_STD_CHRONO)
  407. // || defined(BOOST_ASIO_HAS_BOOST_CHRONO)
  408. #endif // !defined(BOOST_ASIO_HAS_CHRONO)
  409. // Boost support for the DateTime library.
  410. #if !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
  411. # if !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
  412. # define BOOST_ASIO_HAS_BOOST_DATE_TIME 1
  413. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_DATE_TIME)
  414. #endif // !defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
  415. // Boost support for the Coroutine library.
  416. #if !defined(BOOST_ASIO_HAS_BOOST_COROUTINE)
  417. # if !defined(BOOST_ASIO_DISABLE_BOOST_COROUTINE)
  418. # define BOOST_ASIO_HAS_BOOST_COROUTINE 1
  419. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_COROUTINE)
  420. #endif // !defined(BOOST_ASIO_HAS_BOOST_COROUTINE)
  421. // Boost support for the Context library's fibers.
  422. #if !defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER)
  423. # if !defined(BOOST_ASIO_DISABLE_BOOST_CONTEXT_FIBER)
  424. # if defined(__clang__)
  425. # if (__cplusplus >= 201103)
  426. # define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
  427. # endif // (__cplusplus >= 201103)
  428. # elif defined(__GNUC__)
  429. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  430. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  431. # define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
  432. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  433. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  434. # endif // defined(__GNUC__)
  435. # if defined(BOOST_ASIO_MSVC)
  436. # if (_MSVC_LANG >= 201103)
  437. # define BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER 1
  438. # endif // (_MSC_LANG >= 201103)
  439. # endif // defined(BOOST_ASIO_MSVC)
  440. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_CONTEXT_FIBER)
  441. #endif // !defined(BOOST_ASIO_HAS_BOOST_CONTEXT_FIBER)
  442. // Standard library support for std::string_view.
  443. #if !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
  444. # if !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
  445. # if defined(__clang__)
  446. # if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  447. # if (__cplusplus >= 201402)
  448. # if __has_include(<string_view>)
  449. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  450. # endif // __has_include(<string_view>)
  451. # endif // (__cplusplus >= 201402)
  452. # else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  453. # if (__cplusplus >= 201703)
  454. # if __has_include(<string_view>)
  455. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  456. # endif // __has_include(<string_view>)
  457. # endif // (__cplusplus >= 201703)
  458. # endif // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  459. # elif defined(__GNUC__)
  460. # if (__GNUC__ >= 7)
  461. # if (__cplusplus >= 201703)
  462. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  463. # endif // (__cplusplus >= 201703)
  464. # endif // (__GNUC__ >= 7)
  465. # elif defined(BOOST_ASIO_MSVC)
  466. # if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
  467. # define BOOST_ASIO_HAS_STD_STRING_VIEW 1
  468. # endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
  469. # endif // defined(BOOST_ASIO_MSVC)
  470. # endif // !defined(BOOST_ASIO_DISABLE_STD_STRING_VIEW)
  471. #endif // !defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
  472. // Standard library support for std::experimental::string_view.
  473. #if !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  474. # if !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
  475. # if defined(__clang__)
  476. # if defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  477. # if (_LIBCPP_VERSION < 7000)
  478. # if (__cplusplus >= 201402)
  479. # if __has_include(<experimental/string_view>)
  480. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  481. # endif // __has_include(<experimental/string_view>)
  482. # endif // (__cplusplus >= 201402)
  483. # endif // (_LIBCPP_VERSION < 7000)
  484. # else // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  485. # if (__cplusplus >= 201402)
  486. # if __has_include(<experimental/string_view>)
  487. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  488. # endif // __has_include(<experimental/string_view>)
  489. # endif // (__cplusplus >= 201402)
  490. # endif // // defined(BOOST_ASIO_HAS_CLANG_LIBCXX)
  491. # elif defined(__GNUC__)
  492. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  493. # if (__cplusplus >= 201402)
  494. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  495. # endif // (__cplusplus >= 201402)
  496. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  497. # endif // defined(__GNUC__)
  498. # endif // !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
  499. #endif // !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  500. // Standard library has a string_view that we can use.
  501. #if !defined(BOOST_ASIO_HAS_STRING_VIEW)
  502. # if !defined(BOOST_ASIO_DISABLE_STRING_VIEW)
  503. # if defined(BOOST_ASIO_HAS_STD_STRING_VIEW)
  504. # define BOOST_ASIO_HAS_STRING_VIEW 1
  505. # elif defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  506. # define BOOST_ASIO_HAS_STRING_VIEW 1
  507. # endif // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  508. # endif // !defined(BOOST_ASIO_DISABLE_STRING_VIEW)
  509. #endif // !defined(BOOST_ASIO_HAS_STRING_VIEW)
  510. // Standard library has invoke_result (which supersedes result_of).
  511. #if !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  512. # if !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT)
  513. # if defined(BOOST_ASIO_MSVC)
  514. # if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
  515. # define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
  516. # endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
  517. # else // defined(BOOST_ASIO_MSVC)
  518. # if (__cplusplus >= 201703) && (__cpp_lib_is_invocable >= 201703)
  519. # define BOOST_ASIO_HAS_STD_INVOKE_RESULT 1
  520. # endif // (__cplusplus >= 201703) && (__cpp_lib_is_invocable >= 201703)
  521. # endif // defined(BOOST_ASIO_MSVC)
  522. # endif // !defined(BOOST_ASIO_DISABLE_STD_INVOKE_RESULT)
  523. #endif // !defined(BOOST_ASIO_HAS_STD_INVOKE_RESULT)
  524. // Standard library support for std::any.
  525. #if !defined(BOOST_ASIO_HAS_STD_ANY)
  526. # if !defined(BOOST_ASIO_DISABLE_STD_ANY)
  527. # if defined(__clang__)
  528. # if (__cplusplus >= 201703)
  529. # if __has_include(<any>)
  530. # define BOOST_ASIO_HAS_STD_ANY 1
  531. # endif // __has_include(<any>)
  532. # endif // (__cplusplus >= 201703)
  533. # elif defined(__GNUC__)
  534. # if (__GNUC__ >= 7)
  535. # if (__cplusplus >= 201703)
  536. # define BOOST_ASIO_HAS_STD_ANY 1
  537. # endif // (__cplusplus >= 201703)
  538. # endif // (__GNUC__ >= 7)
  539. # endif // defined(__GNUC__)
  540. # if defined(BOOST_ASIO_MSVC)
  541. # if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  542. # define BOOST_ASIO_HAS_STD_ANY 1
  543. # endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  544. # endif // defined(BOOST_ASIO_MSVC)
  545. # endif // !defined(BOOST_ASIO_DISABLE_STD_ANY)
  546. #endif // !defined(BOOST_ASIO_HAS_STD_ANY)
  547. // Standard library support for std::variant.
  548. #if !defined(BOOST_ASIO_HAS_STD_VARIANT)
  549. # if !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
  550. # if defined(__clang__)
  551. # if (__cplusplus >= 201703)
  552. # if __has_include(<variant>)
  553. # define BOOST_ASIO_HAS_STD_VARIANT 1
  554. # endif // __has_include(<variant>)
  555. # endif // (__cplusplus >= 201703)
  556. # elif defined(__GNUC__)
  557. # if (__GNUC__ >= 7)
  558. # if (__cplusplus >= 201703)
  559. # define BOOST_ASIO_HAS_STD_VARIANT 1
  560. # endif // (__cplusplus >= 201703)
  561. # endif // (__GNUC__ >= 7)
  562. # endif // defined(__GNUC__)
  563. # if defined(BOOST_ASIO_MSVC)
  564. # if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  565. # define BOOST_ASIO_HAS_STD_VARIANT 1
  566. # endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  567. # endif // defined(BOOST_ASIO_MSVC)
  568. # endif // !defined(BOOST_ASIO_DISABLE_STD_VARIANT)
  569. #endif // !defined(BOOST_ASIO_HAS_STD_VARIANT)
  570. // Standard library support for std::source_location.
  571. #if !defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
  572. # if !defined(BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION)
  573. // ...
  574. # endif // !defined(BOOST_ASIO_DISABLE_STD_SOURCE_LOCATION)
  575. #endif // !defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
  576. // Standard library support for std::experimental::source_location.
  577. #if !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  578. # if !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
  579. # if defined(__GNUC__)
  580. # if (__cplusplus >= 201709)
  581. # if __has_include(<experimental/source_location>)
  582. # define BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION 1
  583. # endif // __has_include(<experimental/source_location>)
  584. # endif // (__cplusplus >= 201709)
  585. # endif // defined(__GNUC__)
  586. # endif // !defined(BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
  587. #endif // !defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  588. // Standard library has a source_location that we can use.
  589. #if !defined(BOOST_ASIO_HAS_SOURCE_LOCATION)
  590. # if !defined(BOOST_ASIO_DISABLE_SOURCE_LOCATION)
  591. # if defined(BOOST_ASIO_HAS_STD_SOURCE_LOCATION)
  592. # define BOOST_ASIO_HAS_SOURCE_LOCATION 1
  593. # elif defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  594. # define BOOST_ASIO_HAS_SOURCE_LOCATION 1
  595. # endif // defined(BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  596. # endif // !defined(BOOST_ASIO_DISABLE_SOURCE_LOCATION)
  597. #endif // !defined(BOOST_ASIO_HAS_SOURCE_LOCATION)
  598. // Boost support for source_location and system errors.
  599. #if !defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  600. # if !defined(BOOST_ASIO_DISABLE_BOOST_SOURCE_LOCATION)
  601. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
  602. # define BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION 1
  603. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 107900)
  604. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_SOURCE_LOCATION)
  605. #endif // !defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  606. // Helper macros for working with Boost source locations.
  607. #if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  608. # define BOOST_ASIO_SOURCE_LOCATION_PARAM \
  609. , const boost::source_location& loc
  610. # define BOOST_ASIO_SOURCE_LOCATION_DEFAULTED_PARAM \
  611. , const boost::source_location& loc = BOOST_CURRENT_LOCATION
  612. # define BOOST_ASIO_SOURCE_LOCATION_ARG , loc
  613. #else // if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  614. # define BOOST_ASIO_SOURCE_LOCATION_PARAM
  615. # define BOOST_ASIO_SOURCE_LOCATION_DEFAULTED_PARAM
  616. # define BOOST_ASIO_SOURCE_LOCATION_ARG
  617. #endif // if defined(BOOST_ASIO_HAS_BOOST_SOURCE_LOCATION)
  618. // Standard library support for std::index_sequence.
  619. #if !defined(BOOST_ASIO_HAS_STD_INDEX_SEQUENCE)
  620. # if !defined(BOOST_ASIO_DISABLE_STD_INDEX_SEQUENCE)
  621. # if defined(__clang__)
  622. # if (__cplusplus >= 201402)
  623. # define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
  624. # endif // (__cplusplus >= 201402)
  625. # elif defined(__GNUC__)
  626. # if (__GNUC__ >= 7)
  627. # if (__cplusplus >= 201402)
  628. # define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
  629. # endif // (__cplusplus >= 201402)
  630. # endif // (__GNUC__ >= 7)
  631. # endif // defined(__GNUC__)
  632. # if defined(BOOST_ASIO_MSVC)
  633. # if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
  634. # define BOOST_ASIO_HAS_STD_INDEX_SEQUENCE 1
  635. # endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201402)
  636. # endif // defined(BOOST_ASIO_MSVC)
  637. # endif // !defined(BOOST_ASIO_DISABLE_STD_INDEX_SEQUENCE)
  638. #endif // !defined(BOOST_ASIO_HAS_STD_INDEX_SEQUENCE)
  639. // Windows App target. Windows but with a limited API.
  640. #if !defined(BOOST_ASIO_WINDOWS_APP)
  641. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  642. # include <winapifamily.h>
  643. # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  644. || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)) \
  645. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  646. # define BOOST_ASIO_WINDOWS_APP 1
  647. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  648. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  649. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  650. #endif // !defined(BOOST_ASIO_WINDOWS_APP)
  651. // Legacy WinRT target. Windows App is preferred.
  652. #if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  653. # if !defined(BOOST_ASIO_WINDOWS_APP)
  654. # if defined(__cplusplus_winrt)
  655. # include <winapifamily.h>
  656. # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  657. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  658. # define BOOST_ASIO_WINDOWS_RUNTIME 1
  659. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  660. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  661. # endif // defined(__cplusplus_winrt)
  662. # endif // !defined(BOOST_ASIO_WINDOWS_APP)
  663. #endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  664. // Windows target. Excludes WinRT but includes Windows App targets.
  665. #if !defined(BOOST_ASIO_WINDOWS)
  666. # if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  667. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  668. # define BOOST_ASIO_WINDOWS 1
  669. # elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  670. # define BOOST_ASIO_WINDOWS 1
  671. # elif defined(BOOST_ASIO_WINDOWS_APP)
  672. # define BOOST_ASIO_WINDOWS 1
  673. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  674. # endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  675. #endif // !defined(BOOST_ASIO_WINDOWS)
  676. // Windows: target OS version.
  677. #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  678. # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  679. # if defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  680. # pragma message( \
  681. "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
  682. "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
  683. "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
  684. "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
  685. # else // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  686. # warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
  687. # warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
  688. # warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
  689. # endif // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  690. # define _WIN32_WINNT 0x0601
  691. # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  692. # if defined(_MSC_VER)
  693. # if defined(_WIN32) && !defined(WIN32)
  694. # if !defined(_WINSOCK2API_)
  695. # define WIN32 // Needed for correct types in winsock2.h
  696. # else // !defined(_WINSOCK2API_)
  697. # error Please define the macro WIN32 in your compiler options
  698. # endif // !defined(_WINSOCK2API_)
  699. # endif // defined(_WIN32) && !defined(WIN32)
  700. # endif // defined(_MSC_VER)
  701. # if defined(__BORLANDC__)
  702. # if defined(__WIN32__) && !defined(WIN32)
  703. # if !defined(_WINSOCK2API_)
  704. # define WIN32 // Needed for correct types in winsock2.h
  705. # else // !defined(_WINSOCK2API_)
  706. # error Please define the macro WIN32 in your compiler options
  707. # endif // !defined(_WINSOCK2API_)
  708. # endif // defined(__WIN32__) && !defined(WIN32)
  709. # endif // defined(__BORLANDC__)
  710. # if defined(__CYGWIN__)
  711. # if !defined(__USE_W32_SOCKETS)
  712. # error You must add -D__USE_W32_SOCKETS to your compiler options.
  713. # endif // !defined(__USE_W32_SOCKETS)
  714. # endif // defined(__CYGWIN__)
  715. #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  716. // Windows: minimise header inclusion.
  717. #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  718. # if !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  719. # if !defined(WIN32_LEAN_AND_MEAN)
  720. # define WIN32_LEAN_AND_MEAN
  721. # endif // !defined(WIN32_LEAN_AND_MEAN)
  722. # endif // !defined(BOOST_ASIO_NO_WIN32_LEAN_AND_MEAN)
  723. #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  724. // Windows: suppress definition of "min" and "max" macros.
  725. #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  726. # if !defined(BOOST_ASIO_NO_NOMINMAX)
  727. # if !defined(NOMINMAX)
  728. # define NOMINMAX 1
  729. # endif // !defined(NOMINMAX)
  730. # endif // !defined(BOOST_ASIO_NO_NOMINMAX)
  731. #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  732. // Windows: IO Completion Ports.
  733. #if !defined(BOOST_ASIO_HAS_IOCP)
  734. # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  735. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  736. # if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  737. # if !defined(BOOST_ASIO_DISABLE_IOCP)
  738. # define BOOST_ASIO_HAS_IOCP 1
  739. # endif // !defined(BOOST_ASIO_DISABLE_IOCP)
  740. # endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  741. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  742. # endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  743. #endif // !defined(BOOST_ASIO_HAS_IOCP)
  744. // On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
  745. // get access to the various platform feature macros, e.g. to be able to test
  746. // for threads support.
  747. #if !defined(BOOST_ASIO_HAS_UNISTD_H)
  748. # if !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  749. # if defined(unix) \
  750. || defined(__unix) \
  751. || defined(_XOPEN_SOURCE) \
  752. || defined(_POSIX_SOURCE) \
  753. || (defined(__MACH__) && defined(__APPLE__)) \
  754. || defined(__FreeBSD__) \
  755. || defined(__NetBSD__) \
  756. || defined(__OpenBSD__) \
  757. || defined(__linux__) \
  758. || defined(__HAIKU__)
  759. # define BOOST_ASIO_HAS_UNISTD_H 1
  760. # endif
  761. # endif // !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  762. #endif // !defined(BOOST_ASIO_HAS_UNISTD_H)
  763. #if defined(BOOST_ASIO_HAS_UNISTD_H)
  764. # include <unistd.h>
  765. #endif // defined(BOOST_ASIO_HAS_UNISTD_H)
  766. // Linux: epoll, eventfd, timerfd and io_uring.
  767. #if defined(__linux__)
  768. # include <linux/version.h>
  769. # if !defined(BOOST_ASIO_HAS_EPOLL)
  770. # if !defined(BOOST_ASIO_DISABLE_EPOLL)
  771. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  772. # define BOOST_ASIO_HAS_EPOLL 1
  773. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  774. # endif // !defined(BOOST_ASIO_DISABLE_EPOLL)
  775. # endif // !defined(BOOST_ASIO_HAS_EPOLL)
  776. # if !defined(BOOST_ASIO_HAS_EVENTFD)
  777. # if !defined(BOOST_ASIO_DISABLE_EVENTFD)
  778. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  779. # define BOOST_ASIO_HAS_EVENTFD 1
  780. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  781. # endif // !defined(BOOST_ASIO_DISABLE_EVENTFD)
  782. # endif // !defined(BOOST_ASIO_HAS_EVENTFD)
  783. # if !defined(BOOST_ASIO_HAS_TIMERFD)
  784. # if defined(BOOST_ASIO_HAS_EPOLL)
  785. # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  786. # define BOOST_ASIO_HAS_TIMERFD 1
  787. # endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  788. # endif // defined(BOOST_ASIO_HAS_EPOLL)
  789. # endif // !defined(BOOST_ASIO_HAS_TIMERFD)
  790. # if defined(BOOST_ASIO_HAS_IO_URING)
  791. # if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
  792. # error Linux kernel 5.10 or later is required to support io_uring
  793. # endif // LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0)
  794. # endif // defined(BOOST_ASIO_HAS_IO_URING)
  795. #endif // defined(__linux__)
  796. // Linux: io_uring is used instead of epoll.
  797. #if !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
  798. # if !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING)
  799. # define BOOST_ASIO_HAS_IO_URING_AS_DEFAULT 1
  800. # endif // !defined(BOOST_ASIO_HAS_EPOLL) && defined(BOOST_ASIO_HAS_IO_URING)
  801. #endif // !defined(BOOST_ASIO_HAS_IO_URING_AS_DEFAULT)
  802. // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
  803. #if (defined(__MACH__) && defined(__APPLE__)) \
  804. || defined(__FreeBSD__) \
  805. || defined(__NetBSD__) \
  806. || defined(__OpenBSD__)
  807. # if !defined(BOOST_ASIO_HAS_KQUEUE)
  808. # if !defined(BOOST_ASIO_DISABLE_KQUEUE)
  809. # define BOOST_ASIO_HAS_KQUEUE 1
  810. # endif // !defined(BOOST_ASIO_DISABLE_KQUEUE)
  811. # endif // !defined(BOOST_ASIO_HAS_KQUEUE)
  812. #endif // (defined(__MACH__) && defined(__APPLE__))
  813. // || defined(__FreeBSD__)
  814. // || defined(__NetBSD__)
  815. // || defined(__OpenBSD__)
  816. // Solaris: /dev/poll.
  817. #if defined(__sun)
  818. # if !defined(BOOST_ASIO_HAS_DEV_POLL)
  819. # if !defined(BOOST_ASIO_DISABLE_DEV_POLL)
  820. # define BOOST_ASIO_HAS_DEV_POLL 1
  821. # endif // !defined(BOOST_ASIO_DISABLE_DEV_POLL)
  822. # endif // !defined(BOOST_ASIO_HAS_DEV_POLL)
  823. #endif // defined(__sun)
  824. // Serial ports.
  825. #if !defined(BOOST_ASIO_HAS_SERIAL_PORT)
  826. # if defined(BOOST_ASIO_HAS_IOCP) \
  827. || !defined(BOOST_ASIO_WINDOWS) \
  828. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  829. && !defined(__CYGWIN__)
  830. # if !defined(__SYMBIAN32__)
  831. # if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
  832. # define BOOST_ASIO_HAS_SERIAL_PORT 1
  833. # endif // !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
  834. # endif // !defined(__SYMBIAN32__)
  835. # endif // defined(BOOST_ASIO_HAS_IOCP)
  836. // || !defined(BOOST_ASIO_WINDOWS)
  837. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  838. // && !defined(__CYGWIN__)
  839. #endif // !defined(BOOST_ASIO_HAS_SERIAL_PORT)
  840. // Windows: stream handles.
  841. #if !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
  842. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  843. # if defined(BOOST_ASIO_HAS_IOCP)
  844. # define BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE 1
  845. # endif // defined(BOOST_ASIO_HAS_IOCP)
  846. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  847. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
  848. // Windows: random access handles.
  849. #if !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  850. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  851. # if defined(BOOST_ASIO_HAS_IOCP)
  852. # define BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
  853. # endif // defined(BOOST_ASIO_HAS_IOCP)
  854. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  855. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  856. // Windows: object handles.
  857. #if !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  858. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  859. # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  860. # if !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  861. # define BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
  862. # endif // !defined(UNDER_CE) && !defined(BOOST_ASIO_WINDOWS_APP)
  863. # endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  864. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  865. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  866. // Windows: OVERLAPPED wrapper.
  867. #if !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  868. # if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  869. # if defined(BOOST_ASIO_HAS_IOCP)
  870. # define BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
  871. # endif // defined(BOOST_ASIO_HAS_IOCP)
  872. # endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  873. #endif // !defined(BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  874. // POSIX: stream-oriented file descriptors.
  875. #if !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  876. # if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  877. # if !defined(BOOST_ASIO_WINDOWS) \
  878. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  879. && !defined(__CYGWIN__)
  880. # define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
  881. # endif // !defined(BOOST_ASIO_WINDOWS)
  882. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  883. // && !defined(__CYGWIN__)
  884. # endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  885. #endif // !defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  886. // UNIX domain sockets.
  887. #if !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
  888. # if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
  889. # if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  890. # define BOOST_ASIO_HAS_LOCAL_SOCKETS 1
  891. # endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  892. # endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
  893. #endif // !defined(BOOST_ASIO_HAS_LOCAL_SOCKETS)
  894. // Files.
  895. #if !defined(BOOST_ASIO_HAS_FILE)
  896. # if !defined(BOOST_ASIO_DISABLE_FILE)
  897. # if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  898. # define BOOST_ASIO_HAS_FILE 1
  899. # elif defined(BOOST_ASIO_HAS_IO_URING)
  900. # define BOOST_ASIO_HAS_FILE 1
  901. # endif // defined(BOOST_ASIO_HAS_IO_URING)
  902. # endif // !defined(BOOST_ASIO_DISABLE_FILE)
  903. #endif // !defined(BOOST_ASIO_HAS_FILE)
  904. // Pipes.
  905. #if !defined(BOOST_ASIO_HAS_PIPE)
  906. # if defined(BOOST_ASIO_HAS_IOCP) \
  907. || !defined(BOOST_ASIO_WINDOWS) \
  908. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  909. && !defined(__CYGWIN__)
  910. # if !defined(__SYMBIAN32__)
  911. # if !defined(BOOST_ASIO_DISABLE_PIPE)
  912. # define BOOST_ASIO_HAS_PIPE 1
  913. # endif // !defined(BOOST_ASIO_DISABLE_PIPE)
  914. # endif // !defined(__SYMBIAN32__)
  915. # endif // defined(BOOST_ASIO_HAS_IOCP)
  916. // || !defined(BOOST_ASIO_WINDOWS)
  917. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  918. // && !defined(__CYGWIN__)
  919. #endif // !defined(BOOST_ASIO_HAS_PIPE)
  920. // Can use sigaction() instead of signal().
  921. #if !defined(BOOST_ASIO_HAS_SIGACTION)
  922. # if !defined(BOOST_ASIO_DISABLE_SIGACTION)
  923. # if !defined(BOOST_ASIO_WINDOWS) \
  924. && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  925. && !defined(__CYGWIN__)
  926. # define BOOST_ASIO_HAS_SIGACTION 1
  927. # endif // !defined(BOOST_ASIO_WINDOWS)
  928. // && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
  929. // && !defined(__CYGWIN__)
  930. # endif // !defined(BOOST_ASIO_DISABLE_SIGACTION)
  931. #endif // !defined(BOOST_ASIO_HAS_SIGACTION)
  932. // Can use signal().
  933. #if !defined(BOOST_ASIO_HAS_SIGNAL)
  934. # if !defined(BOOST_ASIO_DISABLE_SIGNAL)
  935. # if !defined(UNDER_CE)
  936. # define BOOST_ASIO_HAS_SIGNAL 1
  937. # endif // !defined(UNDER_CE)
  938. # endif // !defined(BOOST_ASIO_DISABLE_SIGNAL)
  939. #endif // !defined(BOOST_ASIO_HAS_SIGNAL)
  940. // Can use getaddrinfo() and getnameinfo().
  941. #if !defined(BOOST_ASIO_HAS_GETADDRINFO)
  942. # if !defined(BOOST_ASIO_DISABLE_GETADDRINFO)
  943. # if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  944. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
  945. # define BOOST_ASIO_HAS_GETADDRINFO 1
  946. # elif defined(UNDER_CE)
  947. # define BOOST_ASIO_HAS_GETADDRINFO 1
  948. # endif // defined(UNDER_CE)
  949. # elif defined(__MACH__) && defined(__APPLE__)
  950. # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  951. # if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
  952. # define BOOST_ASIO_HAS_GETADDRINFO 1
  953. # endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
  954. # else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  955. # define BOOST_ASIO_HAS_GETADDRINFO 1
  956. # endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  957. # else // defined(__MACH__) && defined(__APPLE__)
  958. # define BOOST_ASIO_HAS_GETADDRINFO 1
  959. # endif // defined(__MACH__) && defined(__APPLE__)
  960. # endif // !defined(BOOST_ASIO_DISABLE_GETADDRINFO)
  961. #endif // !defined(BOOST_ASIO_HAS_GETADDRINFO)
  962. // Whether standard iostreams are disabled.
  963. #if !defined(BOOST_ASIO_NO_IOSTREAM)
  964. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
  965. # define BOOST_ASIO_NO_IOSTREAM 1
  966. # endif // !defined(BOOST_NO_IOSTREAM)
  967. #endif // !defined(BOOST_ASIO_NO_IOSTREAM)
  968. // Whether exception handling is disabled.
  969. #if !defined(BOOST_ASIO_NO_EXCEPTIONS)
  970. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
  971. # define BOOST_ASIO_NO_EXCEPTIONS 1
  972. # endif // !defined(BOOST_NO_EXCEPTIONS)
  973. #endif // !defined(BOOST_ASIO_NO_EXCEPTIONS)
  974. // Whether the typeid operator is supported.
  975. #if !defined(BOOST_ASIO_NO_TYPEID)
  976. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
  977. # define BOOST_ASIO_NO_TYPEID 1
  978. # endif // !defined(BOOST_NO_TYPEID)
  979. #endif // !defined(BOOST_ASIO_NO_TYPEID)
  980. // Threads.
  981. #if !defined(BOOST_ASIO_HAS_THREADS)
  982. # if !defined(BOOST_ASIO_DISABLE_THREADS)
  983. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  984. # define BOOST_ASIO_HAS_THREADS 1
  985. # elif defined(__GNUC__) && !defined(__MINGW32__) \
  986. && !defined(linux) && !defined(__linux) && !defined(__linux__)
  987. # define BOOST_ASIO_HAS_THREADS 1
  988. # elif defined(_MT) || defined(__MT__)
  989. # define BOOST_ASIO_HAS_THREADS 1
  990. # elif defined(_REENTRANT)
  991. # define BOOST_ASIO_HAS_THREADS 1
  992. # elif defined(__APPLE__)
  993. # define BOOST_ASIO_HAS_THREADS 1
  994. # elif defined(__HAIKU__)
  995. # define BOOST_ASIO_HAS_THREADS 1
  996. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  997. # define BOOST_ASIO_HAS_THREADS 1
  998. # elif defined(_PTHREADS)
  999. # define BOOST_ASIO_HAS_THREADS 1
  1000. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  1001. # endif // !defined(BOOST_ASIO_DISABLE_THREADS)
  1002. #endif // !defined(BOOST_ASIO_HAS_THREADS)
  1003. // POSIX threads.
  1004. #if !defined(BOOST_ASIO_HAS_PTHREADS)
  1005. # if defined(BOOST_ASIO_HAS_THREADS)
  1006. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  1007. # define BOOST_ASIO_HAS_PTHREADS 1
  1008. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  1009. # define BOOST_ASIO_HAS_PTHREADS 1
  1010. # elif defined(__HAIKU__)
  1011. # define BOOST_ASIO_HAS_PTHREADS 1
  1012. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  1013. # endif // defined(BOOST_ASIO_HAS_THREADS)
  1014. #endif // !defined(BOOST_ASIO_HAS_PTHREADS)
  1015. // Helper to prevent macro expansion.
  1016. #define BOOST_ASIO_PREVENT_MACRO_SUBSTITUTION
  1017. // Helper to define in-class constants.
  1018. #if !defined(BOOST_ASIO_STATIC_CONSTANT)
  1019. # if !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1020. # define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
  1021. BOOST_STATIC_CONSTANT(type, assignment)
  1022. # else // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1023. # define BOOST_ASIO_STATIC_CONSTANT(type, assignment) \
  1024. static const type assignment
  1025. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1026. #endif // !defined(BOOST_ASIO_STATIC_CONSTANT)
  1027. // Boost align library.
  1028. #if !defined(BOOST_ASIO_HAS_BOOST_ALIGN)
  1029. # if !defined(BOOST_ASIO_DISABLE_BOOST_ALIGN)
  1030. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
  1031. # define BOOST_ASIO_HAS_BOOST_ALIGN 1
  1032. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
  1033. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_ALIGN)
  1034. #endif // !defined(BOOST_ASIO_HAS_BOOST_ALIGN)
  1035. // Boost array library.
  1036. #if !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
  1037. # if !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
  1038. # define BOOST_ASIO_HAS_BOOST_ARRAY 1
  1039. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_ARRAY)
  1040. #endif // !defined(BOOST_ASIO_HAS_BOOST_ARRAY)
  1041. // Boost assert macro.
  1042. #if !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
  1043. # if !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
  1044. # define BOOST_ASIO_HAS_BOOST_ASSERT 1
  1045. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_ASSERT)
  1046. #endif // !defined(BOOST_ASIO_HAS_BOOST_ASSERT)
  1047. // Boost limits header.
  1048. #if !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
  1049. # if !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
  1050. # define BOOST_ASIO_HAS_BOOST_LIMITS 1
  1051. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_LIMITS)
  1052. #endif // !defined(BOOST_ASIO_HAS_BOOST_LIMITS)
  1053. // Boost throw_exception function.
  1054. #if !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
  1055. # if !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1056. # define BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION 1
  1057. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1058. #endif // !defined(BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION)
  1059. // Boost regex library.
  1060. #if !defined(BOOST_ASIO_HAS_BOOST_REGEX)
  1061. # if !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
  1062. # define BOOST_ASIO_HAS_BOOST_REGEX 1
  1063. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_REGEX)
  1064. #endif // !defined(BOOST_ASIO_HAS_BOOST_REGEX)
  1065. // Boost bind function.
  1066. #if !defined(BOOST_ASIO_HAS_BOOST_BIND)
  1067. # if !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
  1068. # define BOOST_ASIO_HAS_BOOST_BIND 1
  1069. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_BIND)
  1070. #endif // !defined(BOOST_ASIO_HAS_BOOST_BIND)
  1071. // Boost's BOOST_WORKAROUND macro.
  1072. #if !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
  1073. # if !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
  1074. # define BOOST_ASIO_HAS_BOOST_WORKAROUND 1
  1075. # endif // !defined(BOOST_ASIO_DISABLE_BOOST_WORKAROUND)
  1076. #endif // !defined(BOOST_ASIO_HAS_BOOST_WORKAROUND)
  1077. // Microsoft Visual C++'s secure C runtime library.
  1078. #if !defined(BOOST_ASIO_HAS_SECURE_RTL)
  1079. # if !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
  1080. # if defined(BOOST_ASIO_MSVC) \
  1081. && (BOOST_ASIO_MSVC >= 1400) \
  1082. && !defined(UNDER_CE)
  1083. # define BOOST_ASIO_HAS_SECURE_RTL 1
  1084. # endif // defined(BOOST_ASIO_MSVC)
  1085. // && (BOOST_ASIO_MSVC >= 1400)
  1086. // && !defined(UNDER_CE)
  1087. # endif // !defined(BOOST_ASIO_DISABLE_SECURE_RTL)
  1088. #endif // !defined(BOOST_ASIO_HAS_SECURE_RTL)
  1089. // Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
  1090. #if !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
  1091. # if !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
  1092. # if defined(__GNUC__)
  1093. # if (__GNUC__ >= 3)
  1094. # define BOOST_ASIO_HAS_HANDLER_HOOKS 1
  1095. # endif // (__GNUC__ >= 3)
  1096. # elif !defined(__BORLANDC__) || defined(__clang__)
  1097. # define BOOST_ASIO_HAS_HANDLER_HOOKS 1
  1098. # endif // !defined(__BORLANDC__) || defined(__clang__)
  1099. # endif // !defined(BOOST_ASIO_DISABLE_HANDLER_HOOKS)
  1100. #endif // !defined(BOOST_ASIO_HAS_HANDLER_HOOKS)
  1101. // Support for the __thread keyword extension, or equivalent.
  1102. #if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1103. # if defined(__linux__)
  1104. # if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1105. # if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1106. # if !defined(__INTEL_COMPILER) && !defined(__ICL) \
  1107. && !(defined(__clang__) && defined(__ANDROID__))
  1108. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1109. # define BOOST_ASIO_THREAD_KEYWORD __thread
  1110. # elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1111. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1112. # endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1113. // && !(defined(__clang__) && defined(__ANDROID__))
  1114. # endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1115. # endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1116. # endif // defined(__linux__)
  1117. # if defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
  1118. # if (_MSC_VER >= 1700)
  1119. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1120. # define BOOST_ASIO_THREAD_KEYWORD __declspec(thread)
  1121. # endif // (_MSC_VER >= 1700)
  1122. # endif // defined(BOOST_ASIO_MSVC) && defined(BOOST_ASIO_WINDOWS_RUNTIME)
  1123. # if defined(__APPLE__)
  1124. # if defined(__clang__)
  1125. # if defined(__apple_build_version__)
  1126. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1127. # define BOOST_ASIO_THREAD_KEYWORD __thread
  1128. # endif // defined(__apple_build_version__)
  1129. # endif // defined(__clang__)
  1130. # endif // defined(__APPLE__)
  1131. # if !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
  1132. # if defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  1133. # if !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  1134. # define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1135. # define BOOST_ASIO_THREAD_KEYWORD thread_local
  1136. # endif // !defined(BOOST_NO_CXX11_THREAD_LOCAL)
  1137. # endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG)
  1138. # endif // !defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION)
  1139. #endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1140. #if !defined(BOOST_ASIO_THREAD_KEYWORD)
  1141. # define BOOST_ASIO_THREAD_KEYWORD __thread
  1142. #endif // !defined(BOOST_ASIO_THREAD_KEYWORD)
  1143. // Support for POSIX ssize_t typedef.
  1144. #if !defined(BOOST_ASIO_DISABLE_SSIZE_T)
  1145. # if defined(__linux__) \
  1146. || (defined(__MACH__) && defined(__APPLE__))
  1147. # define BOOST_ASIO_HAS_SSIZE_T 1
  1148. # endif // defined(__linux__)
  1149. // || (defined(__MACH__) && defined(__APPLE__))
  1150. #endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T)
  1151. // Helper macros to manage transition away from error_code return values.
  1152. #if defined(BOOST_ASIO_NO_DEPRECATED)
  1153. # define BOOST_ASIO_SYNC_OP_VOID void
  1154. # define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return
  1155. #else // defined(BOOST_ASIO_NO_DEPRECATED)
  1156. # define BOOST_ASIO_SYNC_OP_VOID boost::system::error_code
  1157. # define BOOST_ASIO_SYNC_OP_VOID_RETURN(e) return e
  1158. #endif // defined(BOOST_ASIO_NO_DEPRECATED)
  1159. // Newer gcc, clang need special treatment to suppress unused typedef warnings.
  1160. #if defined(__clang__)
  1161. # if defined(__apple_build_version__)
  1162. # if (__clang_major__ >= 7)
  1163. # define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1164. # endif // (__clang_major__ >= 7)
  1165. # elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
  1166. || (__clang_major__ > 3)
  1167. # define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1168. # endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
  1169. // || (__clang_major__ > 3)
  1170. #elif defined(__GNUC__)
  1171. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  1172. # define BOOST_ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1173. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  1174. #endif // defined(__GNUC__)
  1175. #if !defined(BOOST_ASIO_UNUSED_TYPEDEF)
  1176. # define BOOST_ASIO_UNUSED_TYPEDEF
  1177. #endif // !defined(BOOST_ASIO_UNUSED_TYPEDEF)
  1178. // Some versions of gcc generate spurious warnings about unused variables.
  1179. #if defined(__GNUC__)
  1180. # if (__GNUC__ >= 4)
  1181. # define BOOST_ASIO_UNUSED_VARIABLE __attribute__((__unused__))
  1182. # endif // (__GNUC__ >= 4)
  1183. #endif // defined(__GNUC__)
  1184. #if !defined(BOOST_ASIO_UNUSED_VARIABLE)
  1185. # define BOOST_ASIO_UNUSED_VARIABLE
  1186. #endif // !defined(BOOST_ASIO_UNUSED_VARIABLE)
  1187. // Helper macro to tell the optimiser what may be assumed to be true.
  1188. #if defined(BOOST_ASIO_MSVC)
  1189. # define BOOST_ASIO_ASSUME(expr) __assume(expr)
  1190. #elif defined(__clang__)
  1191. # if __has_builtin(__builtin_assume)
  1192. # define BOOST_ASIO_ASSUME(expr) __builtin_assume(expr)
  1193. # endif // __has_builtin(__builtin_assume)
  1194. #elif defined(__GNUC__)
  1195. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  1196. # define BOOST_ASIO_ASSUME(expr) if (expr) {} else { __builtin_unreachable(); }
  1197. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  1198. #endif // defined(__GNUC__)
  1199. #if !defined(BOOST_ASIO_ASSUME)
  1200. # define BOOST_ASIO_ASSUME(expr) (void)0
  1201. #endif // !defined(BOOST_ASIO_ASSUME)
  1202. // Support the co_await keyword on compilers known to allow it.
  1203. #if !defined(BOOST_ASIO_HAS_CO_AWAIT)
  1204. # if !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
  1205. # if (__cplusplus >= 202002) \
  1206. && (__cpp_impl_coroutine >= 201902) && (__cpp_lib_coroutine >= 201902)
  1207. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1208. # elif defined(BOOST_ASIO_MSVC)
  1209. # if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) && !defined(__clang__)
  1210. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1211. # elif (_MSC_FULL_VER >= 190023506)
  1212. # if defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
  1213. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1214. # endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
  1215. # endif // (_MSC_FULL_VER >= 190023506)
  1216. # elif defined(__clang__)
  1217. # if (__clang_major__ >= 14)
  1218. # if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
  1219. # if __has_include(<coroutine>)
  1220. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1221. # endif // __has_include(<coroutine>)
  1222. # elif (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1223. # if __has_include(<experimental/coroutine>)
  1224. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1225. # endif // __has_include(<experimental/coroutine>)
  1226. # endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1227. # else // (__clang_major__ >= 14)
  1228. # if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1229. # if __has_include(<experimental/coroutine>)
  1230. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1231. # endif // __has_include(<experimental/coroutine>)
  1232. # endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1233. # endif // (__clang_major__ >= 14)
  1234. # elif defined(__GNUC__)
  1235. # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1236. # if __has_include(<coroutine>)
  1237. # define BOOST_ASIO_HAS_CO_AWAIT 1
  1238. # endif // __has_include(<coroutine>)
  1239. # endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1240. # endif // defined(__GNUC__)
  1241. # endif // !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
  1242. #endif // !defined(BOOST_ASIO_HAS_CO_AWAIT)
  1243. // Standard library support for coroutines.
  1244. #if !defined(BOOST_ASIO_HAS_STD_COROUTINE)
  1245. # if !defined(BOOST_ASIO_DISABLE_STD_COROUTINE)
  1246. # if defined(BOOST_ASIO_MSVC)
  1247. # if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
  1248. # define BOOST_ASIO_HAS_STD_COROUTINE 1
  1249. # endif // (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
  1250. # elif defined(__clang__)
  1251. # if (__clang_major__ >= 14)
  1252. # if (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
  1253. # if __has_include(<coroutine>)
  1254. # define BOOST_ASIO_HAS_STD_COROUTINE 1
  1255. # endif // __has_include(<coroutine>)
  1256. # endif // (__cplusplus >= 202002) && (__cpp_impl_coroutine >= 201902)
  1257. # endif // (__clang_major__ >= 14)
  1258. # elif defined(__GNUC__)
  1259. # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1260. # if __has_include(<coroutine>)
  1261. # define BOOST_ASIO_HAS_STD_COROUTINE 1
  1262. # endif // __has_include(<coroutine>)
  1263. # endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1264. # endif // defined(__GNUC__)
  1265. # endif // !defined(BOOST_ASIO_DISABLE_STD_COROUTINE)
  1266. #endif // !defined(BOOST_ASIO_HAS_STD_COROUTINE)
  1267. // Compiler support for the the [[nodiscard]] attribute.
  1268. #if !defined(BOOST_ASIO_NODISCARD)
  1269. # if defined(__has_cpp_attribute)
  1270. # if __has_cpp_attribute(nodiscard)
  1271. # if (__cplusplus >= 201703)
  1272. # define BOOST_ASIO_NODISCARD [[nodiscard]]
  1273. # endif // (__cplusplus >= 201703)
  1274. # endif // __has_cpp_attribute(nodiscard)
  1275. # endif // defined(__has_cpp_attribute)
  1276. #endif // !defined(BOOST_ASIO_NODISCARD)
  1277. #if !defined(BOOST_ASIO_NODISCARD)
  1278. # define BOOST_ASIO_NODISCARD
  1279. #endif // !defined(BOOST_ASIO_NODISCARD)
  1280. // Kernel support for MSG_NOSIGNAL.
  1281. #if !defined(BOOST_ASIO_HAS_MSG_NOSIGNAL)
  1282. # if defined(__linux__)
  1283. # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1
  1284. # elif defined(_POSIX_VERSION)
  1285. # if (_POSIX_VERSION >= 200809L)
  1286. # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1
  1287. # endif // _POSIX_VERSION >= 200809L
  1288. # endif // defined(_POSIX_VERSION)
  1289. #endif // !defined(BOOST_ASIO_HAS_MSG_NOSIGNAL)
  1290. // Standard library support for std::to_address.
  1291. #if !defined(BOOST_ASIO_HAS_STD_TO_ADDRESS)
  1292. # if !defined(BOOST_ASIO_DISABLE_STD_TO_ADDRESS)
  1293. # if defined(__clang__)
  1294. # if (__cplusplus >= 202002)
  1295. # define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
  1296. # endif // (__cplusplus >= 202002)
  1297. # elif defined(__GNUC__)
  1298. # if (__GNUC__ >= 8)
  1299. # if (__cplusplus >= 202002)
  1300. # define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
  1301. # endif // (__cplusplus >= 202002)
  1302. # endif // (__GNUC__ >= 8)
  1303. # endif // defined(__GNUC__)
  1304. # if defined(BOOST_ASIO_MSVC)
  1305. # if (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
  1306. # define BOOST_ASIO_HAS_STD_TO_ADDRESS 1
  1307. # endif // (_MSC_VER >= 1922) && (_MSVC_LANG >= 202002)
  1308. # endif // defined(BOOST_ASIO_MSVC)
  1309. # endif // !defined(BOOST_ASIO_DISABLE_STD_TO_ADDRESS)
  1310. #endif // !defined(BOOST_ASIO_HAS_STD_TO_ADDRESS)
  1311. // Standard library support for snprintf.
  1312. #if !defined(BOOST_ASIO_HAS_SNPRINTF)
  1313. # if !defined(BOOST_ASIO_DISABLE_SNPRINTF)
  1314. # if defined(__APPLE__)
  1315. # define BOOST_ASIO_HAS_SNPRINTF 1
  1316. # endif // defined(__APPLE__)
  1317. # endif // !defined(BOOST_ASIO_DISABLE_SNPRINTF)
  1318. #endif // !defined(BOOST_ASIO_HAS_SNPRINTF)
  1319. #endif // BOOST_ASIO_DETAIL_CONFIG_HPP