1 #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED
2 #define BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED
4 // Copyright 2016, 2018, 2019 Peter Dimov.
6 // Distributed under the Boost Software License, Version 1.0.
8 // See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt
11 // BOOST_MP11_WORKAROUND
13 #if defined( BOOST_STRICT_CONFIG ) || defined( BOOST_MP11_NO_WORKAROUNDS )
15 # define BOOST_MP11_WORKAROUND( symbol, test ) 0
19 # define BOOST_MP11_WORKAROUND( symbol, test ) ((symbol) != 0 && ((symbol) test))
25 #define BOOST_MP11_CUDA 0
26 #define BOOST_MP11_CLANG 0
27 #define BOOST_MP11_INTEL 0
28 #define BOOST_MP11_GCC 0
29 #define BOOST_MP11_MSVC 0
31 #define BOOST_MP11_CONSTEXPR constexpr
33 #if defined( __CUDACC__ )
37 # undef BOOST_MP11_CUDA
38 # define BOOST_MP11_CUDA (__CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__)
40 // CUDA (8.0) has no constexpr support in msvc mode:
41 # if defined(_MSC_VER) && (BOOST_MP11_CUDA < 9000000)
43 # define BOOST_MP11_NO_CONSTEXPR
45 # undef BOOST_MP11_CONSTEXPR
46 # define BOOST_MP11_CONSTEXPR
50 #elif defined(__clang__)
54 # undef BOOST_MP11_CLANG
55 # define BOOST_MP11_CLANG (__clang_major__ * 100 + __clang_minor__)
57 # if defined(__has_cpp_attribute)
58 # if __has_cpp_attribute(fallthrough) && __cplusplus >= 201406L // Clang 3.9+ in c++1z mode
59 # define BOOST_MP11_HAS_FOLD_EXPRESSIONS
63 #if BOOST_MP11_CLANG < 400 && __cplusplus >= 201402L \
64 && defined( __GLIBCXX__ ) && !__has_include(<shared_mutex>)
66 // Clang pre-4 in C++14 mode, libstdc++ pre-4.9, ::gets is not defined,
67 // but Clang tries to import it into std
69 extern "C" char *gets (char *__s);
72 #elif defined(__INTEL_COMPILER)
76 # undef BOOST_MP11_INTEL
77 # define BOOST_MP11_INTEL __INTEL_COMPILER
79 #elif defined(__GNUC__)
83 # undef BOOST_MP11_GCC
84 # define BOOST_MP11_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
86 #elif defined(_MSC_VER)
90 # undef BOOST_MP11_MSVC
91 # define BOOST_MP11_MSVC _MSC_VER
93 # if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 )
94 # define BOOST_MP11_NO_CONSTEXPR
97 #if _MSC_FULL_VER < 190024210 // 2015u3
98 # undef BOOST_MP11_CONSTEXPR
99 # define BOOST_MP11_CONSTEXPR
104 // BOOST_MP11_HAS_CXX14_CONSTEXPR
106 #if !defined(BOOST_MP11_NO_CONSTEXPR) && defined(__cpp_constexpr) && __cpp_constexpr >= 201304
107 # define BOOST_MP11_HAS_CXX14_CONSTEXPR
110 // BOOST_MP11_HAS_FOLD_EXPRESSIONS
112 #if !defined(BOOST_MP11_HAS_FOLD_EXPRESSIONS) && defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603
113 # define BOOST_MP11_HAS_FOLD_EXPRESSIONS
116 // BOOST_MP11_HAS_TYPE_PACK_ELEMENT
118 #if defined(__has_builtin)
119 # if __has_builtin(__type_pack_element)
120 # define BOOST_MP11_HAS_TYPE_PACK_ELEMENT
124 // BOOST_MP11_DEPRECATED(msg)
126 #if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 )
127 # define BOOST_MP11_DEPRECATED(msg)
128 #elif BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 50000 )
129 # define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg)))
130 #elif BOOST_MP11_WORKAROUND( BOOST_MP11_CLANG, < 304 )
131 # define BOOST_MP11_DEPRECATED(msg)
132 #elif BOOST_MP11_CLANG
133 // -pedantic warns about [[deprecated]] when in C++11 mode
134 # define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg)))
136 # define BOOST_MP11_DEPRECATED(msg) [[deprecated(msg)]]
139 #endif // #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED