visualc.hpp 11 KB

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