]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/hana/config.hpp
update ceph source to reef 18.1.2
[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
24 # if _MSC_VER < 1915
25 # pragma message("Warning: the native Microsoft compiler is not supported due to lack of proper C++14 support.")
26 # else
27 // 1. Active issues
28 // Multiple copy/move ctors
29 # define BOOST_HANA_WORKAROUND_MSVC_MULTIPLECTOR_106654
30
31 // 2. Issues fixed in the development branch of MSVC
32 // Forward declaration of class template member function returning decltype(auto)
33 # define BOOST_HANA_WORKAROUND_MSVC_DECLTYPEAUTO_RETURNTYPE_662735
34
35 // 3. Issues fixed conditionally
36 // Requires __declspec(empty_bases)
37 // Empty base optimization
38 # define BOOST_HANA_WORKAROUND_MSVC_EMPTYBASE
39
40 // Requires /experimental:preprocessor
41 // Variadic macro expansion
42 # if !defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL
43 # define BOOST_HANA_WORKAROUND_MSVC_PREPROCESSOR_616033
44 # endif
45 # endif
46
47 #elif defined(__clang__) && defined(_MSC_VER) // Clang-cl (Clang for Windows)
48
49 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION( \
50 __clang_major__, __clang_minor__, __clang_patchlevel__)
51
52 #elif defined(__clang__) && defined(__apple_build_version__) // Apple's Clang
53
54 # if __apple_build_version__ >= 6020049
55 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION(3, 6, 0)
56 # endif
57
58 #elif defined(__clang__) // genuine Clang
59
60 # define BOOST_HANA_CONFIG_CLANG BOOST_HANA_CONFIG_VERSION( \
61 __clang_major__, __clang_minor__, __clang_patchlevel__)
62
63 #elif defined(__GNUC__) // GCC
64
65 # define BOOST_HANA_CONFIG_GCC BOOST_HANA_CONFIG_VERSION( \
66 __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
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 # if _MSC_VER < 1915
76 # 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'.")
77 # endif
78 # else
79 # warning "Your compiler doesn't provide C++14 or higher capabilities. Try adding the compiler flag '-std=c++14' or '-std=c++1y'."
80 # endif
81 #endif
82
83 //////////////////////////////////////////////////////////////////////////////
84 // Caveats and other compiler-dependent options
85 //////////////////////////////////////////////////////////////////////////////
86
87 // `BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA` enables some constructs requiring
88 // `constexpr` lambdas, which are in the language starting with C++17.
89 //
90 // Always disabled for now because Clang only has partial support for them
91 // (captureless lambdas only).
92 #if defined(__cplusplus) && __cplusplus > 201402L
93 # define BOOST_HANA_CONSTEXPR_STATELESS_LAMBDA constexpr
94 // # define BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA
95 #else
96 # define BOOST_HANA_CONSTEXPR_STATELESS_LAMBDA /* nothing */
97 #endif
98
99 // `BOOST_HANA_CONSTEXPR_LAMBDA` expands to `constexpr` if constexpr lambdas
100 // are supported and to nothing otherwise.
101 #if defined(BOOST_HANA_CONFIG_HAS_CONSTEXPR_LAMBDA)
102 # define BOOST_HANA_CONSTEXPR_LAMBDA constexpr
103 #else
104 # define BOOST_HANA_CONSTEXPR_LAMBDA /* nothing */
105 #endif
106
107 // `BOOST_HANA_INLINE_VARIABLE` expands to `inline` when C++17 inline variables
108 // are supported, and to nothing otherwise. This allows marking global variables
109 // defined in a header as `inline` to avoid potential ODR violations.
110 #if defined(__cplusplus) && __cplusplus > 201402L
111 # define BOOST_HANA_INLINE_VARIABLE inline
112 #else
113 # define BOOST_HANA_INLINE_VARIABLE /* nothing */
114 #endif
115
116 //////////////////////////////////////////////////////////////////////////////
117 // Library features and options that can be tweaked by users
118 //////////////////////////////////////////////////////////////////////////////
119
120 #if defined(BOOST_HANA_DOXYGEN_INVOKED) || \
121 (defined(NDEBUG) && !defined(BOOST_HANA_CONFIG_DISABLE_ASSERTIONS))
122 //! @ingroup group-config
123 //! Disables the `BOOST_HANA_*_ASSERT` macro & friends.
124 //!
125 //! When this macro is defined, the `BOOST_HANA_*_ASSERT` macro & friends
126 //! are disabled, i.e. they expand to nothing.
127 //!
128 //! This macro is defined automatically when `NDEBUG` is defined. It can
129 //! also be defined by users before including this header or defined on
130 //! the command line.
131 # define BOOST_HANA_CONFIG_DISABLE_ASSERTIONS
132 #endif
133
134 #if defined(BOOST_HANA_DOXYGEN_INVOKED)
135 //! @ingroup group-config
136 //! Disables concept checks in interface methods.
137 //!
138 //! When this macro is not defined (the default), tag-dispatched methods
139 //! will make sure the arguments they are passed are models of the proper
140 //! concept(s). This can be very helpful in catching programming errors,
141 //! but it is also slightly less compile-time efficient. You should
142 //! probably always leave the checks enabled (and hence never define this
143 //! macro), except perhaps in translation units that are compiled very
144 //! often but whose code using Hana is modified very rarely.
145 # define BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
146 #endif
147
148 #if defined(BOOST_HANA_DOXYGEN_INVOKED)
149 //! @ingroup group-config
150 //! Enables usage of the "string literal operator template" GNU extension.
151 //!
152 //! That operator is not part of the language yet, but it is supported by
153 //! both Clang and GCC. This operator allows Hana to provide the nice `_s`
154 //! user-defined literal for creating compile-time strings.
155 //!
156 //! When this macro is not defined, the GNU extension will be not used
157 //! by Hana. Because this is a non-standard extension, the macro is not
158 //! defined by default.
159 # define BOOST_HANA_CONFIG_ENABLE_STRING_UDL
160 #endif
161
162 #if defined(BOOST_HANA_DOXYGEN_INVOKED)
163 //! @ingroup group-config
164 //! Enables additional assertions and sanity checks to be done by Hana.
165 //!
166 //! When this macro is defined (it is __not defined__ by default),
167 //! additional sanity checks may be done by Hana. These checks may
168 //! be costly to perform, either in terms of compilation time or in
169 //! terms of execution time. These checks may help debugging an
170 //! application during its initial development, but they should not
171 //! be enabled as part of the normal configuration.
172 # define BOOST_HANA_CONFIG_ENABLE_DEBUG_MODE
173 #endif
174
175 #endif // !BOOST_HANA_CONFIG_HPP