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