1 | #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED |
2 | #define BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED |
3 | |
4 | // Copyright 2016, 2018, 2019 Peter Dimov. |
5 | // |
6 | // Distributed under the Boost Software License, Version 1.0. |
7 | // |
8 | // See accompanying file LICENSE_1_0.txt or copy at |
9 | // http://www.boost.org/LICENSE_1_0.txt |
10 | |
11 | // BOOST_MP11_WORKAROUND |
12 | |
13 | #if defined( BOOST_STRICT_CONFIG ) || defined( BOOST_MP11_NO_WORKAROUNDS ) |
14 | |
15 | # define BOOST_MP11_WORKAROUND( symbol, test ) 0 |
16 | |
17 | #else |
18 | |
19 | # define BOOST_MP11_WORKAROUND( symbol, test ) ((symbol) != 0 && ((symbol) test)) |
20 | |
21 | #endif |
22 | |
23 | // |
24 | |
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 |
30 | |
31 | #define BOOST_MP11_CONSTEXPR constexpr |
32 | |
33 | #if defined( __CUDACC__ ) |
34 | |
35 | // nvcc |
36 | |
37 | # undef BOOST_MP11_CUDA |
38 | # define BOOST_MP11_CUDA (__CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__) |
39 | |
40 | // CUDA (8.0) has no constexpr support in msvc mode: |
41 | # if defined(_MSC_VER) && (BOOST_MP11_CUDA < 9000000) |
42 | |
43 | # define BOOST_MP11_NO_CONSTEXPR |
44 | |
45 | # undef BOOST_MP11_CONSTEXPR |
46 | # define BOOST_MP11_CONSTEXPR |
47 | |
48 | # endif |
49 | |
50 | #elif defined(__clang__) |
51 | |
52 | // Clang |
53 | |
54 | # undef BOOST_MP11_CLANG |
55 | # define BOOST_MP11_CLANG (__clang_major__ * 100 + __clang_minor__) |
56 | |
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 |
60 | # endif |
61 | # endif |
62 | |
63 | #if BOOST_MP11_CLANG < 400 && __cplusplus >= 201402L \ |
64 | && defined( __GLIBCXX__ ) && !__has_include(<shared_mutex>) |
65 | |
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 |
68 | |
69 | extern "C" char *gets (char *__s); |
70 | #endif |
71 | |
72 | #elif defined(__INTEL_COMPILER) |
73 | |
74 | // Intel C++ |
75 | |
76 | # undef BOOST_MP11_INTEL |
77 | # define BOOST_MP11_INTEL __INTEL_COMPILER |
78 | |
79 | #elif defined(__GNUC__) |
80 | |
81 | // g++ |
82 | |
83 | # undef BOOST_MP11_GCC |
84 | # define BOOST_MP11_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) |
85 | |
86 | #elif defined(_MSC_VER) |
87 | |
88 | // MS Visual C++ |
89 | |
90 | # undef BOOST_MP11_MSVC |
91 | # define BOOST_MP11_MSVC _MSC_VER |
92 | |
93 | # if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) |
94 | # define BOOST_MP11_NO_CONSTEXPR |
95 | # endif |
96 | |
97 | #if _MSC_FULL_VER < 190024210 // 2015u3 |
98 | # undef BOOST_MP11_CONSTEXPR |
99 | # define BOOST_MP11_CONSTEXPR |
100 | #endif |
101 | |
102 | #endif |
103 | |
104 | // BOOST_MP11_HAS_CXX14_CONSTEXPR |
105 | |
106 | #if !defined(BOOST_MP11_NO_CONSTEXPR) && defined(__cpp_constexpr) && __cpp_constexpr >= 201304 |
107 | # define BOOST_MP11_HAS_CXX14_CONSTEXPR |
108 | #endif |
109 | |
110 | // BOOST_MP11_HAS_FOLD_EXPRESSIONS |
111 | |
112 | #if !defined(BOOST_MP11_HAS_FOLD_EXPRESSIONS) && defined(__cpp_fold_expressions) && __cpp_fold_expressions >= 201603 |
113 | # define BOOST_MP11_HAS_FOLD_EXPRESSIONS |
114 | #endif |
115 | |
116 | // BOOST_MP11_HAS_TYPE_PACK_ELEMENT |
117 | |
118 | #if defined(__has_builtin) |
119 | # if __has_builtin(__type_pack_element) |
120 | # define BOOST_MP11_HAS_TYPE_PACK_ELEMENT |
121 | # endif |
122 | #endif |
123 | |
124 | // BOOST_MP11_DEPRECATED(msg) |
125 | |
126 | #if BOOST_MP11_WORKAROUND( BOOST_MP11_CLANG, < 304 ) |
127 | # define BOOST_MP11_DEPRECATED(msg) |
128 | #elif defined(__GNUC__) || defined(__clang__) |
129 | # define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg))) |
130 | #elif defined(_MSC_VER) && _MSC_VER >= 1900 |
131 | # define BOOST_MP11_DEPRECATED(msg) [[deprecated(msg)]] |
132 | #else |
133 | # define BOOST_MP11_DEPRECATED(msg) |
134 | #endif |
135 | |
136 | #endif // #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED |
137 | |