visualc.hpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. // (C) Copyright John Maddock 2001 - 2003.
  2. // (C) Copyright Darin Adler 2001 - 2002.
  3. // (C) Copyright Peter Dimov 2001.
  4. // (C) Copyright Aleksey Gurtovoy 2002.
  5. // (C) Copyright David Abrahams 2002 - 2003.
  6. // (C) Copyright Beman Dawes 2002 - 2003.
  7. // Use, modification and distribution are subject to the
  8. // Boost Software License, Version 1.0. (See accompanying file
  9. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  10. // See http://www.boost.org for most recent version.
  11. //
  12. // Microsoft Visual C++ compiler setup:
  13. //
  14. // We need to be careful with the checks in this file, as contrary
  15. // to popular belief there are versions with _MSC_VER with the final
  16. // digit non-zero (mainly the MIPS cross compiler).
  17. //
  18. // So we either test _MSC_VER >= XXXX or else _MSC_VER < XXXX.
  19. // No other comparisons (==, >, or <=) are safe.
  20. //
  21. #define BOOST_MSVC _MSC_VER
  22. //
  23. // Helper macro BOOST_MSVC_FULL_VER for use in Boost code:
  24. //
  25. #if _MSC_FULL_VER > 100000000
  26. # define BOOST_MSVC_FULL_VER _MSC_FULL_VER
  27. #else
  28. # define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10)
  29. #endif
  30. // Attempt to suppress VC6 warnings about the length of decorated names (obsolete):
  31. #pragma warning( disable : 4503 ) // warning: decorated name length exceeded
  32. #define BOOST_HAS_PRAGMA_ONCE
  33. //
  34. // versions check:
  35. // we don't support Visual C++ prior to version 7.1:
  36. #if _MSC_VER < 1310
  37. # error "Compiler not supported or configured - please reconfigure"
  38. #endif
  39. // VS2005 (VC8) docs: __assume has been in Visual C++ for multiple releases
  40. #define BOOST_UNREACHABLE_RETURN(x) __assume(0);
  41. #if _MSC_FULL_VER < 180020827
  42. # define BOOST_NO_FENV_H
  43. #endif
  44. #if _MSC_VER < 1400
  45. // although a conforming signature for swprint exists in VC7.1
  46. // it appears not to actually work:
  47. # define BOOST_NO_SWPRINTF
  48. // Our extern template tests also fail for this compiler:
  49. # define BOOST_NO_CXX11_EXTERN_TEMPLATE
  50. // Variadic macros do not exist for VC7.1 and lower
  51. # define BOOST_NO_CXX11_VARIADIC_MACROS
  52. # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
  53. #endif
  54. #if _MSC_VER < 1500 // 140X == VC++ 8.0
  55. # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
  56. #endif
  57. #if _MSC_VER < 1600 // 150X == VC++ 9.0
  58. // A bug in VC9:
  59. # define BOOST_NO_ADL_BARRIER
  60. #endif
  61. #ifndef _NATIVE_WCHAR_T_DEFINED
  62. # define BOOST_NO_INTRINSIC_WCHAR_T
  63. #endif
  64. //
  65. // check for exception handling support:
  66. #if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS)
  67. # define BOOST_NO_EXCEPTIONS
  68. #endif
  69. //
  70. // __int64 support:
  71. //
  72. #define BOOST_HAS_MS_INT64
  73. #if defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1400)
  74. # define BOOST_HAS_LONG_LONG
  75. #else
  76. # define BOOST_NO_LONG_LONG
  77. #endif
  78. #if (_MSC_VER >= 1400) && !defined(_DEBUG)
  79. # define BOOST_HAS_NRVO
  80. #endif
  81. #if _MSC_VER >= 1600 // 160X == VC++ 10.0
  82. # define BOOST_HAS_PRAGMA_DETECT_MISMATCH
  83. #endif
  84. //
  85. // disable Win32 API's if compiler extensions are
  86. // turned off:
  87. //
  88. #if !defined(_MSC_EXTENSIONS) && !defined(BOOST_DISABLE_WIN32)
  89. # define BOOST_DISABLE_WIN32
  90. #endif
  91. #if !defined(_CPPRTTI) && !defined(BOOST_NO_RTTI)
  92. # define BOOST_NO_RTTI
  93. #endif
  94. // Deprecated symbol markup
  95. #if (_MSC_VER >= 1400)
  96. #define BOOST_DEPRECATED(msg) __declspec(deprecated(msg))
  97. #else
  98. // MSVC 7.1 only supports the attribute without a message
  99. #define BOOST_DEPRECATED(msg) __declspec(deprecated)
  100. #endif
  101. //
  102. // TR1 features:
  103. //
  104. #if (_MSC_VER >= 1700) && defined(_HAS_CXX17) && (_HAS_CXX17 > 0)
  105. // # define BOOST_HAS_TR1_HASH // don't know if this is true yet.
  106. // # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet.
  107. # define BOOST_HAS_TR1_UNORDERED_MAP
  108. # define BOOST_HAS_TR1_UNORDERED_SET
  109. #endif
  110. //
  111. // C++0x features
  112. //
  113. // See above for BOOST_NO_LONG_LONG
  114. // C++ features supported by VC++ 10 (aka 2010)
  115. //
  116. #if _MSC_VER < 1600
  117. # define BOOST_NO_CXX11_AUTO_DECLARATIONS
  118. # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
  119. # define BOOST_NO_CXX11_LAMBDAS
  120. # define BOOST_NO_CXX11_RVALUE_REFERENCES
  121. # define BOOST_NO_CXX11_STATIC_ASSERT
  122. # define BOOST_NO_CXX11_NULLPTR
  123. # define BOOST_NO_CXX11_DECLTYPE
  124. #endif // _MSC_VER < 1600
  125. #if _MSC_VER >= 1600
  126. # define BOOST_HAS_STDINT_H
  127. #endif
  128. // C++11 features supported by VC++ 11 (aka 2012)
  129. //
  130. #if _MSC_VER < 1700
  131. # define BOOST_NO_CXX11_FINAL
  132. # define BOOST_NO_CXX11_RANGE_BASED_FOR
  133. # define BOOST_NO_CXX11_SCOPED_ENUMS
  134. # define BOOST_NO_CXX11_OVERRIDE
  135. #endif // _MSC_VER < 1700
  136. // C++11 features supported by VC++ 12 (aka 2013).
  137. //
  138. #if _MSC_FULL_VER < 180020827
  139. # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
  140. # define BOOST_NO_CXX11_DELETED_FUNCTIONS
  141. # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
  142. # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  143. # define BOOST_NO_CXX11_RAW_LITERALS
  144. # define BOOST_NO_CXX11_TEMPLATE_ALIASES
  145. # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
  146. # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  147. # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  148. # define BOOST_NO_CXX11_DECLTYPE_N3276
  149. #endif
  150. #if _MSC_FULL_VER >= 180020827
  151. #define BOOST_HAS_EXPM1
  152. #define BOOST_HAS_LOG1P
  153. #endif
  154. // C++11 features supported by VC++ 14 (aka 2015)
  155. //
  156. #if (_MSC_FULL_VER < 190023026)
  157. # define BOOST_NO_CXX11_NOEXCEPT
  158. # define BOOST_NO_CXX11_DEFAULTED_MOVES
  159. # define BOOST_NO_CXX11_REF_QUALIFIERS
  160. # define BOOST_NO_CXX11_USER_DEFINED_LITERALS
  161. # define BOOST_NO_CXX11_ALIGNAS
  162. # define BOOST_NO_CXX11_ALIGNOF
  163. # define BOOST_NO_CXX11_INLINE_NAMESPACES
  164. # define BOOST_NO_CXX11_CHAR16_T
  165. # define BOOST_NO_CXX11_CHAR32_T
  166. # define BOOST_NO_CXX11_UNICODE_LITERALS
  167. # define BOOST_NO_CXX14_DECLTYPE_AUTO
  168. # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
  169. # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
  170. # define BOOST_NO_CXX14_BINARY_LITERALS
  171. # define BOOST_NO_CXX14_GENERIC_LAMBDAS
  172. # define BOOST_NO_CXX14_DIGIT_SEPARATORS
  173. # define BOOST_NO_CXX11_THREAD_LOCAL
  174. # define BOOST_NO_CXX11_UNRESTRICTED_UNION
  175. #endif
  176. // C++11 features supported by VC++ 14 update 3 (aka 2015)
  177. //
  178. #if (_MSC_FULL_VER < 190024210)
  179. # define BOOST_NO_CXX14_VARIABLE_TEMPLATES
  180. # define BOOST_NO_SFINAE_EXPR
  181. # define BOOST_NO_CXX11_CONSTEXPR
  182. #endif
  183. // C++14 features supported by VC++ 14.1 (Visual Studio 2017)
  184. //
  185. #if (_MSC_VER < 1910)
  186. # define BOOST_NO_CXX14_AGGREGATE_NSDMI
  187. #endif
  188. // C++17 features supported by VC++ 14.1 (Visual Studio 2017) Update 3
  189. //
  190. #if (_MSC_VER < 1911) || (_MSVC_LANG < 201703)
  191. # define BOOST_NO_CXX17_STRUCTURED_BINDINGS
  192. # define BOOST_NO_CXX17_IF_CONSTEXPR
  193. // Let the defaults handle these now:
  194. //# define BOOST_NO_CXX17_HDR_OPTIONAL
  195. //# define BOOST_NO_CXX17_HDR_STRING_VIEW
  196. #endif
  197. // MSVC including version 14 has not yet completely
  198. // implemented value-initialization, as is reported:
  199. // "VC++ does not value-initialize members of derived classes without
  200. // user-declared constructor", reported in 2009 by Sylvester Hesp:
  201. // https://connect.microsoft.com/VisualStudio/feedback/details/484295
  202. // "Presence of copy constructor breaks member class initialization",
  203. // reported in 2009 by Alex Vakulenko:
  204. // https://connect.microsoft.com/VisualStudio/feedback/details/499606
  205. // "Value-initialization in new-expression", reported in 2005 by
  206. // Pavel Kuznetsov (MetaCommunications Engineering):
  207. // https://connect.microsoft.com/VisualStudio/feedback/details/100744
  208. // Reported again by John Maddock in 2015 for VC14:
  209. // https://connect.microsoft.com/VisualStudio/feedback/details/1582233/c-subobjects-still-not-value-initialized-correctly
  210. // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
  211. // (Niels Dekker, LKEB, May 2010)
  212. // Still present in VC15.5, Dec 2017.
  213. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
  214. //
  215. // C++ 11:
  216. //
  217. // This is supported with /permissive- for 15.5 onwards, unfortunately we appear to have no way to tell
  218. // if this is in effect or not, in any case nothing in Boost is currently using this, so we'll just go
  219. // on defining it for now:
  220. //
  221. #if (_MSC_FULL_VER < 193030705) || (_MSVC_LANG < 202004)
  222. # define BOOST_NO_TWO_PHASE_NAME_LOOKUP
  223. #endif
  224. #if (_MSC_VER < 1912) || (_MSVC_LANG < 201402)
  225. // Supported from msvc-15.5 onwards:
  226. #define BOOST_NO_CXX11_SFINAE_EXPR
  227. #endif
  228. #if (_MSC_VER < 1915) || (_MSVC_LANG < 201402)
  229. // C++ 14:
  230. // Still gives internal compiler error for msvc-15.5:
  231. # define BOOST_NO_CXX14_CONSTEXPR
  232. #endif
  233. // C++ 17:
  234. #if (_MSC_VER < 1912) || (_MSVC_LANG < 201703)
  235. #define BOOST_NO_CXX17_INLINE_VARIABLES
  236. #define BOOST_NO_CXX17_FOLD_EXPRESSIONS
  237. #endif
  238. #if (_MSC_VER < 1914) || (_MSVC_LANG < 201703)
  239. #define BOOST_NO_CXX17_AUTO_NONTYPE_TEMPLATE_PARAMS
  240. #endif
  241. //
  242. // Things that don't work in clr mode:
  243. //
  244. #ifdef _M_CEE
  245. #ifndef BOOST_NO_CXX11_THREAD_LOCAL
  246. # define BOOST_NO_CXX11_THREAD_LOCAL
  247. #endif
  248. #if !defined(BOOST_NO_SFINAE_EXPR) && !defined(_MSVC_LANG)
  249. # define BOOST_NO_SFINAE_EXPR
  250. #endif
  251. #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
  252. # define BOOST_NO_CXX11_REF_QUALIFIERS
  253. #endif
  254. #endif
  255. #ifdef _M_CEE_PURE
  256. #ifndef BOOST_NO_CXX11_CONSTEXPR
  257. # define BOOST_NO_CXX11_CONSTEXPR
  258. #endif
  259. #endif
  260. //
  261. // prefix and suffix headers:
  262. //
  263. #ifndef BOOST_ABI_PREFIX
  264. # define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp"
  265. #endif
  266. #ifndef BOOST_ABI_SUFFIX
  267. # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp"
  268. #endif
  269. //
  270. // Approximate compiler conformance version
  271. //
  272. #ifdef _MSVC_LANG
  273. # define BOOST_CXX_VERSION _MSVC_LANG
  274. #elif defined(_HAS_CXX17)
  275. # define BOOST_CXX_VERSION 201703L
  276. #elif BOOST_MSVC >= 1916
  277. # define BOOST_CXX_VERSION 201402L
  278. #endif
  279. #if BOOST_CXX_VERSION >= 201703L
  280. # define BOOST_ATTRIBUTE_UNUSED [[maybe_unused]]
  281. #endif
  282. #ifndef BOOST_COMPILER
  283. // TODO:
  284. // these things are mostly bogus. 1200 means version 12.0 of the compiler. The
  285. // artificial versions assigned to them only refer to the versions of some IDE
  286. // these compilers have been shipped with, and even that is not all of it. Some
  287. // were shipped with freely downloadable SDKs, others as crosscompilers in eVC.
  288. // IOW, you can't use these 'versions' in any sensible way. Sorry.
  289. # if defined(UNDER_CE)
  290. # if _MSC_VER < 1400
  291. // Note: I'm not aware of any CE compiler with version 13xx
  292. # if defined(BOOST_ASSERT_CONFIG)
  293. # error "boost: Unknown EVC++ compiler version - please run the configure tests and report the results"
  294. # else
  295. # pragma message("boost: Unknown EVC++ compiler version - please run the configure tests and report the results")
  296. # endif
  297. # elif _MSC_VER < 1500
  298. # define BOOST_COMPILER_VERSION evc8
  299. # elif _MSC_VER < 1600
  300. # define BOOST_COMPILER_VERSION evc9
  301. # elif _MSC_VER < 1700
  302. # define BOOST_COMPILER_VERSION evc10
  303. # elif _MSC_VER < 1800
  304. # define BOOST_COMPILER_VERSION evc11
  305. # elif _MSC_VER < 1900
  306. # define BOOST_COMPILER_VERSION evc12
  307. # elif _MSC_VER < 2000
  308. # define BOOST_COMPILER_VERSION evc14
  309. # else
  310. # if defined(BOOST_ASSERT_CONFIG)
  311. # error "boost: Unknown EVC++ compiler version - please run the configure tests and report the results"
  312. # else
  313. # pragma message("boost: Unknown EVC++ compiler version - please run the configure tests and report the results")
  314. # endif
  315. # endif
  316. # else
  317. # if _MSC_VER < 1200
  318. // Note: Versions up to 10.0 aren't supported.
  319. # define BOOST_COMPILER_VERSION 5.0
  320. # elif _MSC_VER < 1300
  321. # define BOOST_COMPILER_VERSION 6.0
  322. # elif _MSC_VER < 1310
  323. # define BOOST_COMPILER_VERSION 7.0
  324. # elif _MSC_VER < 1400
  325. # define BOOST_COMPILER_VERSION 7.1
  326. # elif _MSC_VER < 1500
  327. # define BOOST_COMPILER_VERSION 8.0
  328. # elif _MSC_VER < 1600
  329. # define BOOST_COMPILER_VERSION 9.0
  330. # elif _MSC_VER < 1700
  331. # define BOOST_COMPILER_VERSION 10.0
  332. # elif _MSC_VER < 1800
  333. # define BOOST_COMPILER_VERSION 11.0
  334. # elif _MSC_VER < 1900
  335. # define BOOST_COMPILER_VERSION 12.0
  336. # elif _MSC_VER < 1910
  337. # define BOOST_COMPILER_VERSION 14.0
  338. # elif _MSC_VER < 1920
  339. # define BOOST_COMPILER_VERSION 14.1
  340. # elif _MSC_VER < 1930
  341. # define BOOST_COMPILER_VERSION 14.2
  342. # elif _MSC_VER < 1940
  343. # define BOOST_COMPILER_VERSION 14.3
  344. # else
  345. # define BOOST_COMPILER_VERSION _MSC_VER
  346. # endif
  347. # endif
  348. # define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
  349. #endif
  350. #include <boost/config/pragma_message.hpp>
  351. //
  352. // last known and checked version is 19.3x (VS2022):
  353. #if (_MSC_VER >= 1940)
  354. # if defined(BOOST_ASSERT_CONFIG)
  355. # error "Boost.Config is older than your current compiler version."
  356. # elif !defined(BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE)
  357. //
  358. // Disabled as of March 2018 - the pace of VS releases is hard to keep up with
  359. // and in any case, we have relatively few defect macros defined now.
  360. // BOOST_PRAGMA_MESSAGE("Info: Boost.Config is older than your compiler version - probably nothing bad will happen - but you may wish to look for an updated Boost version. Define BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE to suppress this message.")
  361. # endif
  362. #endif