visualc.hpp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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. //
  95. // TR1 features:
  96. //
  97. #if (_MSC_VER >= 1700) && defined(_HAS_CXX17) && (_HAS_CXX17 > 0)
  98. // # define BOOST_HAS_TR1_HASH // don't know if this is true yet.
  99. // # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet.
  100. # define BOOST_HAS_TR1_UNORDERED_MAP
  101. # define BOOST_HAS_TR1_UNORDERED_SET
  102. #endif
  103. //
  104. // C++0x features
  105. //
  106. // See above for BOOST_NO_LONG_LONG
  107. // C++ features supported by VC++ 10 (aka 2010)
  108. //
  109. #if _MSC_VER < 1600
  110. # define BOOST_NO_CXX11_AUTO_DECLARATIONS
  111. # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
  112. # define BOOST_NO_CXX11_LAMBDAS
  113. # define BOOST_NO_CXX11_RVALUE_REFERENCES
  114. # define BOOST_NO_CXX11_STATIC_ASSERT
  115. # define BOOST_NO_CXX11_NULLPTR
  116. # define BOOST_NO_CXX11_DECLTYPE
  117. #endif // _MSC_VER < 1600
  118. #if _MSC_VER >= 1600
  119. # define BOOST_HAS_STDINT_H
  120. #endif
  121. // C++11 features supported by VC++ 11 (aka 2012)
  122. //
  123. #if _MSC_VER < 1700
  124. # define BOOST_NO_CXX11_FINAL
  125. # define BOOST_NO_CXX11_RANGE_BASED_FOR
  126. # define BOOST_NO_CXX11_SCOPED_ENUMS
  127. # define BOOST_NO_CXX11_OVERRIDE
  128. #endif // _MSC_VER < 1700
  129. // C++11 features supported by VC++ 12 (aka 2013).
  130. //
  131. #if _MSC_FULL_VER < 180020827
  132. # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
  133. # define BOOST_NO_CXX11_DELETED_FUNCTIONS
  134. # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
  135. # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
  136. # define BOOST_NO_CXX11_RAW_LITERALS
  137. # define BOOST_NO_CXX11_TEMPLATE_ALIASES
  138. # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
  139. # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
  140. # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
  141. # define BOOST_NO_CXX11_DECLTYPE_N3276
  142. #endif
  143. #if _MSC_FULL_VER >= 180020827
  144. #define BOOST_HAS_EXPM1
  145. #define BOOST_HAS_LOG1P
  146. #endif
  147. // C++11 features supported by VC++ 14 (aka 2015)
  148. //
  149. #if (_MSC_FULL_VER < 190023026)
  150. # define BOOST_NO_CXX11_NOEXCEPT
  151. # define BOOST_NO_CXX11_DEFAULTED_MOVES
  152. # define BOOST_NO_CXX11_REF_QUALIFIERS
  153. # define BOOST_NO_CXX11_USER_DEFINED_LITERALS
  154. # define BOOST_NO_CXX11_ALIGNAS
  155. # define BOOST_NO_CXX11_INLINE_NAMESPACES
  156. # define BOOST_NO_CXX11_CHAR16_T
  157. # define BOOST_NO_CXX11_CHAR32_T
  158. # define BOOST_NO_CXX11_UNICODE_LITERALS
  159. # define BOOST_NO_CXX14_DECLTYPE_AUTO
  160. # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
  161. # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
  162. # define BOOST_NO_CXX14_BINARY_LITERALS
  163. # define BOOST_NO_CXX14_GENERIC_LAMBDAS
  164. # define BOOST_NO_CXX14_DIGIT_SEPARATORS
  165. # define BOOST_NO_CXX11_THREAD_LOCAL
  166. # define BOOST_NO_CXX11_UNRESTRICTED_UNION
  167. #endif
  168. // C++11 features supported by VC++ 14 update 3 (aka 2015)
  169. //
  170. #if (_MSC_FULL_VER < 190024210)
  171. # define BOOST_NO_CXX14_VARIABLE_TEMPLATES
  172. # define BOOST_NO_SFINAE_EXPR
  173. # define BOOST_NO_CXX11_CONSTEXPR
  174. #endif
  175. // C++14 features supported by VC++ 14.1 (Visual Studio 2017)
  176. //
  177. #if (_MSC_VER < 1910)
  178. # define BOOST_NO_CXX14_AGGREGATE_NSDMI
  179. #endif
  180. // C++17 features supported by VC++ 14.1 (Visual Studio 2017) Update 3
  181. //
  182. #if (_MSC_VER < 1911) || (_MSVC_LANG < 201703)
  183. # define BOOST_NO_CXX17_STRUCTURED_BINDINGS
  184. # define BOOST_NO_CXX17_IF_CONSTEXPR
  185. // Let the defaults handle these now:
  186. //# define BOOST_NO_CXX17_HDR_OPTIONAL
  187. //# define BOOST_NO_CXX17_HDR_STRING_VIEW
  188. #endif
  189. // MSVC including version 14 has not yet completely
  190. // implemented value-initialization, as is reported:
  191. // "VC++ does not value-initialize members of derived classes without
  192. // user-declared constructor", reported in 2009 by Sylvester Hesp:
  193. // https://connect.microsoft.com/VisualStudio/feedback/details/484295
  194. // "Presence of copy constructor breaks member class initialization",
  195. // reported in 2009 by Alex Vakulenko:
  196. // https://connect.microsoft.com/VisualStudio/feedback/details/499606
  197. // "Value-initialization in new-expression", reported in 2005 by
  198. // Pavel Kuznetsov (MetaCommunications Engineering):
  199. // https://connect.microsoft.com/VisualStudio/feedback/details/100744
  200. // Reported again by John Maddock in 2015 for VC14:
  201. // https://connect.microsoft.com/VisualStudio/feedback/details/1582233/c-subobjects-still-not-value-initialized-correctly
  202. // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues
  203. // (Niels Dekker, LKEB, May 2010)
  204. // Still present in VC15.5, Dec 2017.
  205. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION
  206. //
  207. // C++ 11:
  208. //
  209. // This is supported with /permissive- for 15.5 onwards, unfortunately we appear to have no way to tell
  210. // if this is in effect or not, in any case nothing in Boost is currently using this, so we'll just go
  211. // on defining it for now:
  212. //
  213. # define BOOST_NO_TWO_PHASE_NAME_LOOKUP
  214. #if (_MSC_VER < 1912) || (_MSVC_LANG < 201402)
  215. // Supported from msvc-15.5 onwards:
  216. #define BOOST_NO_CXX11_SFINAE_EXPR
  217. #endif
  218. #if (_MSC_VER < 1915) || (_MSVC_LANG < 201402)
  219. // C++ 14:
  220. // Still gives internal compiler error for msvc-15.5:
  221. # define BOOST_NO_CXX14_CONSTEXPR
  222. #endif
  223. // C++ 17:
  224. #if (_MSC_VER < 1912) || (_MSVC_LANG < 201703)
  225. #define BOOST_NO_CXX17_INLINE_VARIABLES
  226. #define BOOST_NO_CXX17_FOLD_EXPRESSIONS
  227. #endif
  228. //
  229. // Things that don't work in clr mode:
  230. //
  231. #ifdef _M_CEE
  232. #ifndef BOOST_NO_CXX11_THREAD_LOCAL
  233. # define BOOST_NO_CXX11_THREAD_LOCAL
  234. #endif
  235. #ifndef BOOST_NO_SFINAE_EXPR
  236. # define BOOST_NO_SFINAE_EXPR
  237. #endif
  238. #ifndef BOOST_NO_CXX11_REF_QUALIFIERS
  239. # define BOOST_NO_CXX11_REF_QUALIFIERS
  240. #endif
  241. #endif
  242. #ifdef _M_CEE_PURE
  243. #ifndef BOOST_NO_CXX11_CONSTEXPR
  244. # define BOOST_NO_CXX11_CONSTEXPR
  245. #endif
  246. #endif
  247. //
  248. // prefix and suffix headers:
  249. //
  250. #ifndef BOOST_ABI_PREFIX
  251. # define BOOST_ABI_PREFIX "boost/config/abi/msvc_prefix.hpp"
  252. #endif
  253. #ifndef BOOST_ABI_SUFFIX
  254. # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp"
  255. #endif
  256. //
  257. // Approximate compiler conformance version
  258. //
  259. #ifdef _MSVC_LANG
  260. # define BOOST_CXX_VERSION _MSVC_LANG
  261. #elif defined(_HAS_CXX17)
  262. # define BOOST_CXX_VERSION 201703L
  263. #elif BOOST_MSVC >= 1916
  264. # define BOOST_CXX_VERSION 201402L
  265. #endif
  266. #ifndef BOOST_COMPILER
  267. // TODO:
  268. // these things are mostly bogus. 1200 means version 12.0 of the compiler. The
  269. // artificial versions assigned to them only refer to the versions of some IDE
  270. // these compilers have been shipped with, and even that is not all of it. Some
  271. // were shipped with freely downloadable SDKs, others as crosscompilers in eVC.
  272. // IOW, you can't use these 'versions' in any sensible way. Sorry.
  273. # if defined(UNDER_CE)
  274. # if _MSC_VER < 1400
  275. // Note: I'm not aware of any CE compiler with version 13xx
  276. # if defined(BOOST_ASSERT_CONFIG)
  277. # error "boost: Unknown EVC++ compiler version - please run the configure tests and report the results"
  278. # else
  279. # pragma message("boost: Unknown EVC++ compiler version - please run the configure tests and report the results")
  280. # endif
  281. # elif _MSC_VER < 1500
  282. # define BOOST_COMPILER_VERSION evc8
  283. # elif _MSC_VER < 1600
  284. # define BOOST_COMPILER_VERSION evc9
  285. # elif _MSC_VER < 1700
  286. # define BOOST_COMPILER_VERSION evc10
  287. # elif _MSC_VER < 1800
  288. # define BOOST_COMPILER_VERSION evc11
  289. # elif _MSC_VER < 1900
  290. # define BOOST_COMPILER_VERSION evc12
  291. # elif _MSC_VER < 2000
  292. # define BOOST_COMPILER_VERSION evc14
  293. # else
  294. # if defined(BOOST_ASSERT_CONFIG)
  295. # error "boost: Unknown EVC++ compiler version - please run the configure tests and report the results"
  296. # else
  297. # pragma message("boost: Unknown EVC++ compiler version - please run the configure tests and report the results")
  298. # endif
  299. # endif
  300. # else
  301. # if _MSC_VER < 1200
  302. // Note: Versions up to 10.0 aren't supported.
  303. # define BOOST_COMPILER_VERSION 5.0
  304. # elif _MSC_VER < 1300
  305. # define BOOST_COMPILER_VERSION 6.0
  306. # elif _MSC_VER < 1310
  307. # define BOOST_COMPILER_VERSION 7.0
  308. # elif _MSC_VER < 1400
  309. # define BOOST_COMPILER_VERSION 7.1
  310. # elif _MSC_VER < 1500
  311. # define BOOST_COMPILER_VERSION 8.0
  312. # elif _MSC_VER < 1600
  313. # define BOOST_COMPILER_VERSION 9.0
  314. # elif _MSC_VER < 1700
  315. # define BOOST_COMPILER_VERSION 10.0
  316. # elif _MSC_VER < 1800
  317. # define BOOST_COMPILER_VERSION 11.0
  318. # elif _MSC_VER < 1900
  319. # define BOOST_COMPILER_VERSION 12.0
  320. # elif _MSC_VER < 1910
  321. # define BOOST_COMPILER_VERSION 14.0
  322. # elif _MSC_VER < 1920
  323. # define BOOST_COMPILER_VERSION 14.1
  324. # elif _MSC_VER < 1930
  325. # define BOOST_COMPILER_VERSION 14.2
  326. # else
  327. # define BOOST_COMPILER_VERSION _MSC_VER
  328. # endif
  329. # endif
  330. # define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION)
  331. #endif
  332. #include <boost/config/pragma_message.hpp>
  333. //
  334. // last known and checked version is 19.20.27508 (VC++ 2019 RC3):
  335. #if (_MSC_VER > 1920)
  336. # if defined(BOOST_ASSERT_CONFIG)
  337. # error "Boost.Config is older than your current compiler version."
  338. # elif !defined(BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE)
  339. //
  340. // Disabled as of March 2018 - the pace of VS releases is hard to keep up with
  341. // and in any case, we have relatively few defect macros defined now.
  342. // 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.")
  343. # endif
  344. #endif