config.hpp 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436
  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