visualc.hpp 12 KB

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