visualc.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. #ifndef BOOST_PREDEF_COMPILER_VISUALC_H
  8. #define BOOST_PREDEF_COMPILER_VISUALC_H
  9. /* Other compilers that emulate this one need to be detected first. */
  10. #include <boost/predef/compiler/clang.h>
  11. #include <boost/predef/version_number.h>
  12. #include <boost/predef/make.h>
  13. /*`
  14. [heading `BOOST_COMP_MSVC`]
  15. [@http://en.wikipedia.org/wiki/Visual_studio Microsoft Visual C/C++] compiler.
  16. Version number available as major, minor, and patch.
  17. [table
  18. [[__predef_symbol__] [__predef_version__]]
  19. [[`_MSC_VER`] [__predef_detection__]]
  20. [[`_MSC_FULL_VER`] [V.R.P]]
  21. [[`_MSC_VER`] [V.R.0]]
  22. ]
  23. */
  24. #define BOOST_COMP_MSVC BOOST_VERSION_NUMBER_NOT_AVAILABLE
  25. #if defined(_MSC_VER)
  26. # if !defined (_MSC_FULL_VER)
  27. # define BOOST_COMP_MSVC_BUILD 0
  28. # else
  29. /* how many digits does the build number have? */
  30. # if _MSC_FULL_VER / 10000 == _MSC_VER
  31. /* four digits */
  32. # define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 10000)
  33. # elif _MSC_FULL_VER / 100000 == _MSC_VER
  34. /* five digits */
  35. # define BOOST_COMP_MSVC_BUILD (_MSC_FULL_VER % 100000)
  36. # else
  37. # error "Cannot determine build number from _MSC_FULL_VER"
  38. # endif
  39. # endif
  40. /*
  41. VS2014 was skipped in the release sequence for MS. Which
  42. means that the compiler and VS product versions are no longer
  43. in sync. Hence we need to use different formulas for
  44. mapping from MSC version to VS product version.
  45. */
  46. # if (_MSC_VER >= 1900)
  47. # define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\
  48. _MSC_VER/100-5,\
  49. _MSC_VER%100,\
  50. BOOST_COMP_MSVC_BUILD)
  51. # else
  52. # define BOOST_COMP_MSVC_DETECTION BOOST_VERSION_NUMBER(\
  53. _MSC_VER/100-6,\
  54. _MSC_VER%100,\
  55. BOOST_COMP_MSVC_BUILD)
  56. # endif
  57. #endif
  58. #ifdef BOOST_COMP_MSVC_DETECTION
  59. # if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
  60. # define BOOST_COMP_MSVC_EMULATED BOOST_COMP_MSVC_DETECTION
  61. # else
  62. # undef BOOST_COMP_MSVC
  63. # define BOOST_COMP_MSVC BOOST_COMP_MSVC_DETECTION
  64. # endif
  65. # define BOOST_COMP_MSVC_AVAILABLE
  66. # include <boost/predef/detail/comp_detected.h>
  67. #endif
  68. #define BOOST_COMP_MSVC_NAME "Microsoft Visual C/C++"
  69. #endif
  70. #include <boost/predef/detail/test.h>
  71. BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC,BOOST_COMP_MSVC_NAME)
  72. #ifdef BOOST_COMP_MSVC_EMULATED
  73. #include <boost/predef/detail/test.h>
  74. BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MSVC_EMULATED,BOOST_COMP_MSVC_NAME)
  75. #endif