MessagePack for C
visualc.h
Go to the documentation of this file.
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 MSGPACK_PREDEF_COMPILER_VISUALC_H
9 #define MSGPACK_PREDEF_COMPILER_VISUALC_H
10 
11 /* Other compilers that emulate this one need to be detected first. */
12 
14 
16 #include <msgpack/predef/make.h>
17 
18 /*`
19 [heading `MSGPACK_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 
34 #define MSGPACK_COMP_MSVC MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
35 
36 #if defined(_MSC_VER)
37 # if !defined (_MSC_FULL_VER)
38 # define MSGPACK_COMP_MSVC_BUILD 0
39 # else
40  /* how many digits does the build number have? */
41 # if _MSC_FULL_VER / 10000 == _MSC_VER
42  /* four digits */
43 # define MSGPACK_COMP_MSVC_BUILD (_MSC_FULL_VER % 10000)
44 # elif _MSC_FULL_VER / 100000 == _MSC_VER
45  /* five digits */
46 # define MSGPACK_COMP_MSVC_BUILD (_MSC_FULL_VER % 100000)
47 # else
48 # error "Cannot determine build number from _MSC_FULL_VER"
49 # endif
50 # endif
51  /*
52  VS2014 was skipped in the release sequence for MS. Which
53  means that the compiler and VS product versions are no longer
54  in sync. Hence we need to use different formulas for
55  mapping from MSC version to VS product version.
56  */
57 # if (_MSC_VER >= 1900)
58 # define MSGPACK_COMP_MSVC_DETECTION MSGPACK_VERSION_NUMBER(\
59  _MSC_VER/100-5,\
60  _MSC_VER%100,\
61  MSGPACK_COMP_MSVC_BUILD)
62 # else
63 # define MSGPACK_COMP_MSVC_DETECTION MSGPACK_VERSION_NUMBER(\
64  _MSC_VER/100-6,\
65  _MSC_VER%100,\
66  MSGPACK_COMP_MSVC_BUILD)
67 # endif
68 #endif
69 
70 #ifdef MSGPACK_COMP_MSVC_DETECTION
71 # if defined(MSGPACK_PREDEF_DETAIL_COMP_DETECTED)
72 # define MSGPACK_COMP_MSVC_EMULATED MSGPACK_COMP_MSVC_DETECTION
73 # else
74 # undef MSGPACK_COMP_MSVC
75 # define MSGPACK_COMP_MSVC MSGPACK_COMP_MSVC_DETECTION
76 # endif
77 # define MSGPACK_COMP_MSVC_AVAILABLE
79 #endif
80 
81 #define MSGPACK_COMP_MSVC_NAME "Microsoft Visual C/C++"
82 
83 #endif
84 
87 
88 #ifdef MSGPACK_COMP_MSVC_EMULATED
90 MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_COMP_MSVC_EMULATED,MSGPACK_COMP_MSVC_NAME)
91 #endif
#define MSGPACK_PREDEF_DECLARE_TEST(x, s)
Definition: test.h:13
#define MSGPACK_COMP_MSVC_NAME
Definition: visualc.h:81
#define MSGPACK_COMP_MSVC
Definition: visualc.h:34