config.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. #elif defined(__clang__)
  33. // Clang
  34. # undef BOOST_MP11_CLANG
  35. # define BOOST_MP11_CLANG (__clang_major__ * 100 + __clang_minor__)
  36. # if defined(__has_cpp_attribute)
  37. # if __has_cpp_attribute(fallthrough) && __cplusplus >= 201406L // Clang 3.9+ in c++1z mode
  38. # define BOOST_MP11_HAS_FOLD_EXPRESSIONS
  39. # endif
  40. # endif
  41. #if BOOST_MP11_CLANG < 400 && __cplusplus >= 201402L \
  42. && defined( __GLIBCXX__ ) && !__has_include(<shared_mutex>)
  43. // Clang pre-4 in C++14 mode, libstdc++ pre-4.9, ::gets is not defined,
  44. // but Clang tries to import it into std
  45. extern "C" char *gets (char *__s);
  46. #endif
  47. #elif defined(__INTEL_COMPILER)
  48. // Intel C++
  49. # undef BOOST_MP11_INTEL
  50. # define BOOST_MP11_INTEL __INTEL_COMPILER
  51. #elif defined(__GNUC__)
  52. // g++
  53. # undef BOOST_MP11_GCC
  54. # define BOOST_MP11_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
  55. #elif defined(_MSC_VER)
  56. // MS Visual C++
  57. # undef BOOST_MP11_MSVC
  58. # define BOOST_MP11_MSVC _MSC_VER
  59. # if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
  60. # define BOOST_MP11_NO_CONSTEXPR
  61. # endif
  62. #if _MSC_FULL_VER < 190024210 // 2015u3
  63. # undef BOOST_MP11_CONSTEXPR
  64. # define BOOST_MP11_CONSTEXPR
  65. #endif
  66. #endif
  67. // BOOST_MP11_HAS_CXX14_CONSTEXPR
  68. #if !defined(BOOST_MP11_NO_CONSTEXPR) && defined(__cpp_constexpr) && __cpp_constexpr >= 201304
  69. # define BOOST_MP11_HAS_CXX14_CONSTEXPR
  70. #endif
  71. // BOOST_MP11_HAS_FOLD_EXPRESSIONS
  72. #if !defined(BOOST_MP11_HAS_FOLD_EXPRESSIONS) && defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603
  73. # define BOOST_MP11_HAS_FOLD_EXPRESSIONS
  74. #endif
  75. // BOOST_MP11_HAS_TYPE_PACK_ELEMENT
  76. #if defined(__has_builtin)
  77. # if __has_builtin(__type_pack_element)
  78. # define BOOST_MP11_HAS_TYPE_PACK_ELEMENT
  79. # endif
  80. #endif
  81. // BOOST_MP11_DEPRECATED(msg)
  82. #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 )
  83. # define BOOST_MP11_DEPRECATED(msg)
  84. #elif BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 50000 )
  85. # define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg)))
  86. #elif BOOST_MP11_WORKAROUND( BOOST_MP11_CLANG, < 304 )
  87. # define BOOST_MP11_DEPRECATED(msg)
  88. #elif BOOST_MP11_CLANG
  89. // -pedantic warns about [[deprecated]] when in C++11 mode
  90. # define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg)))
  91. #else
  92. # define BOOST_MP11_DEPRECATED(msg) [[deprecated(msg)]]
  93. #endif
  94. #endif // #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED