config.hpp 78 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004
  1. //
  2. // detail/config.hpp
  3. // ~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2022 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 ASIO_DETAIL_CONFIG_HPP
  11. #define ASIO_DETAIL_CONFIG_HPP
  12. // boostify: non-boost code starts here
  13. #if !defined(ASIO_STANDALONE)
  14. # if !defined(ASIO_ENABLE_BOOST)
  15. # if (__cplusplus >= 201103)
  16. # define ASIO_STANDALONE 1
  17. # elif defined(_MSC_VER) && defined(_MSVC_LANG)
  18. # if (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
  19. # define ASIO_STANDALONE 1
  20. # endif // (_MSC_VER >= 1900) && (_MSVC_LANG >= 201103)
  21. # endif // defined(_MSC_VER) && defined(_MSVC_LANG)
  22. # endif // !defined(ASIO_ENABLE_BOOST)
  23. #endif // !defined(ASIO_STANDALONE)
  24. // boostify: non-boost code ends here
  25. #if defined(ASIO_STANDALONE)
  26. # define ASIO_DISABLE_BOOST_ALIGN 1
  27. # define ASIO_DISABLE_BOOST_ARRAY 1
  28. # define ASIO_DISABLE_BOOST_ASSERT 1
  29. # define ASIO_DISABLE_BOOST_BIND 1
  30. # define ASIO_DISABLE_BOOST_CHRONO 1
  31. # define ASIO_DISABLE_BOOST_DATE_TIME 1
  32. # define ASIO_DISABLE_BOOST_LIMITS 1
  33. # define ASIO_DISABLE_BOOST_REGEX 1
  34. # define ASIO_DISABLE_BOOST_STATIC_CONSTANT 1
  35. # define ASIO_DISABLE_BOOST_THROW_EXCEPTION 1
  36. # define ASIO_DISABLE_BOOST_WORKAROUND 1
  37. #else // defined(ASIO_STANDALONE)
  38. # include <boost/config.hpp>
  39. # include <boost/version.hpp>
  40. # define ASIO_HAS_BOOST_CONFIG 1
  41. #endif // defined(ASIO_STANDALONE)
  42. // Default to a header-only implementation. The user must specifically request
  43. // separate compilation by defining either ASIO_SEPARATE_COMPILATION or
  44. // ASIO_DYN_LINK (as a DLL/shared library implies separate compilation).
  45. #if !defined(ASIO_HEADER_ONLY)
  46. # if !defined(ASIO_SEPARATE_COMPILATION)
  47. # if !defined(ASIO_DYN_LINK)
  48. # define ASIO_HEADER_ONLY 1
  49. # endif // !defined(ASIO_DYN_LINK)
  50. # endif // !defined(ASIO_SEPARATE_COMPILATION)
  51. #endif // !defined(ASIO_HEADER_ONLY)
  52. #if defined(ASIO_HEADER_ONLY)
  53. # define ASIO_DECL inline
  54. #else // defined(ASIO_HEADER_ONLY)
  55. # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
  56. // We need to import/export our code only if the user has specifically asked
  57. // for it by defining ASIO_DYN_LINK.
  58. # if defined(ASIO_DYN_LINK)
  59. // Export if this is our own source, otherwise import.
  60. # if defined(ASIO_SOURCE)
  61. # define ASIO_DECL __declspec(dllexport)
  62. # else // defined(ASIO_SOURCE)
  63. # define ASIO_DECL __declspec(dllimport)
  64. # endif // defined(ASIO_SOURCE)
  65. # endif // defined(ASIO_DYN_LINK)
  66. # endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
  67. #endif // defined(ASIO_HEADER_ONLY)
  68. // If ASIO_DECL isn't defined yet define it now.
  69. #if !defined(ASIO_DECL)
  70. # define ASIO_DECL
  71. #endif // !defined(ASIO_DECL)
  72. // Helper macro for documentation.
  73. #define ASIO_UNSPECIFIED(e) e
  74. // Microsoft Visual C++ detection.
  75. #if !defined(ASIO_MSVC)
  76. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
  77. # define ASIO_MSVC BOOST_MSVC
  78. # elif defined(_MSC_VER) && (defined(__INTELLISENSE__) \
  79. || (!defined(__MWERKS__) && !defined(__EDG_VERSION__)))
  80. # define ASIO_MSVC _MSC_VER
  81. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
  82. #endif // !defined(ASIO_MSVC)
  83. // Clang / libc++ detection.
  84. #if defined(__clang__)
  85. # if (__cplusplus >= 201103)
  86. # if __has_include(<__config>)
  87. # include <__config>
  88. # if defined(_LIBCPP_VERSION)
  89. # define ASIO_HAS_CLANG_LIBCXX 1
  90. # endif // defined(_LIBCPP_VERSION)
  91. # endif // __has_include(<__config>)
  92. # endif // (__cplusplus >= 201103)
  93. #endif // defined(__clang__)
  94. // Android platform detection.
  95. #if defined(__ANDROID__)
  96. # include <android/api-level.h>
  97. #endif // defined(__ANDROID__)
  98. // Support move construction and assignment on compilers known to allow it.
  99. #if !defined(ASIO_HAS_MOVE)
  100. # if !defined(ASIO_DISABLE_MOVE)
  101. # if defined(__clang__)
  102. # if __has_feature(__cxx_rvalue_references__)
  103. # define ASIO_HAS_MOVE 1
  104. # endif // __has_feature(__cxx_rvalue_references__)
  105. # elif defined(__GNUC__)
  106. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  107. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  108. # define ASIO_HAS_MOVE 1
  109. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  110. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  111. # endif // defined(__GNUC__)
  112. # if defined(ASIO_MSVC)
  113. # if (_MSC_VER >= 1700)
  114. # define ASIO_HAS_MOVE 1
  115. # endif // (_MSC_VER >= 1700)
  116. # endif // defined(ASIO_MSVC)
  117. # if defined(__INTEL_CXX11_MODE__)
  118. # if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
  119. # define ASIO_HAS_MOVE 1
  120. # endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
  121. # if defined(__ICL) && (__ICL >= 1500)
  122. # define ASIO_HAS_MOVE 1
  123. # endif // defined(__ICL) && (__ICL >= 1500)
  124. # endif // defined(__INTEL_CXX11_MODE__)
  125. # endif // !defined(ASIO_DISABLE_MOVE)
  126. #endif // !defined(ASIO_HAS_MOVE)
  127. // If ASIO_MOVE_CAST isn't defined, and move support is available, define
  128. // * ASIO_MOVE_ARG,
  129. // * ASIO_NONDEDUCED_MOVE_ARG, and
  130. // * ASIO_MOVE_CAST
  131. // to take advantage of rvalue references and perfect forwarding.
  132. #if defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
  133. # define ASIO_MOVE_ARG(type) type&&
  134. # define ASIO_MOVE_ARG2(type1, type2) type1, type2&&
  135. # define ASIO_NONDEDUCED_MOVE_ARG(type) type&
  136. # define ASIO_MOVE_CAST(type) static_cast<type&&>
  137. # define ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
  138. # define ASIO_MOVE_OR_LVALUE(type) static_cast<type&&>
  139. # define ASIO_MOVE_OR_LVALUE_TYPE(type) type
  140. #endif // defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
  141. // If ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible
  142. // implementation. Note that older g++ and MSVC versions don't like it when you
  143. // pass a non-member function through a const reference, so for most compilers
  144. // we'll play it safe and stick with the old approach of passing the handler by
  145. // value.
  146. #if !defined(ASIO_MOVE_CAST)
  147. # if defined(__GNUC__)
  148. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  149. # define ASIO_MOVE_ARG(type) const type&
  150. # else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  151. # define ASIO_MOVE_ARG(type) type
  152. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  153. # elif defined(ASIO_MSVC)
  154. # if (_MSC_VER >= 1400)
  155. # define ASIO_MOVE_ARG(type) const type&
  156. # else // (_MSC_VER >= 1400)
  157. # define ASIO_MOVE_ARG(type) type
  158. # endif // (_MSC_VER >= 1400)
  159. # else
  160. # define ASIO_MOVE_ARG(type) type
  161. # endif
  162. # define ASIO_NONDEDUCED_MOVE_ARG(type) const type&
  163. # define ASIO_MOVE_CAST(type) static_cast<const type&>
  164. # define ASIO_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
  165. # define ASIO_MOVE_OR_LVALUE(type)
  166. # define ASIO_MOVE_OR_LVALUE_TYPE(type) type&
  167. #endif // !defined(ASIO_MOVE_CAST)
  168. // Support variadic templates on compilers known to allow it.
  169. #if !defined(ASIO_HAS_VARIADIC_TEMPLATES)
  170. # if !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
  171. # if defined(__clang__)
  172. # if __has_feature(__cxx_variadic_templates__)
  173. # define ASIO_HAS_VARIADIC_TEMPLATES 1
  174. # endif // __has_feature(__cxx_variadic_templates__)
  175. # elif defined(__GNUC__)
  176. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  177. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  178. # define ASIO_HAS_VARIADIC_TEMPLATES 1
  179. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  180. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  181. # endif // defined(__GNUC__)
  182. # if defined(ASIO_MSVC)
  183. # if (_MSC_VER >= 1900)
  184. # define ASIO_HAS_VARIADIC_TEMPLATES 1
  185. # endif // (_MSC_VER >= 1900)
  186. # endif // defined(ASIO_MSVC)
  187. # endif // !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
  188. #endif // !defined(ASIO_HAS_VARIADIC_TEMPLATES)
  189. #if !defined(ASIO_ELLIPSIS)
  190. # if defined(ASIO_HAS_VARIADIC_TEMPLATES)
  191. # define ASIO_ELLIPSIS ...
  192. # else // defined(ASIO_HAS_VARIADIC_TEMPLATES)
  193. # define ASIO_ELLIPSIS
  194. # endif // defined(ASIO_HAS_VARIADIC_TEMPLATES)
  195. #endif // !defined(ASIO_ELLIPSIS)
  196. // Support deleted functions on compilers known to allow it.
  197. #if !defined(ASIO_DELETED)
  198. # if defined(__clang__)
  199. # if __has_feature(__cxx_deleted_functions__)
  200. # define ASIO_DELETED = delete
  201. # endif // __has_feature(__cxx_deleted_functions__)
  202. # elif defined(__GNUC__)
  203. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  204. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  205. # define ASIO_DELETED = delete
  206. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  207. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  208. # endif // defined(__GNUC__)
  209. # if defined(ASIO_MSVC)
  210. # if (_MSC_VER >= 1900)
  211. # define ASIO_DELETED = delete
  212. # endif // (_MSC_VER >= 1900)
  213. # endif // defined(ASIO_MSVC)
  214. # if !defined(ASIO_DELETED)
  215. # define ASIO_DELETED
  216. # endif // !defined(ASIO_DELETED)
  217. #endif // !defined(ASIO_DELETED)
  218. // Support constexpr on compilers known to allow it.
  219. #if !defined(ASIO_HAS_CONSTEXPR)
  220. # if !defined(ASIO_DISABLE_CONSTEXPR)
  221. # if defined(__clang__)
  222. # if __has_feature(__cxx_constexpr__)
  223. # define ASIO_HAS_CONSTEXPR 1
  224. # endif // __has_feature(__cxx_constexpr__)
  225. # elif defined(__GNUC__)
  226. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  227. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  228. # define ASIO_HAS_CONSTEXPR 1
  229. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  230. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  231. # endif // defined(__GNUC__)
  232. # if defined(ASIO_MSVC)
  233. # if (_MSC_VER >= 1900)
  234. # define ASIO_HAS_CONSTEXPR 1
  235. # endif // (_MSC_VER >= 1900)
  236. # endif // defined(ASIO_MSVC)
  237. # endif // !defined(ASIO_DISABLE_CONSTEXPR)
  238. #endif // !defined(ASIO_HAS_CONSTEXPR)
  239. #if !defined(ASIO_CONSTEXPR)
  240. # if defined(ASIO_HAS_CONSTEXPR)
  241. # define ASIO_CONSTEXPR constexpr
  242. # else // defined(ASIO_HAS_CONSTEXPR)
  243. # define ASIO_CONSTEXPR
  244. # endif // defined(ASIO_HAS_CONSTEXPR)
  245. #endif // !defined(ASIO_CONSTEXPR)
  246. #if !defined(ASIO_STATIC_CONSTEXPR)
  247. # if defined(ASIO_HAS_CONSTEXPR)
  248. # define ASIO_STATIC_CONSTEXPR(type, assignment) \
  249. static constexpr type assignment
  250. # else // defined(ASIO_HAS_CONSTEXPR)
  251. # define ASIO_STATIC_CONSTEXPR(type, assignment) \
  252. static const type assignment
  253. # endif // defined(ASIO_HAS_CONSTEXPR)
  254. #endif // !defined(ASIO_STATIC_CONSTEXPR)
  255. #if !defined(ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
  256. # if defined(ASIO_HAS_CONSTEXPR)
  257. # if defined(__GNUC__)
  258. # if (__GNUC__ >= 8)
  259. # define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  260. static constexpr const type name{}
  261. # else // (__GNUC__ >= 8)
  262. # define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  263. static const type name
  264. # endif // (__GNUC__ >= 8)
  265. # elif defined(ASIO_MSVC)
  266. # define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  267. static const type name
  268. # else // defined(ASIO_MSVC)
  269. # define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  270. static constexpr const type name{}
  271. # endif // defined(ASIO_MSVC)
  272. # else // defined(ASIO_HAS_CONSTEXPR)
  273. # define ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(type, name) \
  274. static const type name
  275. # endif // defined(ASIO_HAS_CONSTEXPR)
  276. #endif // !defined(ASIO_STATIC_CONSTEXPR_DEFAULT_INIT)
  277. // Support noexcept on compilers known to allow it.
  278. #if !defined(ASIO_HAS_NOEXCEPT)
  279. # if !defined(ASIO_DISABLE_NOEXCEPT)
  280. # if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
  281. # if !defined(BOOST_NO_NOEXCEPT)
  282. # define ASIO_HAS_NOEXCEPT 1
  283. # endif // !defined(BOOST_NO_NOEXCEPT)
  284. # define ASIO_NOEXCEPT BOOST_NOEXCEPT
  285. # define ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW
  286. # define ASIO_NOEXCEPT_IF(c) BOOST_NOEXCEPT_IF(c)
  287. # elif defined(__clang__)
  288. # if __has_feature(__cxx_noexcept__)
  289. # define ASIO_HAS_NOEXCEPT 1
  290. # endif // __has_feature(__cxx_noexcept__)
  291. # elif defined(__GNUC__)
  292. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  293. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  294. # define ASIO_HAS_NOEXCEPT 1
  295. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  296. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  297. # elif defined(ASIO_MSVC)
  298. # if (_MSC_VER >= 1900)
  299. # define ASIO_HAS_NOEXCEPT 1
  300. # endif // (_MSC_VER >= 1900)
  301. # endif // defined(ASIO_MSVC)
  302. # endif // !defined(ASIO_DISABLE_NOEXCEPT)
  303. # if !defined(ASIO_NOEXCEPT)
  304. # endif // !defined(ASIO_NOEXCEPT)
  305. # if !defined(ASIO_NOEXCEPT_OR_NOTHROW)
  306. # endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW)
  307. #endif // !defined(ASIO_HAS_NOEXCEPT)
  308. #if !defined(ASIO_NOEXCEPT)
  309. # if defined(ASIO_HAS_NOEXCEPT)
  310. # define ASIO_NOEXCEPT noexcept(true)
  311. # else // defined(ASIO_HAS_NOEXCEPT)
  312. # define ASIO_NOEXCEPT
  313. # endif // defined(ASIO_HAS_NOEXCEPT)
  314. #endif // !defined(ASIO_NOEXCEPT)
  315. #if !defined(ASIO_NOEXCEPT_OR_NOTHROW)
  316. # if defined(ASIO_HAS_NOEXCEPT)
  317. # define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
  318. # else // defined(ASIO_HAS_NOEXCEPT)
  319. # define ASIO_NOEXCEPT_OR_NOTHROW throw()
  320. # endif // defined(ASIO_HAS_NOEXCEPT)
  321. #endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW)
  322. #if !defined(ASIO_NOEXCEPT_IF)
  323. # if defined(ASIO_HAS_NOEXCEPT)
  324. # define ASIO_NOEXCEPT_IF(c) noexcept(c)
  325. # else // defined(ASIO_HAS_NOEXCEPT)
  326. # define ASIO_NOEXCEPT_IF(c)
  327. # endif // defined(ASIO_HAS_NOEXCEPT)
  328. #endif // !defined(ASIO_NOEXCEPT_IF)
  329. // Support noexcept on function types on compilers known to allow it.
  330. #if !defined(ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
  331. # if !defined(ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
  332. # if defined(__clang__)
  333. # if (__cplusplus >= 202002)
  334. # define ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
  335. # endif // (__cplusplus >= 202002)
  336. # elif defined(__GNUC__)
  337. # if (__cplusplus >= 202002)
  338. # define ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
  339. # endif // (__cplusplus >= 202002)
  340. # elif defined(ASIO_MSVC)
  341. # if (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
  342. # define ASIO_HAS_NOEXCEPT_FUNCTION_TYPE 1
  343. # endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 202002)
  344. # endif // defined(ASIO_MSVC)
  345. # endif // !defined(ASIO_DISABLE_NOEXCEPT_FUNCTION_TYPE)
  346. #endif // !defined(ASIO_HAS_NOEXCEPT_FUNCTION_TYPE)
  347. // Support automatic type deduction on compilers known to support it.
  348. #if !defined(ASIO_HAS_DECLTYPE)
  349. # if !defined(ASIO_DISABLE_DECLTYPE)
  350. # if defined(__clang__)
  351. # if __has_feature(__cxx_decltype__)
  352. # define ASIO_HAS_DECLTYPE 1
  353. # endif // __has_feature(__cxx_decltype__)
  354. # elif defined(__GNUC__)
  355. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  356. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  357. # define ASIO_HAS_DECLTYPE 1
  358. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  359. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  360. # endif // defined(__GNUC__)
  361. # if defined(ASIO_MSVC)
  362. # if (_MSC_VER >= 1800)
  363. # define ASIO_HAS_DECLTYPE 1
  364. # endif // (_MSC_VER >= 1800)
  365. # endif // defined(ASIO_MSVC)
  366. # endif // !defined(ASIO_DISABLE_DECLTYPE)
  367. #endif // !defined(ASIO_HAS_DECLTYPE)
  368. // Support alias templates on compilers known to allow it.
  369. #if !defined(ASIO_HAS_ALIAS_TEMPLATES)
  370. # if !defined(ASIO_DISABLE_ALIAS_TEMPLATES)
  371. # if defined(__clang__)
  372. # if __has_feature(__cxx_alias_templates__)
  373. # define ASIO_HAS_ALIAS_TEMPLATES 1
  374. # endif // __has_feature(__cxx_alias_templates__)
  375. # elif defined(__GNUC__)
  376. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  377. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  378. # define ASIO_HAS_ALIAS_TEMPLATES 1
  379. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  380. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  381. # endif // defined(__GNUC__)
  382. # if defined(ASIO_MSVC)
  383. # if (_MSC_VER >= 1900)
  384. # define ASIO_HAS_ALIAS_TEMPLATES 1
  385. # endif // (_MSC_VER >= 1900)
  386. # endif // defined(ASIO_MSVC)
  387. # endif // !defined(ASIO_DISABLE_ALIAS_TEMPLATES)
  388. #endif // !defined(ASIO_HAS_ALIAS_TEMPLATES)
  389. // Support return type deduction on compilers known to allow it.
  390. #if !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
  391. # if !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
  392. # if defined(__clang__)
  393. # if __has_feature(__cxx_return_type_deduction__)
  394. # define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
  395. # endif // __has_feature(__cxx_return_type_deduction__)
  396. # elif (__cplusplus >= 201402)
  397. # define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
  398. # elif defined(__cpp_return_type_deduction)
  399. # if (__cpp_return_type_deduction >= 201304)
  400. # define ASIO_HAS_RETURN_TYPE_DEDUCTION 1
  401. # endif // (__cpp_return_type_deduction >= 201304)
  402. # endif // defined(__cpp_return_type_deduction)
  403. # endif // !defined(ASIO_DISABLE_RETURN_TYPE_DEDUCTION)
  404. #endif // !defined(ASIO_HAS_RETURN_TYPE_DEDUCTION)
  405. // Support default function template arguments on compilers known to allow it.
  406. #if !defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
  407. # if !defined(ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
  408. # if (__cplusplus >= 201103)
  409. # define ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS 1
  410. # elif defined(ASIO_MSVC)
  411. # if (_MSC_VER >= 1900 && _MSVC_LANG >= 201103)
  412. # define ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS 1
  413. # endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201103)
  414. # endif // defined(ASIO_MSVC)
  415. # endif // !defined(ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
  416. #endif // !defined(ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS)
  417. // Support enum classes on compilers known to allow them.
  418. #if !defined(ASIO_HAS_ENUM_CLASS)
  419. # if !defined(ASIO_DISABLE_ENUM_CLASS)
  420. # if (__cplusplus >= 201103)
  421. # define ASIO_HAS_ENUM_CLASS 1
  422. # elif defined(ASIO_MSVC)
  423. # if (_MSC_VER >= 1900 && _MSVC_LANG >= 201103)
  424. # define ASIO_HAS_ENUM_CLASS 1
  425. # endif // (_MSC_VER >= 1900 && _MSVC_LANG >= 201103)
  426. # endif // defined(ASIO_MSVC)
  427. # endif // !defined(ASIO_DISABLE_ENUM_CLASS)
  428. #endif // !defined(ASIO_HAS_ENUM_CLASS)
  429. // Support concepts on compilers known to allow them.
  430. #if !defined(ASIO_HAS_CONCEPTS)
  431. # if !defined(ASIO_DISABLE_CONCEPTS)
  432. # if defined(__cpp_concepts)
  433. # define ASIO_HAS_CONCEPTS 1
  434. # if (__cpp_concepts >= 201707)
  435. # define ASIO_CONCEPT concept
  436. # else // (__cpp_concepts >= 201707)
  437. # define ASIO_CONCEPT concept bool
  438. # endif // (__cpp_concepts >= 201707)
  439. # endif // defined(__cpp_concepts)
  440. # endif // !defined(ASIO_DISABLE_CONCEPTS)
  441. #endif // !defined(ASIO_HAS_CONCEPTS)
  442. // Support template variables on compilers known to allow it.
  443. #if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
  444. # if !defined(ASIO_DISABLE_VARIABLE_TEMPLATES)
  445. # if defined(__clang__)
  446. # if (__cplusplus >= 201402)
  447. # if __has_feature(__cxx_variable_templates__)
  448. # define ASIO_HAS_VARIABLE_TEMPLATES 1
  449. # endif // __has_feature(__cxx_variable_templates__)
  450. # endif // (__cplusplus >= 201402)
  451. # elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
  452. # if (__GNUC__ >= 6)
  453. # if (__cplusplus >= 201402)
  454. # define ASIO_HAS_VARIABLE_TEMPLATES 1
  455. # endif // (__cplusplus >= 201402)
  456. # endif // (__GNUC__ >= 6)
  457. # endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
  458. # if defined(ASIO_MSVC)
  459. # if (_MSC_VER >= 1901)
  460. # define ASIO_HAS_VARIABLE_TEMPLATES 1
  461. # endif // (_MSC_VER >= 1901)
  462. # endif // defined(ASIO_MSVC)
  463. # endif // !defined(ASIO_DISABLE_VARIABLE_TEMPLATES)
  464. #endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
  465. // Support SFINAEd template variables on compilers known to allow it.
  466. #if !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  467. # if !defined(ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
  468. # if defined(__clang__)
  469. # if (__cplusplus >= 201703)
  470. # if __has_feature(__cxx_variable_templates__)
  471. # define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
  472. # endif // __has_feature(__cxx_variable_templates__)
  473. # endif // (__cplusplus >= 201703)
  474. # elif defined(__GNUC__)
  475. # if ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
  476. # if (__cplusplus >= 201402)
  477. # define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
  478. # endif // (__cplusplus >= 201402)
  479. # endif // ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 8)
  480. # endif // defined(__GNUC__)
  481. # if defined(ASIO_MSVC)
  482. # if (_MSC_VER >= 1901)
  483. # define ASIO_HAS_SFINAE_VARIABLE_TEMPLATES 1
  484. # endif // (_MSC_VER >= 1901)
  485. # endif // defined(ASIO_MSVC)
  486. # endif // !defined(ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES)
  487. #endif // !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  488. // Support SFINAE use of constant expressions on compilers known to allow it.
  489. #if !defined(ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
  490. # if !defined(ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
  491. # if defined(__clang__)
  492. # if (__cplusplus >= 201402)
  493. # define ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
  494. # endif // (__cplusplus >= 201402)
  495. # elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
  496. # if (__GNUC__ >= 7)
  497. # if (__cplusplus >= 201402)
  498. # define ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
  499. # endif // (__cplusplus >= 201402)
  500. # endif // (__GNUC__ >= 7)
  501. # endif // defined(__GNUC__) && !defined(__INTEL_COMPILER)
  502. # if defined(ASIO_MSVC)
  503. # if (_MSC_VER >= 1901)
  504. # define ASIO_HAS_CONSTANT_EXPRESSION_SFINAE 1
  505. # endif // (_MSC_VER >= 1901)
  506. # endif // defined(ASIO_MSVC)
  507. # endif // !defined(ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE)
  508. #endif // !defined(ASIO_HAS_CONSTANT_EXPRESSION_SFINAE)
  509. // Enable workarounds for lack of working expression SFINAE.
  510. #if !defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
  511. # if !defined(ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
  512. # if !defined(ASIO_MSVC) && !defined(__INTEL_COMPILER)
  513. # if (__cplusplus >= 201103)
  514. # define ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
  515. # endif // (__cplusplus >= 201103)
  516. # elif defined(ASIO_MSVC) && (_MSC_VER >= 1929)
  517. # if (_MSVC_LANG >= 202000)
  518. # define ASIO_HAS_WORKING_EXPRESSION_SFINAE 1
  519. # endif // (_MSVC_LANG >= 202000)
  520. # endif // defined(ASIO_MSVC) && (_MSC_VER >= 1929)
  521. # endif // !defined(ASIO_DISABLE_WORKING_EXPRESSION_SFINAE)
  522. #endif // !defined(ASIO_HAS_WORKING_EXPRESSION_SFINAE)
  523. // Support ref-qualified functions on compilers known to allow it.
  524. #if !defined(ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
  525. # if !defined(ASIO_DISABLE_REF_QUALIFIED_FUNCTIONS)
  526. # if defined(__clang__)
  527. # if __has_feature(__cxx_reference_qualified_functions__)
  528. # define ASIO_HAS_REF_QUALIFIED_FUNCTIONS 1
  529. # endif // __has_feature(__cxx_reference_qualified_functions__)
  530. # elif defined(__GNUC__)
  531. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  532. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  533. # define ASIO_HAS_REF_QUALIFIED_FUNCTIONS 1
  534. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  535. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  536. # endif // defined(__GNUC__)
  537. # if defined(ASIO_MSVC)
  538. # if (_MSC_VER >= 1900)
  539. # define ASIO_HAS_REF_QUALIFIED_FUNCTIONS 1
  540. # endif // (_MSC_VER >= 1900)
  541. # endif // defined(ASIO_MSVC)
  542. # endif // !defined(ASIO_DISABLE_REF_QUALIFIED_FUNCTIONS)
  543. #endif // !defined(ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
  544. #if defined(ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
  545. # if !defined(ASIO_LVALUE_REF_QUAL)
  546. # define ASIO_LVALUE_REF_QUAL &
  547. # endif // !defined(ASIO_LVALUE_REF_QUAL)
  548. # if !defined(ASIO_RVALUE_REF_QUAL)
  549. # define ASIO_RVALUE_REF_QUAL &&
  550. # endif // !defined(ASIO_RVALUE_REF_QUAL)
  551. #else // defined(ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
  552. # if !defined(ASIO_LVALUE_REF_QUAL)
  553. # define ASIO_LVALUE_REF_QUAL
  554. # endif // !defined(ASIO_LVALUE_REF_QUAL)
  555. # if !defined(ASIO_RVALUE_REF_QUAL)
  556. # define ASIO_RVALUE_REF_QUAL
  557. # endif // !defined(ASIO_RVALUE_REF_QUAL)
  558. #endif // defined(ASIO_HAS_REF_QUALIFIED_FUNCTIONS)
  559. // Support for the alignof operator.
  560. #if !defined(ASIO_HAS_ALIGNOF)
  561. # if !defined(ASIO_DISABLE_ALIGNOF)
  562. # if (__cplusplus >= 201103)
  563. # define ASIO_HAS_ALIGNOF 1
  564. # endif // (__cplusplus >= 201103)
  565. # endif // !defined(ASIO_DISABLE_ALIGNOF)
  566. #endif // !defined(ASIO_HAS_ALIGNOF)
  567. #if defined(ASIO_HAS_ALIGNOF)
  568. # define ASIO_ALIGNOF(T) alignof(T)
  569. # if defined(__STDCPP_DEFAULT_NEW_ALIGNMENT__)
  570. # define ASIO_DEFAULT_ALIGN __STDCPP_DEFAULT_NEW_ALIGNMENT__
  571. # elif defined(__GNUC__)
  572. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  573. # define ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
  574. # else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  575. # define ASIO_DEFAULT_ALIGN alignof(max_align_t)
  576. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  577. # else // defined(__GNUC__)
  578. # define ASIO_DEFAULT_ALIGN alignof(std::max_align_t)
  579. # endif // defined(__GNUC__)
  580. #else // defined(ASIO_HAS_ALIGNOF)
  581. # define ASIO_ALIGNOF(T) 1
  582. # define ASIO_DEFAULT_ALIGN 1
  583. #endif // defined(ASIO_HAS_ALIGNOF)
  584. // Standard library support for aligned allocation.
  585. #if !defined(ASIO_HAS_STD_ALIGNED_ALLOC)
  586. # if !defined(ASIO_DISABLE_STD_ALIGNED_ALLOC)
  587. # if (__cplusplus >= 201703)
  588. # if defined(__clang__)
  589. # if defined(ASIO_HAS_CLANG_LIBCXX)
  590. # if (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC) \
  591. && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__)
  592. # define ASIO_HAS_STD_ALIGNED_ALLOC 1
  593. # endif // (_LIBCPP_STD_VER > 14) && defined(_LIBCPP_HAS_ALIGNED_ALLOC)
  594. // && !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__)
  595. # elif defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  596. # define ASIO_HAS_STD_ALIGNED_ALLOC 1
  597. # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  598. # elif defined(__GNUC__)
  599. # if defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  600. # define ASIO_HAS_STD_ALIGNED_ALLOC 1
  601. # endif // defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)
  602. # endif // defined(__GNUC__)
  603. # endif // (__cplusplus >= 201703)
  604. # endif // !defined(ASIO_DISABLE_STD_ALIGNED_ALLOC)
  605. #endif // !defined(ASIO_HAS_STD_ALIGNED_ALLOC)
  606. // Standard library support for system errors.
  607. #if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
  608. # if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
  609. # if defined(__clang__)
  610. # if defined(ASIO_HAS_CLANG_LIBCXX)
  611. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  612. # elif (__cplusplus >= 201103)
  613. # if __has_include(<system_error>)
  614. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  615. # endif // __has_include(<system_error>)
  616. # endif // (__cplusplus >= 201103)
  617. # elif defined(__GNUC__)
  618. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  619. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  620. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  621. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  622. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  623. # endif // defined(__GNUC__)
  624. # if defined(ASIO_MSVC)
  625. # if (_MSC_VER >= 1700)
  626. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  627. # endif // (_MSC_VER >= 1700)
  628. # endif // defined(ASIO_MSVC)
  629. # endif // !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
  630. #endif // !defined(ASIO_HAS_STD_SYSTEM_ERROR)
  631. // Compliant C++11 compilers put noexcept specifiers on error_category members.
  632. #if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  633. # if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
  634. # define ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
  635. # elif defined(__clang__)
  636. # if __has_feature(__cxx_noexcept__)
  637. # define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
  638. # endif // __has_feature(__cxx_noexcept__)
  639. # elif defined(__GNUC__)
  640. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  641. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  642. # define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
  643. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  644. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  645. # elif defined(ASIO_MSVC)
  646. # if (_MSC_VER >= 1900)
  647. # define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
  648. # endif // (_MSC_VER >= 1900)
  649. # endif // defined(ASIO_MSVC)
  650. # if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  651. # define ASIO_ERROR_CATEGORY_NOEXCEPT
  652. # endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  653. #endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  654. // Standard library support for arrays.
  655. #if !defined(ASIO_HAS_STD_ARRAY)
  656. # if !defined(ASIO_DISABLE_STD_ARRAY)
  657. # if defined(__clang__)
  658. # if defined(ASIO_HAS_CLANG_LIBCXX)
  659. # define ASIO_HAS_STD_ARRAY 1
  660. # elif (__cplusplus >= 201103)
  661. # if __has_include(<array>)
  662. # define ASIO_HAS_STD_ARRAY 1
  663. # endif // __has_include(<array>)
  664. # endif // (__cplusplus >= 201103)
  665. # elif defined(__GNUC__)
  666. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  667. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  668. # define ASIO_HAS_STD_ARRAY 1
  669. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  670. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  671. # endif // defined(__GNUC__)
  672. # if defined(ASIO_MSVC)
  673. # if (_MSC_VER >= 1600)
  674. # define ASIO_HAS_STD_ARRAY 1
  675. # endif // (_MSC_VER >= 1600)
  676. # endif // defined(ASIO_MSVC)
  677. # endif // !defined(ASIO_DISABLE_STD_ARRAY)
  678. #endif // !defined(ASIO_HAS_STD_ARRAY)
  679. // Standard library support for shared_ptr and weak_ptr.
  680. #if !defined(ASIO_HAS_STD_SHARED_PTR)
  681. # if !defined(ASIO_DISABLE_STD_SHARED_PTR)
  682. # if defined(__clang__)
  683. # if defined(ASIO_HAS_CLANG_LIBCXX)
  684. # define ASIO_HAS_STD_SHARED_PTR 1
  685. # elif (__cplusplus >= 201103)
  686. # define ASIO_HAS_STD_SHARED_PTR 1
  687. # endif // (__cplusplus >= 201103)
  688. # elif defined(__GNUC__)
  689. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  690. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  691. # define ASIO_HAS_STD_SHARED_PTR 1
  692. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  693. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  694. # endif // defined(__GNUC__)
  695. # if defined(ASIO_MSVC)
  696. # if (_MSC_VER >= 1600)
  697. # define ASIO_HAS_STD_SHARED_PTR 1
  698. # endif // (_MSC_VER >= 1600)
  699. # endif // defined(ASIO_MSVC)
  700. # endif // !defined(ASIO_DISABLE_STD_SHARED_PTR)
  701. #endif // !defined(ASIO_HAS_STD_SHARED_PTR)
  702. // Standard library support for allocator_arg_t.
  703. #if !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
  704. # if !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
  705. # if defined(__clang__)
  706. # if defined(ASIO_HAS_CLANG_LIBCXX)
  707. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  708. # elif (__cplusplus >= 201103)
  709. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  710. # endif // (__cplusplus >= 201103)
  711. # elif defined(__GNUC__)
  712. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  713. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  714. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  715. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  716. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  717. # endif // defined(__GNUC__)
  718. # if defined(ASIO_MSVC)
  719. # if (_MSC_VER >= 1600)
  720. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  721. # endif // (_MSC_VER >= 1600)
  722. # endif // defined(ASIO_MSVC)
  723. # endif // !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
  724. #endif // !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
  725. // Standard library support for atomic operations.
  726. #if !defined(ASIO_HAS_STD_ATOMIC)
  727. # if !defined(ASIO_DISABLE_STD_ATOMIC)
  728. # if defined(__clang__)
  729. # if defined(ASIO_HAS_CLANG_LIBCXX)
  730. # define ASIO_HAS_STD_ATOMIC 1
  731. # elif (__cplusplus >= 201103)
  732. # if __has_include(<atomic>)
  733. # define ASIO_HAS_STD_ATOMIC 1
  734. # endif // __has_include(<atomic>)
  735. # elif defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
  736. # if (__clang_major__ >= 10)
  737. # if __has_include(<atomic>)
  738. # define ASIO_HAS_STD_ATOMIC 1
  739. # endif // __has_include(<atomic>)
  740. # endif // (__clang_major__ >= 10)
  741. # endif // defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
  742. # elif defined(__GNUC__)
  743. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  744. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  745. # define ASIO_HAS_STD_ATOMIC 1
  746. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  747. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  748. # endif // defined(__GNUC__)
  749. # if defined(ASIO_MSVC)
  750. # if (_MSC_VER >= 1700)
  751. # define ASIO_HAS_STD_ATOMIC 1
  752. # endif // (_MSC_VER >= 1700)
  753. # endif // defined(ASIO_MSVC)
  754. # endif // !defined(ASIO_DISABLE_STD_ATOMIC)
  755. #endif // !defined(ASIO_HAS_STD_ATOMIC)
  756. // Standard library support for chrono. Some standard libraries (such as the
  757. // libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
  758. // drafts, rather than the eventually standardised name of steady_clock.
  759. #if !defined(ASIO_HAS_STD_CHRONO)
  760. # if !defined(ASIO_DISABLE_STD_CHRONO)
  761. # if defined(__clang__)
  762. # if defined(ASIO_HAS_CLANG_LIBCXX)
  763. # define ASIO_HAS_STD_CHRONO 1
  764. # elif (__cplusplus >= 201103)
  765. # if __has_include(<chrono>)
  766. # define ASIO_HAS_STD_CHRONO 1
  767. # endif // __has_include(<chrono>)
  768. # endif // (__cplusplus >= 201103)
  769. # elif defined(__GNUC__)
  770. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  771. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  772. # define ASIO_HAS_STD_CHRONO 1
  773. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
  774. # define ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK 1
  775. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
  776. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  777. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  778. # endif // defined(__GNUC__)
  779. # if defined(ASIO_MSVC)
  780. # if (_MSC_VER >= 1700)
  781. # define ASIO_HAS_STD_CHRONO 1
  782. # endif // (_MSC_VER >= 1700)
  783. # endif // defined(ASIO_MSVC)
  784. # endif // !defined(ASIO_DISABLE_STD_CHRONO)
  785. #endif // !defined(ASIO_HAS_STD_CHRONO)
  786. // Boost support for chrono.
  787. #if !defined(ASIO_HAS_BOOST_CHRONO)
  788. # if !defined(ASIO_DISABLE_BOOST_CHRONO)
  789. # if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
  790. # define ASIO_HAS_BOOST_CHRONO 1
  791. # endif // defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
  792. # endif // !defined(ASIO_DISABLE_BOOST_CHRONO)
  793. #endif // !defined(ASIO_HAS_BOOST_CHRONO)
  794. // Some form of chrono library is available.
  795. #if !defined(ASIO_HAS_CHRONO)
  796. # if defined(ASIO_HAS_STD_CHRONO) \
  797. || defined(ASIO_HAS_BOOST_CHRONO)
  798. # define ASIO_HAS_CHRONO 1
  799. # endif // defined(ASIO_HAS_STD_CHRONO)
  800. // || defined(ASIO_HAS_BOOST_CHRONO)
  801. #endif // !defined(ASIO_HAS_CHRONO)
  802. // Boost support for the DateTime library.
  803. #if !defined(ASIO_HAS_BOOST_DATE_TIME)
  804. # if !defined(ASIO_DISABLE_BOOST_DATE_TIME)
  805. # define ASIO_HAS_BOOST_DATE_TIME 1
  806. # endif // !defined(ASIO_DISABLE_BOOST_DATE_TIME)
  807. #endif // !defined(ASIO_HAS_BOOST_DATE_TIME)
  808. // Standard library support for addressof.
  809. #if !defined(ASIO_HAS_STD_ADDRESSOF)
  810. # if !defined(ASIO_DISABLE_STD_ADDRESSOF)
  811. # if defined(__clang__)
  812. # if defined(ASIO_HAS_CLANG_LIBCXX)
  813. # define ASIO_HAS_STD_ADDRESSOF 1
  814. # elif (__cplusplus >= 201103)
  815. # define ASIO_HAS_STD_ADDRESSOF 1
  816. # endif // (__cplusplus >= 201103)
  817. # elif defined(__GNUC__)
  818. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  819. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  820. # define ASIO_HAS_STD_ADDRESSOF 1
  821. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  822. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  823. # endif // defined(__GNUC__)
  824. # if defined(ASIO_MSVC)
  825. # if (_MSC_VER >= 1700)
  826. # define ASIO_HAS_STD_ADDRESSOF 1
  827. # endif // (_MSC_VER >= 1700)
  828. # endif // defined(ASIO_MSVC)
  829. # endif // !defined(ASIO_DISABLE_STD_ADDRESSOF)
  830. #endif // !defined(ASIO_HAS_STD_ADDRESSOF)
  831. // Standard library support for the function class.
  832. #if !defined(ASIO_HAS_STD_FUNCTION)
  833. # if !defined(ASIO_DISABLE_STD_FUNCTION)
  834. # if defined(__clang__)
  835. # if defined(ASIO_HAS_CLANG_LIBCXX)
  836. # define ASIO_HAS_STD_FUNCTION 1
  837. # elif (__cplusplus >= 201103)
  838. # define ASIO_HAS_STD_FUNCTION 1
  839. # endif // (__cplusplus >= 201103)
  840. # elif defined(__GNUC__)
  841. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  842. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  843. # define ASIO_HAS_STD_FUNCTION 1
  844. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  845. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  846. # endif // defined(__GNUC__)
  847. # if defined(ASIO_MSVC)
  848. # if (_MSC_VER >= 1700)
  849. # define ASIO_HAS_STD_FUNCTION 1
  850. # endif // (_MSC_VER >= 1700)
  851. # endif // defined(ASIO_MSVC)
  852. # endif // !defined(ASIO_DISABLE_STD_FUNCTION)
  853. #endif // !defined(ASIO_HAS_STD_FUNCTION)
  854. // Standard library support for the reference_wrapper class.
  855. #if !defined(ASIO_HAS_STD_REFERENCE_WRAPPER)
  856. # if !defined(ASIO_DISABLE_STD_REFERENCE_WRAPPER)
  857. # if defined(__clang__)
  858. # if defined(ASIO_HAS_CLANG_LIBCXX)
  859. # define ASIO_HAS_STD_REFERENCE_WRAPPER 1
  860. # elif (__cplusplus >= 201103)
  861. # define ASIO_HAS_STD_REFERENCE_WRAPPER 1
  862. # endif // (__cplusplus >= 201103)
  863. # elif defined(__GNUC__)
  864. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  865. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  866. # define ASIO_HAS_STD_REFERENCE_WRAPPER 1
  867. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  868. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  869. # endif // defined(__GNUC__)
  870. # if defined(ASIO_MSVC)
  871. # if (_MSC_VER >= 1700)
  872. # define ASIO_HAS_STD_REFERENCE_WRAPPER 1
  873. # endif // (_MSC_VER >= 1700)
  874. # endif // defined(ASIO_MSVC)
  875. # endif // !defined(ASIO_DISABLE_STD_REFERENCE_WRAPPER)
  876. #endif // !defined(ASIO_HAS_STD_REFERENCE_WRAPPER)
  877. // Standard library support for type traits.
  878. #if !defined(ASIO_HAS_STD_TYPE_TRAITS)
  879. # if !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
  880. # if defined(__clang__)
  881. # if defined(ASIO_HAS_CLANG_LIBCXX)
  882. # define ASIO_HAS_STD_TYPE_TRAITS 1
  883. # elif (__cplusplus >= 201103)
  884. # if __has_include(<type_traits>)
  885. # define ASIO_HAS_STD_TYPE_TRAITS 1
  886. # endif // __has_include(<type_traits>)
  887. # endif // (__cplusplus >= 201103)
  888. # elif defined(__GNUC__)
  889. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  890. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  891. # define ASIO_HAS_STD_TYPE_TRAITS 1
  892. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  893. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  894. # endif // defined(__GNUC__)
  895. # if defined(ASIO_MSVC)
  896. # if (_MSC_VER >= 1700)
  897. # define ASIO_HAS_STD_TYPE_TRAITS 1
  898. # endif // (_MSC_VER >= 1700)
  899. # endif // defined(ASIO_MSVC)
  900. # endif // !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
  901. #endif // !defined(ASIO_HAS_STD_TYPE_TRAITS)
  902. // Standard library support for the nullptr_t type.
  903. #if !defined(ASIO_HAS_NULLPTR)
  904. # if !defined(ASIO_DISABLE_NULLPTR)
  905. # if defined(__clang__)
  906. # if __has_feature(__cxx_nullptr__)
  907. # define ASIO_HAS_NULLPTR 1
  908. # endif // __has_feature(__cxx_nullptr__)
  909. # elif defined(__GNUC__)
  910. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  911. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  912. # define ASIO_HAS_NULLPTR 1
  913. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  914. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  915. # endif // defined(__GNUC__)
  916. # if defined(ASIO_MSVC)
  917. # if (_MSC_VER >= 1700)
  918. # define ASIO_HAS_NULLPTR 1
  919. # endif // (_MSC_VER >= 1700)
  920. # endif // defined(ASIO_MSVC)
  921. # endif // !defined(ASIO_DISABLE_NULLPTR)
  922. #endif // !defined(ASIO_HAS_NULLPTR)
  923. // Standard library support for the C++11 allocator additions.
  924. #if !defined(ASIO_HAS_CXX11_ALLOCATORS)
  925. # if !defined(ASIO_DISABLE_CXX11_ALLOCATORS)
  926. # if defined(__clang__)
  927. # if defined(ASIO_HAS_CLANG_LIBCXX)
  928. # define ASIO_HAS_CXX11_ALLOCATORS 1
  929. # elif (__cplusplus >= 201103)
  930. # define ASIO_HAS_CXX11_ALLOCATORS 1
  931. # endif // (__cplusplus >= 201103)
  932. # elif defined(__GNUC__)
  933. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  934. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  935. # define ASIO_HAS_CXX11_ALLOCATORS 1
  936. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  937. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  938. # endif // defined(__GNUC__)
  939. # if defined(ASIO_MSVC)
  940. # if (_MSC_VER >= 1800)
  941. # define ASIO_HAS_CXX11_ALLOCATORS 1
  942. # endif // (_MSC_VER >= 1800)
  943. # endif // defined(ASIO_MSVC)
  944. # endif // !defined(ASIO_DISABLE_CXX11_ALLOCATORS)
  945. #endif // !defined(ASIO_HAS_CXX11_ALLOCATORS)
  946. // Standard library support for the cstdint header.
  947. #if !defined(ASIO_HAS_CSTDINT)
  948. # if !defined(ASIO_DISABLE_CSTDINT)
  949. # if defined(__clang__)
  950. # if defined(ASIO_HAS_CLANG_LIBCXX)
  951. # define ASIO_HAS_CSTDINT 1
  952. # elif (__cplusplus >= 201103)
  953. # define ASIO_HAS_CSTDINT 1
  954. # endif // (__cplusplus >= 201103)
  955. # elif defined(__GNUC__)
  956. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  957. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  958. # define ASIO_HAS_CSTDINT 1
  959. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  960. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  961. # endif // defined(__GNUC__)
  962. # if defined(ASIO_MSVC)
  963. # if (_MSC_VER >= 1700)
  964. # define ASIO_HAS_CSTDINT 1
  965. # endif // (_MSC_VER >= 1700)
  966. # endif // defined(ASIO_MSVC)
  967. # endif // !defined(ASIO_DISABLE_CSTDINT)
  968. #endif // !defined(ASIO_HAS_CSTDINT)
  969. // Standard library support for the thread class.
  970. #if !defined(ASIO_HAS_STD_THREAD)
  971. # if !defined(ASIO_DISABLE_STD_THREAD)
  972. # if defined(__clang__)
  973. # if defined(ASIO_HAS_CLANG_LIBCXX)
  974. # define ASIO_HAS_STD_THREAD 1
  975. # elif (__cplusplus >= 201103)
  976. # if __has_include(<thread>)
  977. # define ASIO_HAS_STD_THREAD 1
  978. # endif // __has_include(<thread>)
  979. # endif // (__cplusplus >= 201103)
  980. # elif defined(__GNUC__)
  981. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  982. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  983. # define ASIO_HAS_STD_THREAD 1
  984. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  985. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  986. # endif // defined(__GNUC__)
  987. # if defined(ASIO_MSVC)
  988. # if (_MSC_VER >= 1700)
  989. # define ASIO_HAS_STD_THREAD 1
  990. # endif // (_MSC_VER >= 1700)
  991. # endif // defined(ASIO_MSVC)
  992. # endif // !defined(ASIO_DISABLE_STD_THREAD)
  993. #endif // !defined(ASIO_HAS_STD_THREAD)
  994. // Standard library support for the mutex and condition variable classes.
  995. #if !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
  996. # if !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
  997. # if defined(__clang__)
  998. # if defined(ASIO_HAS_CLANG_LIBCXX)
  999. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  1000. # elif (__cplusplus >= 201103)
  1001. # if __has_include(<mutex>)
  1002. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  1003. # endif // __has_include(<mutex>)
  1004. # endif // (__cplusplus >= 201103)
  1005. # elif defined(__GNUC__)
  1006. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1007. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1008. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  1009. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1010. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1011. # endif // defined(__GNUC__)
  1012. # if defined(ASIO_MSVC)
  1013. # if (_MSC_VER >= 1700)
  1014. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  1015. # endif // (_MSC_VER >= 1700)
  1016. # endif // defined(ASIO_MSVC)
  1017. # endif // !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
  1018. #endif // !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
  1019. // Standard library support for the call_once function.
  1020. #if !defined(ASIO_HAS_STD_CALL_ONCE)
  1021. # if !defined(ASIO_DISABLE_STD_CALL_ONCE)
  1022. # if defined(__clang__)
  1023. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1024. # define ASIO_HAS_STD_CALL_ONCE 1
  1025. # elif (__cplusplus >= 201103)
  1026. # if __has_include(<mutex>)
  1027. # define ASIO_HAS_STD_CALL_ONCE 1
  1028. # endif // __has_include(<mutex>)
  1029. # endif // (__cplusplus >= 201103)
  1030. # elif defined(__GNUC__)
  1031. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1032. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1033. # define ASIO_HAS_STD_CALL_ONCE 1
  1034. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1035. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1036. # endif // defined(__GNUC__)
  1037. # if defined(ASIO_MSVC)
  1038. # if (_MSC_VER >= 1700)
  1039. # define ASIO_HAS_STD_CALL_ONCE 1
  1040. # endif // (_MSC_VER >= 1700)
  1041. # endif // defined(ASIO_MSVC)
  1042. # endif // !defined(ASIO_DISABLE_STD_CALL_ONCE)
  1043. #endif // !defined(ASIO_HAS_STD_CALL_ONCE)
  1044. // Standard library support for futures.
  1045. #if !defined(ASIO_HAS_STD_FUTURE)
  1046. # if !defined(ASIO_DISABLE_STD_FUTURE)
  1047. # if defined(__clang__)
  1048. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1049. # define ASIO_HAS_STD_FUTURE 1
  1050. # elif (__cplusplus >= 201103)
  1051. # if __has_include(<future>)
  1052. # define ASIO_HAS_STD_FUTURE 1
  1053. # endif // __has_include(<future>)
  1054. # endif // (__cplusplus >= 201103)
  1055. # elif defined(__GNUC__)
  1056. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1057. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1058. # define ASIO_HAS_STD_FUTURE 1
  1059. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1060. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1061. # endif // defined(__GNUC__)
  1062. # if defined(ASIO_MSVC)
  1063. # if (_MSC_VER >= 1700)
  1064. # define ASIO_HAS_STD_FUTURE 1
  1065. # endif // (_MSC_VER >= 1700)
  1066. # endif // defined(ASIO_MSVC)
  1067. # endif // !defined(ASIO_DISABLE_STD_FUTURE)
  1068. #endif // !defined(ASIO_HAS_STD_FUTURE)
  1069. // Standard library support for std::string_view.
  1070. #if !defined(ASIO_HAS_STD_STRING_VIEW)
  1071. # if !defined(ASIO_DISABLE_STD_STRING_VIEW)
  1072. # if defined(__clang__)
  1073. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1074. # if (__cplusplus >= 201402)
  1075. # if __has_include(<string_view>)
  1076. # define ASIO_HAS_STD_STRING_VIEW 1
  1077. # endif // __has_include(<string_view>)
  1078. # endif // (__cplusplus >= 201402)
  1079. # else // defined(ASIO_HAS_CLANG_LIBCXX)
  1080. # if (__cplusplus >= 201703)
  1081. # if __has_include(<string_view>)
  1082. # define ASIO_HAS_STD_STRING_VIEW 1
  1083. # endif // __has_include(<string_view>)
  1084. # endif // (__cplusplus >= 201703)
  1085. # endif // defined(ASIO_HAS_CLANG_LIBCXX)
  1086. # elif defined(__GNUC__)
  1087. # if (__GNUC__ >= 7)
  1088. # if (__cplusplus >= 201703)
  1089. # define ASIO_HAS_STD_STRING_VIEW 1
  1090. # endif // (__cplusplus >= 201703)
  1091. # endif // (__GNUC__ >= 7)
  1092. # elif defined(ASIO_MSVC)
  1093. # if (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
  1094. # define ASIO_HAS_STD_STRING_VIEW 1
  1095. # endif // (_MSC_VER >= 1910 && _MSVC_LANG >= 201703)
  1096. # endif // defined(ASIO_MSVC)
  1097. # endif // !defined(ASIO_DISABLE_STD_STRING_VIEW)
  1098. #endif // !defined(ASIO_HAS_STD_STRING_VIEW)
  1099. // Standard library support for std::experimental::string_view.
  1100. #if !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  1101. # if !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
  1102. # if defined(__clang__)
  1103. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1104. # if (_LIBCPP_VERSION < 7000)
  1105. # if (__cplusplus >= 201402)
  1106. # if __has_include(<experimental/string_view>)
  1107. # define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  1108. # endif // __has_include(<experimental/string_view>)
  1109. # endif // (__cplusplus >= 201402)
  1110. # endif // (_LIBCPP_VERSION < 7000)
  1111. # else // defined(ASIO_HAS_CLANG_LIBCXX)
  1112. # if (__cplusplus >= 201402)
  1113. # if __has_include(<experimental/string_view>)
  1114. # define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  1115. # endif // __has_include(<experimental/string_view>)
  1116. # endif // (__cplusplus >= 201402)
  1117. # endif // // defined(ASIO_HAS_CLANG_LIBCXX)
  1118. # elif defined(__GNUC__)
  1119. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  1120. # if (__cplusplus >= 201402)
  1121. # define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
  1122. # endif // (__cplusplus >= 201402)
  1123. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) || (__GNUC__ > 4)
  1124. # endif // defined(__GNUC__)
  1125. # endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
  1126. #endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  1127. // Standard library has a string_view that we can use.
  1128. #if !defined(ASIO_HAS_STRING_VIEW)
  1129. # if !defined(ASIO_DISABLE_STRING_VIEW)
  1130. # if defined(ASIO_HAS_STD_STRING_VIEW)
  1131. # define ASIO_HAS_STRING_VIEW 1
  1132. # elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  1133. # define ASIO_HAS_STRING_VIEW 1
  1134. # endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW)
  1135. # endif // !defined(ASIO_DISABLE_STRING_VIEW)
  1136. #endif // !defined(ASIO_HAS_STRING_VIEW)
  1137. // Standard library support for iostream move construction and assignment.
  1138. #if !defined(ASIO_HAS_STD_IOSTREAM_MOVE)
  1139. # if !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE)
  1140. # if defined(__clang__)
  1141. # if (__cplusplus >= 201103)
  1142. # define ASIO_HAS_STD_IOSTREAM_MOVE 1
  1143. # endif // (__cplusplus >= 201103)
  1144. # elif defined(__GNUC__)
  1145. # if (__GNUC__ > 4)
  1146. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1147. # define ASIO_HAS_STD_IOSTREAM_MOVE 1
  1148. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1149. # endif // (__GNUC__ > 4)
  1150. # elif defined(ASIO_MSVC)
  1151. # if (_MSC_VER >= 1700)
  1152. # define ASIO_HAS_STD_IOSTREAM_MOVE 1
  1153. # endif // (_MSC_VER >= 1700)
  1154. # endif // defined(ASIO_MSVC)
  1155. # endif // !defined(ASIO_DISABLE_STD_IOSTREAM_MOVE)
  1156. #endif // !defined(ASIO_HAS_STD_IOSTREAM_MOVE)
  1157. // Standard library has invoke_result (which supersedes result_of).
  1158. #if !defined(ASIO_HAS_STD_INVOKE_RESULT)
  1159. # if !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
  1160. # if defined(ASIO_MSVC)
  1161. # if (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
  1162. # define ASIO_HAS_STD_INVOKE_RESULT 1
  1163. # endif // (_MSC_VER >= 1911 && _MSVC_LANG >= 201703)
  1164. # endif // defined(ASIO_MSVC)
  1165. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1166. # if (_LIBCPP_VERSION >= 13000)
  1167. # if (__cplusplus >= 202002)
  1168. # define ASIO_HAS_STD_INVOKE_RESULT 1
  1169. # endif // (__cplusplus >= 202002)
  1170. # endif // (_LIBCPP_VERSION >= 13000)
  1171. # endif // defined(ASIO_HAS_CLANG_LIBCXX)
  1172. # endif // !defined(ASIO_DISABLE_STD_INVOKE_RESULT)
  1173. #endif // !defined(ASIO_HAS_STD_INVOKE_RESULT)
  1174. // Standard library support for std::exception_ptr and std::current_exception.
  1175. #if !defined(ASIO_HAS_STD_EXCEPTION_PTR)
  1176. # if !defined(ASIO_DISABLE_STD_EXCEPTION_PTR)
  1177. # if defined(__clang__)
  1178. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1179. # define ASIO_HAS_STD_EXCEPTION_PTR 1
  1180. # elif (__cplusplus >= 201103)
  1181. # define ASIO_HAS_STD_EXCEPTION_PTR 1
  1182. # endif // (__cplusplus >= 201103)
  1183. # elif defined(__GNUC__)
  1184. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1185. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1186. # define ASIO_HAS_STD_EXCEPTION_PTR 1
  1187. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1188. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1189. # endif // defined(__GNUC__)
  1190. # if defined(ASIO_MSVC)
  1191. # if (_MSC_VER >= 1800)
  1192. # define ASIO_HAS_STD_EXCEPTION_PTR 1
  1193. # endif // (_MSC_VER >= 1800)
  1194. # endif // defined(ASIO_MSVC)
  1195. # endif // !defined(ASIO_DISABLE_STD_EXCEPTION_PTR)
  1196. #endif // !defined(ASIO_HAS_STD_EXCEPTION_PTR)
  1197. // Standard library support for std::nested_exception.
  1198. #if !defined(ASIO_HAS_STD_NESTED_EXCEPTION)
  1199. # if !defined(ASIO_DISABLE_STD_NESTED_EXCEPTION)
  1200. # if defined(__clang__)
  1201. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1202. # define ASIO_HAS_STD_NESTED_EXCEPTION 1
  1203. # elif (__cplusplus >= 201103)
  1204. # define ASIO_HAS_STD_NESTED_EXCEPTION 1
  1205. # endif // (__cplusplus >= 201103)
  1206. # elif defined(__GNUC__)
  1207. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1208. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1209. # define ASIO_HAS_STD_NESTED_EXCEPTION 1
  1210. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1211. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1212. # endif // defined(__GNUC__)
  1213. # if defined(ASIO_MSVC)
  1214. # if (_MSC_VER >= 1900)
  1215. # define ASIO_HAS_STD_NESTED_EXCEPTION 1
  1216. # endif // (_MSC_VER >= 1900)
  1217. # endif // defined(ASIO_MSVC)
  1218. # endif // !defined(ASIO_DISABLE_STD_NESTED_EXCEPTION)
  1219. #endif // !defined(ASIO_HAS_STD_NESTED_EXCEPTION)
  1220. // Standard library support for std::any.
  1221. #if !defined(ASIO_HAS_STD_ANY)
  1222. # if !defined(ASIO_DISABLE_STD_ANY)
  1223. # if defined(__clang__)
  1224. # if (__cplusplus >= 201703)
  1225. # if __has_include(<any>)
  1226. # define ASIO_HAS_STD_ANY 1
  1227. # endif // __has_include(<any>)
  1228. # endif // (__cplusplus >= 201703)
  1229. # elif defined(__GNUC__)
  1230. # if (__GNUC__ >= 7)
  1231. # if (__cplusplus >= 201703)
  1232. # define ASIO_HAS_STD_ANY 1
  1233. # endif // (__cplusplus >= 201703)
  1234. # endif // (__GNUC__ >= 7)
  1235. # endif // defined(__GNUC__)
  1236. # if defined(ASIO_MSVC)
  1237. # if (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  1238. # define ASIO_HAS_STD_ANY 1
  1239. # endif // (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703)
  1240. # endif // defined(ASIO_MSVC)
  1241. # endif // !defined(ASIO_DISABLE_STD_ANY)
  1242. #endif // !defined(ASIO_HAS_STD_ANY)
  1243. // Standard library support for std::source_location.
  1244. #if !defined(ASIO_HAS_STD_SOURCE_LOCATION)
  1245. # if !defined(ASIO_DISABLE_STD_SOURCE_LOCATION)
  1246. // ...
  1247. # endif // !defined(ASIO_DISABLE_STD_SOURCE_LOCATION)
  1248. #endif // !defined(ASIO_HAS_STD_SOURCE_LOCATION)
  1249. // Standard library support for std::experimental::source_location.
  1250. #if !defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  1251. # if !defined(ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
  1252. # if defined(__GNUC__)
  1253. # if (__cplusplus >= 201709)
  1254. # if __has_include(<experimental/source_location>)
  1255. # define ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION 1
  1256. # endif // __has_include(<experimental/source_location>)
  1257. # endif // (__cplusplus >= 201709)
  1258. # endif // defined(__GNUC__)
  1259. # endif // !defined(ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION)
  1260. #endif // !defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  1261. // Standard library has a source_location that we can use.
  1262. #if !defined(ASIO_HAS_SOURCE_LOCATION)
  1263. # if !defined(ASIO_DISABLE_SOURCE_LOCATION)
  1264. # if defined(ASIO_HAS_STD_SOURCE_LOCATION)
  1265. # define ASIO_HAS_SOURCE_LOCATION 1
  1266. # elif defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  1267. # define ASIO_HAS_SOURCE_LOCATION 1
  1268. # endif // defined(ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION)
  1269. # endif // !defined(ASIO_DISABLE_SOURCE_LOCATION)
  1270. #endif // !defined(ASIO_HAS_SOURCE_LOCATION)
  1271. // Windows App target. Windows but with a limited API.
  1272. #if !defined(ASIO_WINDOWS_APP)
  1273. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  1274. # include <winapifamily.h>
  1275. # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  1276. || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_TV_TITLE)) \
  1277. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  1278. # define ASIO_WINDOWS_APP 1
  1279. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  1280. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  1281. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  1282. #endif // !defined(ASIO_WINDOWS_APP)
  1283. // Legacy WinRT target. Windows App is preferred.
  1284. #if !defined(ASIO_WINDOWS_RUNTIME)
  1285. # if !defined(ASIO_WINDOWS_APP)
  1286. # if defined(__cplusplus_winrt)
  1287. # include <winapifamily.h>
  1288. # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  1289. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  1290. # define ASIO_WINDOWS_RUNTIME 1
  1291. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  1292. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  1293. # endif // defined(__cplusplus_winrt)
  1294. # endif // !defined(ASIO_WINDOWS_APP)
  1295. #endif // !defined(ASIO_WINDOWS_RUNTIME)
  1296. // Windows target. Excludes WinRT but includes Windows App targets.
  1297. #if !defined(ASIO_WINDOWS)
  1298. # if !defined(ASIO_WINDOWS_RUNTIME)
  1299. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  1300. # define ASIO_WINDOWS 1
  1301. # elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  1302. # define ASIO_WINDOWS 1
  1303. # elif defined(ASIO_WINDOWS_APP)
  1304. # define ASIO_WINDOWS 1
  1305. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  1306. # endif // !defined(ASIO_WINDOWS_RUNTIME)
  1307. #endif // !defined(ASIO_WINDOWS)
  1308. // Windows: target OS version.
  1309. #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1310. # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  1311. # if defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  1312. # pragma message( \
  1313. "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
  1314. "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
  1315. "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
  1316. "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
  1317. # else // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  1318. # warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
  1319. # warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
  1320. # warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
  1321. # endif // defined(_MSC_VER) || (defined(__BORLANDC__) && !defined(__clang__))
  1322. # define _WIN32_WINNT 0x0601
  1323. # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  1324. # if defined(_MSC_VER)
  1325. # if defined(_WIN32) && !defined(WIN32)
  1326. # if !defined(_WINSOCK2API_)
  1327. # define WIN32 // Needed for correct types in winsock2.h
  1328. # else // !defined(_WINSOCK2API_)
  1329. # error Please define the macro WIN32 in your compiler options
  1330. # endif // !defined(_WINSOCK2API_)
  1331. # endif // defined(_WIN32) && !defined(WIN32)
  1332. # endif // defined(_MSC_VER)
  1333. # if defined(__BORLANDC__)
  1334. # if defined(__WIN32__) && !defined(WIN32)
  1335. # if !defined(_WINSOCK2API_)
  1336. # define WIN32 // Needed for correct types in winsock2.h
  1337. # else // !defined(_WINSOCK2API_)
  1338. # error Please define the macro WIN32 in your compiler options
  1339. # endif // !defined(_WINSOCK2API_)
  1340. # endif // defined(__WIN32__) && !defined(WIN32)
  1341. # endif // defined(__BORLANDC__)
  1342. # if defined(__CYGWIN__)
  1343. # if !defined(__USE_W32_SOCKETS)
  1344. # error You must add -D__USE_W32_SOCKETS to your compiler options.
  1345. # endif // !defined(__USE_W32_SOCKETS)
  1346. # endif // defined(__CYGWIN__)
  1347. #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1348. // Windows: minimise header inclusion.
  1349. #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1350. # if !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
  1351. # if !defined(WIN32_LEAN_AND_MEAN)
  1352. # define WIN32_LEAN_AND_MEAN
  1353. # endif // !defined(WIN32_LEAN_AND_MEAN)
  1354. # endif // !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
  1355. #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1356. // Windows: suppress definition of "min" and "max" macros.
  1357. #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1358. # if !defined(ASIO_NO_NOMINMAX)
  1359. # if !defined(NOMINMAX)
  1360. # define NOMINMAX 1
  1361. # endif // !defined(NOMINMAX)
  1362. # endif // !defined(ASIO_NO_NOMINMAX)
  1363. #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1364. // Windows: IO Completion Ports.
  1365. #if !defined(ASIO_HAS_IOCP)
  1366. # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1367. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  1368. # if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  1369. # if !defined(ASIO_DISABLE_IOCP)
  1370. # define ASIO_HAS_IOCP 1
  1371. # endif // !defined(ASIO_DISABLE_IOCP)
  1372. # endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  1373. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  1374. # endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1375. #endif // !defined(ASIO_HAS_IOCP)
  1376. // On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
  1377. // get access to the various platform feature macros, e.g. to be able to test
  1378. // for threads support.
  1379. #if !defined(ASIO_HAS_UNISTD_H)
  1380. # if !defined(ASIO_HAS_BOOST_CONFIG)
  1381. # if defined(unix) \
  1382. || defined(__unix) \
  1383. || defined(_XOPEN_SOURCE) \
  1384. || defined(_POSIX_SOURCE) \
  1385. || (defined(__MACH__) && defined(__APPLE__)) \
  1386. || defined(__FreeBSD__) \
  1387. || defined(__NetBSD__) \
  1388. || defined(__OpenBSD__) \
  1389. || defined(__linux__) \
  1390. || defined(__HAIKU__)
  1391. # define ASIO_HAS_UNISTD_H 1
  1392. # endif
  1393. # endif // !defined(ASIO_HAS_BOOST_CONFIG)
  1394. #endif // !defined(ASIO_HAS_UNISTD_H)
  1395. #if defined(ASIO_HAS_UNISTD_H)
  1396. # include <unistd.h>
  1397. #endif // defined(ASIO_HAS_UNISTD_H)
  1398. // Linux: epoll, eventfd and timerfd.
  1399. #if defined(__linux__)
  1400. # include <linux/version.h>
  1401. # if !defined(ASIO_HAS_EPOLL)
  1402. # if !defined(ASIO_DISABLE_EPOLL)
  1403. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  1404. # define ASIO_HAS_EPOLL 1
  1405. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  1406. # endif // !defined(ASIO_DISABLE_EPOLL)
  1407. # endif // !defined(ASIO_HAS_EPOLL)
  1408. # if !defined(ASIO_HAS_EVENTFD)
  1409. # if !defined(ASIO_DISABLE_EVENTFD)
  1410. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  1411. # define ASIO_HAS_EVENTFD 1
  1412. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  1413. # endif // !defined(ASIO_DISABLE_EVENTFD)
  1414. # endif // !defined(ASIO_HAS_EVENTFD)
  1415. # if !defined(ASIO_HAS_TIMERFD)
  1416. # if defined(ASIO_HAS_EPOLL)
  1417. # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  1418. # define ASIO_HAS_TIMERFD 1
  1419. # endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  1420. # endif // defined(ASIO_HAS_EPOLL)
  1421. # endif // !defined(ASIO_HAS_TIMERFD)
  1422. #endif // defined(__linux__)
  1423. // Linux: io_uring is used instead of epoll.
  1424. #if !defined(ASIO_HAS_IO_URING_AS_DEFAULT)
  1425. # if !defined(ASIO_HAS_EPOLL) && defined(ASIO_HAS_IO_URING)
  1426. # define ASIO_HAS_IO_URING_AS_DEFAULT 1
  1427. # endif // !defined(ASIO_HAS_EPOLL) && defined(ASIO_HAS_IO_URING)
  1428. #endif // !defined(ASIO_HAS_IO_URING_AS_DEFAULT)
  1429. // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
  1430. #if (defined(__MACH__) && defined(__APPLE__)) \
  1431. || defined(__FreeBSD__) \
  1432. || defined(__NetBSD__) \
  1433. || defined(__OpenBSD__)
  1434. # if !defined(ASIO_HAS_KQUEUE)
  1435. # if !defined(ASIO_DISABLE_KQUEUE)
  1436. # define ASIO_HAS_KQUEUE 1
  1437. # endif // !defined(ASIO_DISABLE_KQUEUE)
  1438. # endif // !defined(ASIO_HAS_KQUEUE)
  1439. #endif // (defined(__MACH__) && defined(__APPLE__))
  1440. // || defined(__FreeBSD__)
  1441. // || defined(__NetBSD__)
  1442. // || defined(__OpenBSD__)
  1443. // Solaris: /dev/poll.
  1444. #if defined(__sun)
  1445. # if !defined(ASIO_HAS_DEV_POLL)
  1446. # if !defined(ASIO_DISABLE_DEV_POLL)
  1447. # define ASIO_HAS_DEV_POLL 1
  1448. # endif // !defined(ASIO_DISABLE_DEV_POLL)
  1449. # endif // !defined(ASIO_HAS_DEV_POLL)
  1450. #endif // defined(__sun)
  1451. // Serial ports.
  1452. #if !defined(ASIO_HAS_SERIAL_PORT)
  1453. # if defined(ASIO_HAS_IOCP) \
  1454. || !defined(ASIO_WINDOWS) \
  1455. && !defined(ASIO_WINDOWS_RUNTIME) \
  1456. && !defined(__CYGWIN__)
  1457. # if !defined(__SYMBIAN32__)
  1458. # if !defined(ASIO_DISABLE_SERIAL_PORT)
  1459. # define ASIO_HAS_SERIAL_PORT 1
  1460. # endif // !defined(ASIO_DISABLE_SERIAL_PORT)
  1461. # endif // !defined(__SYMBIAN32__)
  1462. # endif // defined(ASIO_HAS_IOCP)
  1463. // || !defined(ASIO_WINDOWS)
  1464. // && !defined(ASIO_WINDOWS_RUNTIME)
  1465. // && !defined(__CYGWIN__)
  1466. #endif // !defined(ASIO_HAS_SERIAL_PORT)
  1467. // Windows: stream handles.
  1468. #if !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
  1469. # if !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  1470. # if defined(ASIO_HAS_IOCP)
  1471. # define ASIO_HAS_WINDOWS_STREAM_HANDLE 1
  1472. # endif // defined(ASIO_HAS_IOCP)
  1473. # endif // !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  1474. #endif // !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
  1475. // Windows: random access handles.
  1476. #if !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  1477. # if !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  1478. # if defined(ASIO_HAS_IOCP)
  1479. # define ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
  1480. # endif // defined(ASIO_HAS_IOCP)
  1481. # endif // !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  1482. #endif // !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  1483. // Windows: object handles.
  1484. #if !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  1485. # if !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  1486. # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1487. # if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  1488. # define ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
  1489. # endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  1490. # endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1491. # endif // !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  1492. #endif // !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  1493. // Windows: OVERLAPPED wrapper.
  1494. #if !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  1495. # if !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  1496. # if defined(ASIO_HAS_IOCP)
  1497. # define ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
  1498. # endif // defined(ASIO_HAS_IOCP)
  1499. # endif // !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  1500. #endif // !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  1501. // POSIX: stream-oriented file descriptors.
  1502. #if !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  1503. # if !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  1504. # if !defined(ASIO_WINDOWS) \
  1505. && !defined(ASIO_WINDOWS_RUNTIME) \
  1506. && !defined(__CYGWIN__)
  1507. # define ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
  1508. # endif // !defined(ASIO_WINDOWS)
  1509. // && !defined(ASIO_WINDOWS_RUNTIME)
  1510. // && !defined(__CYGWIN__)
  1511. # endif // !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  1512. #endif // !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  1513. // UNIX domain sockets.
  1514. #if !defined(ASIO_HAS_LOCAL_SOCKETS)
  1515. # if !defined(ASIO_DISABLE_LOCAL_SOCKETS)
  1516. # if !defined(ASIO_WINDOWS_RUNTIME)
  1517. # define ASIO_HAS_LOCAL_SOCKETS 1
  1518. # endif // !defined(ASIO_WINDOWS_RUNTIME)
  1519. # endif // !defined(ASIO_DISABLE_LOCAL_SOCKETS)
  1520. #endif // !defined(ASIO_HAS_LOCAL_SOCKETS)
  1521. // Files.
  1522. #if !defined(ASIO_HAS_FILE)
  1523. # if !defined(ASIO_DISABLE_FILE)
  1524. # if defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  1525. # define ASIO_HAS_FILE 1
  1526. # elif defined(ASIO_HAS_IO_URING)
  1527. # define ASIO_HAS_FILE 1
  1528. # endif // defined(ASIO_HAS_IO_URING)
  1529. # endif // !defined(ASIO_DISABLE_FILE)
  1530. #endif // !defined(ASIO_HAS_FILE)
  1531. // Pipes.
  1532. #if !defined(ASIO_HAS_PIPE)
  1533. # if defined(ASIO_HAS_IOCP) \
  1534. || !defined(ASIO_WINDOWS) \
  1535. && !defined(ASIO_WINDOWS_RUNTIME) \
  1536. && !defined(__CYGWIN__)
  1537. # if !defined(__SYMBIAN32__)
  1538. # if !defined(ASIO_DISABLE_PIPE)
  1539. # define ASIO_HAS_PIPE 1
  1540. # endif // !defined(ASIO_DISABLE_PIPE)
  1541. # endif // !defined(__SYMBIAN32__)
  1542. # endif // defined(ASIO_HAS_IOCP)
  1543. // || !defined(ASIO_WINDOWS)
  1544. // && !defined(ASIO_WINDOWS_RUNTIME)
  1545. // && !defined(__CYGWIN__)
  1546. #endif // !defined(ASIO_HAS_PIPE)
  1547. // Can use sigaction() instead of signal().
  1548. #if !defined(ASIO_HAS_SIGACTION)
  1549. # if !defined(ASIO_DISABLE_SIGACTION)
  1550. # if !defined(ASIO_WINDOWS) \
  1551. && !defined(ASIO_WINDOWS_RUNTIME) \
  1552. && !defined(__CYGWIN__)
  1553. # define ASIO_HAS_SIGACTION 1
  1554. # endif // !defined(ASIO_WINDOWS)
  1555. // && !defined(ASIO_WINDOWS_RUNTIME)
  1556. // && !defined(__CYGWIN__)
  1557. # endif // !defined(ASIO_DISABLE_SIGACTION)
  1558. #endif // !defined(ASIO_HAS_SIGACTION)
  1559. // Can use signal().
  1560. #if !defined(ASIO_HAS_SIGNAL)
  1561. # if !defined(ASIO_DISABLE_SIGNAL)
  1562. # if !defined(UNDER_CE)
  1563. # define ASIO_HAS_SIGNAL 1
  1564. # endif // !defined(UNDER_CE)
  1565. # endif // !defined(ASIO_DISABLE_SIGNAL)
  1566. #endif // !defined(ASIO_HAS_SIGNAL)
  1567. // Can use getaddrinfo() and getnameinfo().
  1568. #if !defined(ASIO_HAS_GETADDRINFO)
  1569. # if !defined(ASIO_DISABLE_GETADDRINFO)
  1570. # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  1571. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
  1572. # define ASIO_HAS_GETADDRINFO 1
  1573. # elif defined(UNDER_CE)
  1574. # define ASIO_HAS_GETADDRINFO 1
  1575. # endif // defined(UNDER_CE)
  1576. # elif defined(__MACH__) && defined(__APPLE__)
  1577. # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  1578. # if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
  1579. # define ASIO_HAS_GETADDRINFO 1
  1580. # endif // (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1050)
  1581. # else // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  1582. # define ASIO_HAS_GETADDRINFO 1
  1583. # endif // defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
  1584. # else // defined(__MACH__) && defined(__APPLE__)
  1585. # define ASIO_HAS_GETADDRINFO 1
  1586. # endif // defined(__MACH__) && defined(__APPLE__)
  1587. # endif // !defined(ASIO_DISABLE_GETADDRINFO)
  1588. #endif // !defined(ASIO_HAS_GETADDRINFO)
  1589. // Whether standard iostreams are disabled.
  1590. #if !defined(ASIO_NO_IOSTREAM)
  1591. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
  1592. # define ASIO_NO_IOSTREAM 1
  1593. # endif // !defined(BOOST_NO_IOSTREAM)
  1594. #endif // !defined(ASIO_NO_IOSTREAM)
  1595. // Whether exception handling is disabled.
  1596. #if !defined(ASIO_NO_EXCEPTIONS)
  1597. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
  1598. # define ASIO_NO_EXCEPTIONS 1
  1599. # endif // !defined(BOOST_NO_EXCEPTIONS)
  1600. #endif // !defined(ASIO_NO_EXCEPTIONS)
  1601. // Whether the typeid operator is supported.
  1602. #if !defined(ASIO_NO_TYPEID)
  1603. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
  1604. # define ASIO_NO_TYPEID 1
  1605. # endif // !defined(BOOST_NO_TYPEID)
  1606. #endif // !defined(ASIO_NO_TYPEID)
  1607. // Threads.
  1608. #if !defined(ASIO_HAS_THREADS)
  1609. # if !defined(ASIO_DISABLE_THREADS)
  1610. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  1611. # define ASIO_HAS_THREADS 1
  1612. # elif defined(__GNUC__) && !defined(__MINGW32__) \
  1613. && !defined(linux) && !defined(__linux) && !defined(__linux__)
  1614. # define ASIO_HAS_THREADS 1
  1615. # elif defined(_MT) || defined(__MT__)
  1616. # define ASIO_HAS_THREADS 1
  1617. # elif defined(_REENTRANT)
  1618. # define ASIO_HAS_THREADS 1
  1619. # elif defined(__APPLE__)
  1620. # define ASIO_HAS_THREADS 1
  1621. # elif defined(__HAIKU__)
  1622. # define ASIO_HAS_THREADS 1
  1623. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  1624. # define ASIO_HAS_THREADS 1
  1625. # elif defined(_PTHREADS)
  1626. # define ASIO_HAS_THREADS 1
  1627. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  1628. # endif // !defined(ASIO_DISABLE_THREADS)
  1629. #endif // !defined(ASIO_HAS_THREADS)
  1630. // POSIX threads.
  1631. #if !defined(ASIO_HAS_PTHREADS)
  1632. # if defined(ASIO_HAS_THREADS)
  1633. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  1634. # define ASIO_HAS_PTHREADS 1
  1635. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  1636. # define ASIO_HAS_PTHREADS 1
  1637. # elif defined(__HAIKU__)
  1638. # define ASIO_HAS_PTHREADS 1
  1639. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  1640. # endif // defined(ASIO_HAS_THREADS)
  1641. #endif // !defined(ASIO_HAS_PTHREADS)
  1642. // Helper to prevent macro expansion.
  1643. #define ASIO_PREVENT_MACRO_SUBSTITUTION
  1644. // Helper to define in-class constants.
  1645. #if !defined(ASIO_STATIC_CONSTANT)
  1646. # if !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1647. # define ASIO_STATIC_CONSTANT(type, assignment) \
  1648. BOOST_STATIC_CONSTANT(type, assignment)
  1649. # else // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1650. # define ASIO_STATIC_CONSTANT(type, assignment) \
  1651. static const type assignment
  1652. # endif // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  1653. #endif // !defined(ASIO_STATIC_CONSTANT)
  1654. // Boost align library.
  1655. #if !defined(ASIO_HAS_BOOST_ALIGN)
  1656. # if !defined(ASIO_DISABLE_BOOST_ALIGN)
  1657. # if defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
  1658. # define ASIO_HAS_BOOST_ALIGN 1
  1659. # endif // defined(ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105600)
  1660. # endif // !defined(ASIO_DISABLE_BOOST_ALIGN)
  1661. #endif // !defined(ASIO_HAS_BOOST_ALIGN)
  1662. // Boost array library.
  1663. #if !defined(ASIO_HAS_BOOST_ARRAY)
  1664. # if !defined(ASIO_DISABLE_BOOST_ARRAY)
  1665. # define ASIO_HAS_BOOST_ARRAY 1
  1666. # endif // !defined(ASIO_DISABLE_BOOST_ARRAY)
  1667. #endif // !defined(ASIO_HAS_BOOST_ARRAY)
  1668. // Boost assert macro.
  1669. #if !defined(ASIO_HAS_BOOST_ASSERT)
  1670. # if !defined(ASIO_DISABLE_BOOST_ASSERT)
  1671. # define ASIO_HAS_BOOST_ASSERT 1
  1672. # endif // !defined(ASIO_DISABLE_BOOST_ASSERT)
  1673. #endif // !defined(ASIO_HAS_BOOST_ASSERT)
  1674. // Boost limits header.
  1675. #if !defined(ASIO_HAS_BOOST_LIMITS)
  1676. # if !defined(ASIO_DISABLE_BOOST_LIMITS)
  1677. # define ASIO_HAS_BOOST_LIMITS 1
  1678. # endif // !defined(ASIO_DISABLE_BOOST_LIMITS)
  1679. #endif // !defined(ASIO_HAS_BOOST_LIMITS)
  1680. // Boost throw_exception function.
  1681. #if !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
  1682. # if !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1683. # define ASIO_HAS_BOOST_THROW_EXCEPTION 1
  1684. # endif // !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1685. #endif // !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
  1686. // Boost regex library.
  1687. #if !defined(ASIO_HAS_BOOST_REGEX)
  1688. # if !defined(ASIO_DISABLE_BOOST_REGEX)
  1689. # define ASIO_HAS_BOOST_REGEX 1
  1690. # endif // !defined(ASIO_DISABLE_BOOST_REGEX)
  1691. #endif // !defined(ASIO_HAS_BOOST_REGEX)
  1692. // Boost bind function.
  1693. #if !defined(ASIO_HAS_BOOST_BIND)
  1694. # if !defined(ASIO_DISABLE_BOOST_BIND)
  1695. # define ASIO_HAS_BOOST_BIND 1
  1696. # endif // !defined(ASIO_DISABLE_BOOST_BIND)
  1697. #endif // !defined(ASIO_HAS_BOOST_BIND)
  1698. // Boost's BOOST_WORKAROUND macro.
  1699. #if !defined(ASIO_HAS_BOOST_WORKAROUND)
  1700. # if !defined(ASIO_DISABLE_BOOST_WORKAROUND)
  1701. # define ASIO_HAS_BOOST_WORKAROUND 1
  1702. # endif // !defined(ASIO_DISABLE_BOOST_WORKAROUND)
  1703. #endif // !defined(ASIO_HAS_BOOST_WORKAROUND)
  1704. // Microsoft Visual C++'s secure C runtime library.
  1705. #if !defined(ASIO_HAS_SECURE_RTL)
  1706. # if !defined(ASIO_DISABLE_SECURE_RTL)
  1707. # if defined(ASIO_MSVC) \
  1708. && (ASIO_MSVC >= 1400) \
  1709. && !defined(UNDER_CE)
  1710. # define ASIO_HAS_SECURE_RTL 1
  1711. # endif // defined(ASIO_MSVC)
  1712. // && (ASIO_MSVC >= 1400)
  1713. // && !defined(UNDER_CE)
  1714. # endif // !defined(ASIO_DISABLE_SECURE_RTL)
  1715. #endif // !defined(ASIO_HAS_SECURE_RTL)
  1716. // Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
  1717. #if !defined(ASIO_HAS_HANDLER_HOOKS)
  1718. # if !defined(ASIO_DISABLE_HANDLER_HOOKS)
  1719. # if defined(__GNUC__)
  1720. # if (__GNUC__ >= 3)
  1721. # define ASIO_HAS_HANDLER_HOOKS 1
  1722. # endif // (__GNUC__ >= 3)
  1723. # elif !defined(__BORLANDC__) || defined(__clang__)
  1724. # define ASIO_HAS_HANDLER_HOOKS 1
  1725. # endif // !defined(__BORLANDC__) || defined(__clang__)
  1726. # endif // !defined(ASIO_DISABLE_HANDLER_HOOKS)
  1727. #endif // !defined(ASIO_HAS_HANDLER_HOOKS)
  1728. // Support for the __thread keyword extension.
  1729. #if !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1730. # if defined(__linux__)
  1731. # if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1732. # if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1733. # if !defined(__INTEL_COMPILER) && !defined(__ICL) \
  1734. && !(defined(__clang__) && defined(__ANDROID__))
  1735. # define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1736. # define ASIO_THREAD_KEYWORD __thread
  1737. # elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1738. # define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1739. # endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1740. // && !(defined(__clang__) && defined(__ANDROID__))
  1741. # endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1742. # endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1743. # endif // defined(__linux__)
  1744. # if defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
  1745. # if (_MSC_VER >= 1700)
  1746. # define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1747. # define ASIO_THREAD_KEYWORD __declspec(thread)
  1748. # endif // (_MSC_VER >= 1700)
  1749. # endif // defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
  1750. #endif // !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1751. #if !defined(ASIO_THREAD_KEYWORD)
  1752. # define ASIO_THREAD_KEYWORD __thread
  1753. #endif // !defined(ASIO_THREAD_KEYWORD)
  1754. // Support for POSIX ssize_t typedef.
  1755. #if !defined(ASIO_DISABLE_SSIZE_T)
  1756. # if defined(__linux__) \
  1757. || (defined(__MACH__) && defined(__APPLE__))
  1758. # define ASIO_HAS_SSIZE_T 1
  1759. # endif // defined(__linux__)
  1760. // || (defined(__MACH__) && defined(__APPLE__))
  1761. #endif // !defined(ASIO_DISABLE_SSIZE_T)
  1762. // Helper macros to manage transition away from error_code return values.
  1763. #if defined(ASIO_NO_DEPRECATED)
  1764. # define ASIO_SYNC_OP_VOID void
  1765. # define ASIO_SYNC_OP_VOID_RETURN(e) return
  1766. #else // defined(ASIO_NO_DEPRECATED)
  1767. # define ASIO_SYNC_OP_VOID asio::error_code
  1768. # define ASIO_SYNC_OP_VOID_RETURN(e) return e
  1769. #endif // defined(ASIO_NO_DEPRECATED)
  1770. // Newer gcc, clang need special treatment to suppress unused typedef warnings.
  1771. #if defined(__clang__)
  1772. # if defined(__apple_build_version__)
  1773. # if (__clang_major__ >= 7)
  1774. # define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1775. # endif // (__clang_major__ >= 7)
  1776. # elif ((__clang_major__ == 3) && (__clang_minor__ >= 6)) \
  1777. || (__clang_major__ > 3)
  1778. # define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1779. # endif // ((__clang_major__ == 3) && (__clang_minor__ >= 6))
  1780. // || (__clang_major__ > 3)
  1781. #elif defined(__GNUC__)
  1782. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  1783. # define ASIO_UNUSED_TYPEDEF __attribute__((__unused__))
  1784. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4)
  1785. #endif // defined(__GNUC__)
  1786. #if !defined(ASIO_UNUSED_TYPEDEF)
  1787. # define ASIO_UNUSED_TYPEDEF
  1788. #endif // !defined(ASIO_UNUSED_TYPEDEF)
  1789. // Some versions of gcc generate spurious warnings about unused variables.
  1790. #if defined(__GNUC__)
  1791. # if (__GNUC__ >= 4)
  1792. # define ASIO_UNUSED_VARIABLE __attribute__((__unused__))
  1793. # endif // (__GNUC__ >= 4)
  1794. #endif // defined(__GNUC__)
  1795. #if !defined(ASIO_UNUSED_VARIABLE)
  1796. # define ASIO_UNUSED_VARIABLE
  1797. #endif // !defined(ASIO_UNUSED_VARIABLE)
  1798. // Support the co_await keyword on compilers known to allow it.
  1799. #if !defined(ASIO_HAS_CO_AWAIT)
  1800. # if !defined(ASIO_DISABLE_CO_AWAIT)
  1801. # if defined(ASIO_MSVC)
  1802. # if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705) && !defined(__clang__)
  1803. # define ASIO_HAS_CO_AWAIT 1
  1804. # elif (_MSC_FULL_VER >= 190023506)
  1805. # if defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
  1806. # define ASIO_HAS_CO_AWAIT 1
  1807. # endif // defined(_RESUMABLE_FUNCTIONS_SUPPORTED)
  1808. # endif // (_MSC_FULL_VER >= 190023506)
  1809. # elif defined(__clang__)
  1810. # if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1811. # if __has_include(<experimental/coroutine>)
  1812. # define ASIO_HAS_CO_AWAIT 1
  1813. # endif // __has_include(<experimental/coroutine>)
  1814. # endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
  1815. # elif defined(__GNUC__)
  1816. # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1817. # if __has_include(<coroutine>)
  1818. # define ASIO_HAS_CO_AWAIT 1
  1819. # endif // __has_include(<coroutine>)
  1820. # endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1821. # endif // defined(__GNUC__)
  1822. # endif // !defined(ASIO_DISABLE_CO_AWAIT)
  1823. #endif // !defined(ASIO_HAS_CO_AWAIT)
  1824. // Standard library support for coroutines.
  1825. #if !defined(ASIO_HAS_STD_COROUTINE)
  1826. # if !defined(ASIO_DISABLE_STD_COROUTINE)
  1827. # if defined(ASIO_MSVC)
  1828. # if (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
  1829. # define ASIO_HAS_STD_COROUTINE 1
  1830. # endif // (_MSC_VER >= 1928) && (_MSVC_LANG >= 201705)
  1831. # endif // defined(ASIO_MSVC)
  1832. # if defined(__GNUC__)
  1833. # if (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1834. # if __has_include(<coroutine>)
  1835. # define ASIO_HAS_STD_COROUTINE 1
  1836. # endif // __has_include(<coroutine>)
  1837. # endif // (__cplusplus >= 201709) && (__cpp_impl_coroutine >= 201902)
  1838. # endif // defined(__GNUC__)
  1839. # endif // !defined(ASIO_DISABLE_STD_COROUTINE)
  1840. #endif // !defined(ASIO_HAS_STD_COROUTINE)
  1841. // Compiler support for the the [[nodiscard]] attribute.
  1842. #if !defined(ASIO_NODISCARD)
  1843. # if defined(__has_cpp_attribute)
  1844. # if __has_cpp_attribute(nodiscard)
  1845. # if (__cplusplus >= 201703)
  1846. # define ASIO_NODISCARD [[nodiscard]]
  1847. # endif // (__cplusplus >= 201703)
  1848. # endif // __has_cpp_attribute(nodiscard)
  1849. # endif // defined(__has_cpp_attribute)
  1850. #endif // !defined(ASIO_NODISCARD)
  1851. #if !defined(ASIO_NODISCARD)
  1852. # define ASIO_NODISCARD
  1853. #endif // !defined(ASIO_NODISCARD)
  1854. // Kernel support for MSG_NOSIGNAL.
  1855. #if !defined(ASIO_HAS_MSG_NOSIGNAL)
  1856. # if defined(__linux__)
  1857. # define ASIO_HAS_MSG_NOSIGNAL 1
  1858. # elif defined(_POSIX_VERSION)
  1859. # if (_POSIX_VERSION >= 200809L)
  1860. # define ASIO_HAS_MSG_NOSIGNAL 1
  1861. # endif // _POSIX_VERSION >= 200809L
  1862. # endif // defined(_POSIX_VERSION)
  1863. #endif // !defined(ASIO_HAS_MSG_NOSIGNAL)
  1864. // Standard library support for std::hash.
  1865. #if !defined(ASIO_HAS_STD_HASH)
  1866. # if !defined(ASIO_DISABLE_STD_HASH)
  1867. # if defined(__clang__)
  1868. # if defined(ASIO_HAS_CLANG_LIBCXX)
  1869. # define ASIO_HAS_STD_HASH 1
  1870. # elif (__cplusplus >= 201103)
  1871. # define ASIO_HAS_STD_HASH 1
  1872. # endif // (__cplusplus >= 201103)
  1873. # elif defined(__GNUC__)
  1874. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1875. # if (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1876. # define ASIO_HAS_STD_HASH 1
  1877. # endif // (__cplusplus >= 201103) || defined(__GXX_EXPERIMENTAL_CXX0X__)
  1878. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  1879. # endif // defined(__GNUC__)
  1880. # if defined(ASIO_MSVC)
  1881. # if (_MSC_VER >= 1700)
  1882. # define ASIO_HAS_STD_HASH 1
  1883. # endif // (_MSC_VER >= 1700)
  1884. # endif // defined(ASIO_MSVC)
  1885. # endif // !defined(ASIO_DISABLE_STD_HASH)
  1886. #endif // !defined(ASIO_HAS_STD_HASH)
  1887. #endif // ASIO_DETAIL_CONFIG_HPP