1 | /* |
2 | Copyright Rene Rivera 2008-2015 |
3 | Distributed under the Boost Software License, Version 1.0. |
4 | (See accompanying file LICENSE_1_0.txt or copy at |
5 | http://www.boost.org/LICENSE_1_0.txt) |
6 | */ |
7 | |
8 | #ifndef BOOST_PREDEF_COMPILER_VISUALC_H |
9 | #define BOOST_PREDEF_COMPILER_VISUALC_H |
10 | |
11 | /* Other compilers that emulate this one need to be detected first. */ |
12 | |
13 | #include <boost/predef/compiler/clang.h> |
14 | |
15 | #include <boost/predef/version_number.h> |
16 | #include <boost/predef/make.h> |
17 | |
18 | /*` |
19 | [heading `BOOST_COMP_MSVC`] |
20 | |
21 | [@http://en.wikipedia.org/wiki/Visual_studio Microsoft Visual C/C++] compiler. |
22 | Version number available as major, minor, and patch. |
23 | |
24 | [table |
25 | [[__predef_symbol__] [__predef_version__]] |
26 | |
27 | [[`_MSC_VER`] [__predef_detection__]] |
28 | |
29 | [[`_MSC_FULL_VER`] [V.R.P]] |
30 | [[`_MSC_VER`] [V.R.0]] |
31 | ] |
32 | |
33 | [note Release of Visual Studio after 2015 will no longer be identified |
34 | by Boost Predef as the marketing version number. Instead we use the |
35 | compiler version number directly, i.e. the _MSC_VER number.] |
36 | */ |
37 | |
38 | #define BOOST_COMP_MSVC BOOST_VERSION_NUMBER_NOT_AVAILABLE |
39 | |
40 | #if defined(_MSC_VER) |
41 | # if !defined (_MSC_FULL_VER) |
42 | # define BOOST_COMP_MSVC_BUILD 0 |
43 | # else |
44 | /* how many digits does the build number have? */ |
45 | # if _MSC_FULL_VER / 10000 == _MSC_VER |
46 | /* four digits */ |
47 | # define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 10000) |
48 | # elif _MSC_FULL_VER / 100000 == _MSC_VER |
49 | /* five digits */ |
50 | # define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 100000) |
51 | # else |
52 | # error "Cannot determine build number from _MSC_FULL_VER" |
53 | # endif |
54 | # endif |
55 | /* |
56 | VS2014 was skipped in the release sequence for MS. Which |
57 | means that the compiler and VS product versions are no longer |
58 | in sync. Hence we need to use different formulas for |
59 | mapping from MSC version to VS product version. |
60 | |
61 | VS2017 is a total nightmare when it comes to version numbers. |
62 | Hence to avoid arguments relating to that both present and |
63 | future.. Any version after VS2015 will use solely the compiler |
64 | version, i.e. cl.exe, as the version number here. |
65 | */ |
66 | # if (_MSC_VER > 1900) |
67 | # define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ |
68 | _MSC_VER/100,\ |
69 | _MSC_VER%100,\ |
70 | BOOST_COMP_MSVC_BUILD) |
71 | # elif (_MSC_VER >= 1900) |
72 | # define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ |
73 | _MSC_VER/100-5,\ |
74 | _MSC_VER%100,\ |
75 | BOOST_COMP_MSVC_BUILD) |
76 | # else |
77 | # define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\ |
78 | _MSC_VER/100-6,\ |
79 | _MSC_VER%100,\ |
80 | BOOST_COMP_MSVC_BUILD) |
81 | # endif |
82 | #endif |
83 | |
84 | #ifdef BOOST_COMP_MSVC_DETECTION |
85 | # if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED) |
86 | # define BOOST_COMP_MSVC_EMULATED BOOST_COMP_MSVC_DETECTION |
87 | # else |
88 | # undef BOOST_COMP_MSVC |
89 | # define BOOST_COMP_MSVC BOOST_COMP_MSVC_DETECTION |
90 | # endif |
91 | # define BOOST_COMP_MSVC_AVAILABLE |
92 | # include <boost/predef/detail/comp_detected.h> |
93 | #endif |
94 | |
95 | #define BOOST_COMP_MSVC_NAME "Microsoft Visual C/C++" |
96 | |
97 | #endif |
98 | |
99 | #include <boost/predef/detail/test.h> |
100 | BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC,BOOST_COMP_MSVC_NAME) |
101 | |
102 | #ifdef BOOST_COMP_MSVC_EMULATED |
103 | #include <boost/predef/detail/test.h> |
104 | BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC_EMULATED,BOOST_COMP_MSVC_NAME) |
105 | #endif |
106 | |