config.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED
  2. #define BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED
  3. // Copyright 2016, 2018, 2019 Peter Dimov.
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. //
  7. // See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt
  9. // BOOST_MP11_WORKAROUND
  10. #if defined( BOOST_STRICT_CONFIG ) || defined( BOOST_MP11_NO_WORKAROUNDS )
  11. # define BOOST_MP11_WORKAROUND( symbol, test ) 0
  12. #else
  13. # define BOOST_MP11_WORKAROUND( symbol, test ) ((symbol) != 0 && ((symbol) test))
  14. #endif
  15. //
  16. #define BOOST_MP11_CUDA 0
  17. #define BOOST_MP11_CLANG 0
  18. #define BOOST_MP11_INTEL 0
  19. #define BOOST_MP11_GCC 0
  20. #define BOOST_MP11_MSVC 0
  21. #define BOOST_MP11_CONSTEXPR constexpr
  22. #if defined( __CUDACC__ )
  23. // nvcc
  24. # undef BOOST_MP11_CUDA
  25. # define BOOST_MP11_CUDA (__CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__)
  26. // CUDA (8.0) has no constexpr support in msvc mode:
  27. # if defined(_MSC_VER) && (BOOST_MP11_CUDA < 9000000)
  28. # define BOOST_MP11_NO_CONSTEXPR
  29. # undef BOOST_MP11_CONSTEXPR
  30. # define BOOST_MP11_CONSTEXPR
  31. # endif
  32. #endif
  33. #if defined(__clang__)
  34. // Clang
  35. # undef BOOST_MP11_CLANG
  36. # define BOOST_MP11_CLANG (__clang_major__ * 100 + __clang_minor__)
  37. # if defined(__has_cpp_attribute)
  38. # if __has_cpp_attribute(fallthrough) && __cplusplus >= 201406L // Clang 3.9+ in c++1z mode
  39. # define BOOST_MP11_HAS_FOLD_EXPRESSIONS
  40. # endif
  41. # endif
  42. #if BOOST_MP11_CLANG < 400 && __cplusplus >= 201402L \
  43. && defined( __GLIBCXX__ ) && !__has_include(<shared_mutex>)
  44. // Clang pre-4 in C++14 mode, libstdc++ pre-4.9, ::gets is not defined,
  45. // but Clang tries to import it into std
  46. extern "C" char *gets (char *__s);
  47. #endif
  48. #elif defined(__INTEL_COMPILER)
  49. // Intel C++
  50. # undef BOOST_MP11_INTEL
  51. # define BOOST_MP11_INTEL __INTEL_COMPILER
  52. #elif defined(__GNUC__)
  53. // g++
  54. # undef BOOST_MP11_GCC
  55. # define BOOST_MP11_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
  56. #elif defined(_MSC_VER)
  57. // MS Visual C++
  58. # undef BOOST_MP11_MSVC
  59. # define BOOST_MP11_MSVC _MSC_VER
  60. # if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
  61. # define BOOST_MP11_NO_CONSTEXPR
  62. # endif
  63. #if _MSC_FULL_VER < 190024210 // 2015u3
  64. # undef BOOST_MP11_CONSTEXPR
  65. # define BOOST_MP11_CONSTEXPR
  66. #endif
  67. #endif
  68. // BOOST_MP11_HAS_CXX14_CONSTEXPR
  69. #if !defined(BOOST_MP11_NO_CONSTEXPR) && defined(__cpp_constexpr) && __cpp_constexpr >= 201304
  70. # define BOOST_MP11_HAS_CXX14_CONSTEXPR
  71. #endif
  72. // BOOST_MP11_HAS_FOLD_EXPRESSIONS
  73. #if !defined(BOOST_MP11_HAS_FOLD_EXPRESSIONS) && defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603
  74. # define BOOST_MP11_HAS_FOLD_EXPRESSIONS
  75. #endif
  76. // BOOST_MP11_HAS_TYPE_PACK_ELEMENT
  77. #if defined(__has_builtin)
  78. # if __has_builtin(__type_pack_element)
  79. # define BOOST_MP11_HAS_TYPE_PACK_ELEMENT
  80. # endif
  81. #endif
  82. // BOOST_MP11_HAS_TEMPLATE_AUTO
  83. #if defined(__cpp_nontype_template_parameter_auto) && __cpp_nontype_template_parameter_auto >= 201606L
  84. # define BOOST_MP11_HAS_TEMPLATE_AUTO
  85. #endif
  86. #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
  87. // mp_value<0> is bool, mp_value<-1L> is int, etc
  88. # undef BOOST_MP11_HAS_TEMPLATE_AUTO
  89. #endif
  90. // BOOST_MP11_DEPRECATED(msg)
  91. #if BOOST_MP11_WORKAROUND( BOOST_MP11_CLANG, < 304 )
  92. # define BOOST_MP11_DEPRECATED(msg)
  93. #elif defined(__GNUC__) || defined(__clang__)
  94. # define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg)))
  95. #elif defined(_MSC_VER) && _MSC_VER >= 1900
  96. # define BOOST_MP11_DEPRECATED(msg) [[deprecated(msg)]]
  97. #else
  98. # define BOOST_MP11_DEPRECATED(msg)
  99. #endif
  100. #endif // #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED