]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/config.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / hana / config.hpp
1 /*!
2 @file
3 Defines configuration macros used throughout the library.
4
5 @copyright Louis Dionne 2013-2017
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
8 */
9
10 #ifndef BOOST_HANA_CONFIG_HPP
11 #define BOOST_HANA_CONFIG_HPP
12
13 #include <boost/hana/version.hpp>
14
15
16 //////////////////////////////////////////////////////////////////////////////
17 // Detect the compiler
18 //////////////////////////////////////////////////////////////////////////////
19
20 #if defined(_MSC_VER) && !defined(__clang__) // MSVC
21 // This must be checked first, because otherwise it produces a fatal
22 // error due to unrecognized #warning directives used below.
23 # pragma message("Warning: the native Microsoft compiler is not supported due to lack of proper C++14 support.")
24
25 #elif defined(__clang__) && defined(_MSC_VER) // Clang-cl (Clang for Windows)
26
27 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION( \
28 __clang_major__, __clang_minor__, __clang_patchlevel__)
29
30 # if BOOST_HANA_CONFIG_CLANG < BOOST_HANA_CONFIG_VERSION(3, 5, 0)
31 # warning "Versions of Clang prior to 3.5.0 are not supported by Hana."
32 # endif
33
34 # if _MSC_VER < 1900
35 # warning "Clang-cl is only supported with the -fms-compatibility-version parameter set to 19 and above."
36 # endif
37
38 #elif defined(__clang__) && defined(__apple_build_version__) // Apple's Clang
39
40 # if __apple_build_version__ >= 6020049
41 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION(3, 6, 0)
42 # else
43 # warning "Versions of Apple's Clang prior to the one shipped with Xcode 6.3 are not supported by Hana."
44 # endif
45
46 #elif defined(__clang__) // genuine Clang
47
48 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION( \
49 __clang_major__, __clang_minor__, __clang_patchlevel__)
50
51 # if BOOST_HANA_CONFIG_CLANG < BOOST_HANA_CONFIG_VERSION(3, 5, 0)
52 # warning "Versions of Clang prior to 3.5.0 are not supported by Hana."
53 # endif
54
55 #elif defined(__GNUC__) // GCC
56
57 # define BOOST_HANA_CONFIG_GCC BOOST_HANA_CONFIG_VERSION( \
58 __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
59
60 # if BOOST_HANA_CONFIG_GCC < BOOST_HANA_CONFIG_VERSION(6, 0, 0)
61 # warning "Versions of GCC prior to 6.0.0 are not supported by Hana."
62 # endif
63
64 #else
65
66 # warning "Your compiler is not officially supported by Hana or it was not detected properly."
67
68 #endif
69
70 //////////////////////////////////////////////////////////////////////////////
71 // Check the compiler for general C++14 capabilities
72 //////////////////////////////////////////////////////////////////////////////
73 #if (__cplusplus < 201400)
74 # if defined(_MSC_VER)
75 # pragma message("Warning: Your compiler doesn't provide C++14 or higher capabilities. Try adding the compiler flag '-std=c++14' or '-std=c++1y'.")
76 # else
77 # warning "Your compiler doesn't provide C++14 or higher capabilities. Try adding the compiler flag '-std=c++14' or '-std=c++1y'."
78 # endif
79 #endif
80
81 //////////////////////////////////////////////////////////////////////////////
82 // Detect the standard library
83 //////////////////////////////////////////////////////////////////////////////
84
85 // We include this header, which normally defines the proper detection macros.
86 // At least, libc++ and libstdc++ do.
87 #include <cstddef>
88
89 #if defined(_LIBCPP_VERSION)
90
91 # define BOOST_HANA_CONFIG_LIBCPP BOOST_HANA_CONFIG_VERSION( \
92 ((_LIBCPP_VERSION) / 1000) % 10, 0, (_LIBCPP_VERSION) % 1000)
93
94 # if BOOST_HANA_CONFIG_LIBCPP < BOOST_HANA_CONFIG_VERSION(1, 0, 101)
95 # warning "Versions of libc++ prior to the one shipped with Clang 3.5.0 are not supported by Hana."
96 # endif
97
98 #elif defined(__GLIBCXX__)
99
100 // We do not define a macro to keep track of libstdc++'s version, because
101 // we have no scalable way of associating a value of __GLIBCXX__ to the
102 // corresponding GCC release. Instead, we just check that the release date
103 // of the libstdc++ in use is recent enough, which should indicate that it
104 // was released with a GCC >= 5.1, which in turn indicates good enough C++14
105 // support.
106 # if __GLIBCXX__ < 20150422 // --> the libstdc++ shipped with GCC 5.1.0
107 # warning "Versions of libstdc++ prior to the one shipped with GCC 5.1.0 are not supported by Hana for lack of full C++14 support."
108 # endif
109
110 # define BOOST_HANA_CONFIG_LIBSTDCXX
111
112 #elif defined(_MSC_VER)
113
114 # define BOOST_HANA_CONFIG_LIBMSVCCXX
115
116 #else
117
118 # warning "Your standard library is not officially supported by Hana or it was not detected properly."
119
120 #endif
121
122
123 //////////////////////////////////////////////////////////////////////////////
124 // Caveats and other compiler-dependent options
125 //////////////////////////////////////////////////////////////////////////////
126
127 // `BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA` enables some constructs requiring
128 // `constexpr` lambdas, which are in the language starting with C++17.
129 //
130 // Always disabled for now because Clang only has partial support for them
131 // (captureless lambdas only).
132 #if defined(__cplusplus) && __cplusplus > 201402L
133 # define BOOST_HANA_CONSTEXPR_STATELESS_LAMBDA constexpr
134 // # define BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA
135 #else
136 # define BOOST_HANA_CONSTEXPR_STATELESS_LAMBDA /* nothing */
137 #endif
138
139 // `BOOST_HANA_CONSTEXPR_LAMBDA` expands to `constexpr` if constexpr lambdas
140 // are supported and to nothing otherwise.
141 #if defined(BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA)
142 # define BOOST_HANA_CONSTEXPR_LAMBDA constexpr
143 #else
144 # define BOOST_HANA_CONSTEXPR_LAMBDA /* nothing */
145 #endif
146
147 // The std::tuple adapter is broken on libc++ prior to the one shipped
148 // with Clang 3.7.0.
149 #if defined(BOOST_HANA_CONFIG_LIBCPP) && \
150 BOOST_HANA_CONFIG_LIBCPP < BOOST_HANA_CONFIG_VERSION(1, 0, 101)
151 # define BOOST_HANA_CONFIG_HAS_NO_STD_TUPLE_ADAPTER
152 #endif
153
154 // There's a bug in std::tuple_cat in libc++ right now.
155 // See http://llvm.org/bugs/show_bug.cgi?id=22806.
156 #if defined(BOOST_HANA_CONFIG_LIBCPP)
157 # define BOOST_HANA_CONFIG_LIBCPP_HAS_BUG_22806
158 #endif
159
160 //////////////////////////////////////////////////////////////////////////////
161 // Namespace macros
162 //////////////////////////////////////////////////////////////////////////////
163 #define BOOST_HANA_NAMESPACE_BEGIN namespace boost { namespace hana {
164
165 #define BOOST_HANA_NAMESPACE_END }}
166
167 //////////////////////////////////////////////////////////////////////////////
168 // Library features and options that can be tweaked by users
169 //////////////////////////////////////////////////////////////////////////////
170
171 #if defined(BOOST_HANA_DOXYGEN_INVOKED) || \
172 (defined(NDEBUG) && !defined(BOOST_HANA_CONFIG_DISABLE_ASSERTIONS))
173 //! @ingroup group-config
174 //! Disables the `BOOST_HANA_*_ASSERT` macro & friends.
175 //!
176 //! When this macro is defined, the `BOOST_HANA_*_ASSERT` macro & friends
177 //! are disabled, i.e. they expand to nothing.
178 //!
179 //! This macro is defined automatically when `NDEBUG` is defined. It can
180 //! also be defined by users before including this header or defined on
181 //! the command line.
182 # define BOOST_HANA_CONFIG_DISABLE_ASSERTIONS
183 #endif
184
185 #if defined(BOOST_HANA_DOXYGEN_INVOKED)
186 //! @ingroup group-config
187 //! Disables concept checks in interface methods.
188 //!
189 //! When this macro is not defined (the default), tag-dispatched methods
190 //! will make sure the arguments they are passed are models of the proper
191 //! concept(s). This can be very helpful in catching programming errors,
192 //! but it is also slightly less compile-time efficient. You should
193 //! probably always leave the checks enabled (and hence never define this
194 //! macro), except perhaps in translation units that are compiled very
195 //! often but whose code using Hana is modified very rarely.
196 # define BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
197 #endif
198
199 #if defined(BOOST_HANA_DOXYGEN_INVOKED)
200 //! @ingroup group-config
201 //! Enables usage of the "string literal operator template" GNU extension.
202 //!
203 //! That operator is not part of the language yet, but it is supported by
204 //! both Clang and GCC. This operator allows Hana to provide the nice `_s`
205 //! user-defined literal for creating compile-time strings.
206 //!
207 //! When this macro is not defined, the GNU extension will be not used
208 //! by Hana. Because this is a non-standard extension, the macro is not
209 //! defined by default.
210 # define BOOST_HANA_CONFIG_ENABLE_STRING_UDL
211 #endif
212
213 #if defined(BOOST_HANA_DOXYGEN_INVOKED)
214 //! @ingroup group-config
215 //! Enables additional assertions and sanity checks to be done by Hana.
216 //!
217 //! When this macro is defined (it is __not defined__ by default),
218 //! additional sanity checks may be done by Hana. These checks may
219 //! be costly to perform, either in terms of compilation time or in
220 //! terms of execution time. These checks may help debugging an
221 //! application during its initial development, but they should not
222 //! be enabled as part of the normal configuration.
223 # define BOOST_HANA_CONFIG_ENABLE_DEBUG_MODE
224 #endif
225
226 #endif // !BOOST_HANA_CONFIG_HPP