]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/config/compiler/xlcpp.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / config / compiler / xlcpp.hpp
1 // (C) Copyright Douglas Gregor 2010
2 //
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 // See http://www.boost.org for most recent version.
8
9 // compiler setup for IBM XL C/C++ for Linux (Little Endian) based on clang.
10
11 #define BOOST_HAS_PRAGMA_ONCE
12
13 // Detecting `-fms-extension` compiler flag assuming that _MSC_VER defined when that flag is used.
14 #if defined (_MSC_VER) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
15 # define BOOST_HAS_PRAGMA_DETECT_MISMATCH
16 #endif
17
18 // When compiling with clang before __has_extension was defined,
19 // even if one writes 'defined(__has_extension) && __has_extension(xxx)',
20 // clang reports a compiler error. So the only workaround found is:
21
22 #ifndef __has_extension
23 #define __has_extension __has_feature
24 #endif
25
26 #ifndef __has_cpp_attribute
27 #define __has_cpp_attribute(x) 0
28 #endif
29
30 #if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS)
31 # define BOOST_NO_EXCEPTIONS
32 #endif
33
34 #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI)
35 # define BOOST_NO_RTTI
36 #endif
37
38 #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID)
39 # define BOOST_NO_TYPEID
40 #endif
41
42 #if defined(__int64) && !defined(__GNUC__)
43 # define BOOST_HAS_MS_INT64
44 #endif
45
46 #define BOOST_HAS_NRVO
47
48 // Branch prediction hints
49 #if defined(__has_builtin)
50 #if __has_builtin(__builtin_expect)
51 #define BOOST_LIKELY(x) __builtin_expect(x, 1)
52 #define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
53 #endif
54 #endif
55
56 // Clang supports "long long" in all compilation modes.
57 #define BOOST_HAS_LONG_LONG
58
59 //
60 // Dynamic shared object (DSO) and dynamic-link library (DLL) support
61 //
62 #if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
63 # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
64 # define BOOST_SYMBOL_IMPORT
65 # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
66 #endif
67
68 //
69 // The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
70 // between switch labels.
71 //
72 #if __cplusplus >= 201103L && defined(__has_warning)
73 # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
74 # define BOOST_FALLTHROUGH [[clang::fallthrough]]
75 # endif
76 #endif
77
78 #if !__has_feature(cxx_auto_type)
79 # define BOOST_NO_CXX11_AUTO_DECLARATIONS
80 # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
81 #endif
82
83 //
84 // Currently clang on Windows using VC++ RTL does not support C++11's char16_t or char32_t
85 //
86 #if defined(_MSC_VER) || !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
87 # define BOOST_NO_CXX11_CHAR16_T
88 # define BOOST_NO_CXX11_CHAR32_T
89 #endif
90
91 #if !__has_feature(cxx_constexpr)
92 # define BOOST_NO_CXX11_CONSTEXPR
93 #endif
94
95 #if !__has_feature(cxx_decltype)
96 # define BOOST_NO_CXX11_DECLTYPE
97 #endif
98
99 #if !__has_feature(cxx_decltype_incomplete_return_types)
100 # define BOOST_NO_CXX11_DECLTYPE_N3276
101 #endif
102
103 #if !__has_feature(cxx_defaulted_functions)
104 # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
105 #endif
106
107 #if !__has_feature(cxx_deleted_functions)
108 # define BOOST_NO_CXX11_DELETED_FUNCTIONS
109 #endif
110
111 #if !__has_feature(cxx_explicit_conversions)
112 # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
113 #endif
114
115 #if !__has_feature(cxx_default_function_template_args)
116 # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
117 #endif
118
119 #if !__has_feature(cxx_generalized_initializers)
120 # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
121 #endif
122
123 #if !__has_feature(cxx_lambdas)
124 # define BOOST_NO_CXX11_LAMBDAS
125 #endif
126
127 #if !__has_feature(cxx_local_type_template_args)
128 # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
129 #endif
130
131 #if !__has_feature(cxx_noexcept)
132 # define BOOST_NO_CXX11_NOEXCEPT
133 #endif
134
135 #if !__has_feature(cxx_nullptr)
136 # define BOOST_NO_CXX11_NULLPTR
137 #endif
138
139 #if !__has_feature(cxx_range_for)
140 # define BOOST_NO_CXX11_RANGE_BASED_FOR
141 #endif
142
143 #if !__has_feature(cxx_raw_string_literals)
144 # define BOOST_NO_CXX11_RAW_LITERALS
145 #endif
146
147 #if !__has_feature(cxx_reference_qualified_functions)
148 # define BOOST_NO_CXX11_REF_QUALIFIERS
149 #endif
150
151 #if !__has_feature(cxx_generalized_initializers)
152 # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
153 #endif
154
155 #if !__has_feature(cxx_rvalue_references)
156 # define BOOST_NO_CXX11_RVALUE_REFERENCES
157 #endif
158
159 #if !__has_feature(cxx_strong_enums)
160 # define BOOST_NO_CXX11_SCOPED_ENUMS
161 #endif
162
163 #if !__has_feature(cxx_static_assert)
164 # define BOOST_NO_CXX11_STATIC_ASSERT
165 #endif
166
167 #if !__has_feature(cxx_alias_templates)
168 # define BOOST_NO_CXX11_TEMPLATE_ALIASES
169 #endif
170
171 #if !__has_feature(cxx_unicode_literals)
172 # define BOOST_NO_CXX11_UNICODE_LITERALS
173 #endif
174
175 #if !__has_feature(cxx_variadic_templates)
176 # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
177 #endif
178
179 #if !__has_feature(cxx_user_literals)
180 # define BOOST_NO_CXX11_USER_DEFINED_LITERALS
181 #endif
182
183 #if !__has_feature(cxx_alignas)
184 # define BOOST_NO_CXX11_ALIGNAS
185 #endif
186
187 #if !__has_feature(cxx_trailing_return)
188 # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
189 #endif
190
191 #if !__has_feature(cxx_inline_namespaces)
192 # define BOOST_NO_CXX11_INLINE_NAMESPACES
193 #endif
194
195 #if !__has_feature(cxx_override_control)
196 # define BOOST_NO_CXX11_FINAL
197 # define BOOST_NO_CXX11_OVERRIDE
198 #endif
199
200 #if !__has_feature(cxx_unrestricted_unions)
201 # define BOOST_NO_CXX11_UNRESTRICTED_UNION
202 #endif
203
204 #if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))
205 # define BOOST_NO_CXX14_BINARY_LITERALS
206 #endif
207
208 #if !__has_feature(__cxx_decltype_auto__)
209 # define BOOST_NO_CXX14_DECLTYPE_AUTO
210 #endif
211
212 #if !__has_feature(__cxx_aggregate_nsdmi__)
213 # define BOOST_NO_CXX14_AGGREGATE_NSDMI
214 #endif
215
216 #if !__has_feature(__cxx_init_captures__)
217 # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
218 #endif
219
220 #if !__has_feature(__cxx_generic_lambdas__)
221 # define BOOST_NO_CXX14_GENERIC_LAMBDAS
222 #endif
223
224 // clang < 3.5 has a defect with dependent type, like following.
225 //
226 // template <class T>
227 // constexpr typename enable_if<pred<T> >::type foo(T &)
228 // { } // error: no return statement in constexpr function
229 //
230 // This issue also affects C++11 mode, but C++11 constexpr requires return stmt.
231 // Therefore we don't care such case.
232 //
233 // Note that we can't check Clang version directly as the numbering system changes depending who's
234 // creating the Clang release (see https://github.com/boostorg/config/pull/39#issuecomment-59927873)
235 // so instead verify that we have a feature that was introduced at the same time as working C++14
236 // constexpr (generic lambda's in this case):
237 //
238 #if !__has_feature(__cxx_generic_lambdas__) || !__has_feature(__cxx_relaxed_constexpr__)
239 # define BOOST_NO_CXX14_CONSTEXPR
240 #endif
241
242 #if !__has_feature(__cxx_return_type_deduction__)
243 # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
244 #endif
245
246 #if !__has_feature(__cxx_variable_templates__)
247 # define BOOST_NO_CXX14_VARIABLE_TEMPLATES
248 #endif
249
250 #if !defined(__cpp_structured_bindings) || (__cpp_structured_bindings < 201606)
251 # define BOOST_NO_CXX17_STRUCTURED_BINDINGS
252 #endif
253
254 #if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606)
255 # define BOOST_NO_CXX17_IF_CONSTEXPR
256 #endif
257
258 // Clang 3.9+ in c++1z
259 #if !__has_cpp_attribute(fallthrough) || __cplusplus < 201406L
260 # define BOOST_NO_CXX17_INLINE_VARIABLES
261 # define BOOST_NO_CXX17_FOLD_EXPRESSIONS
262 #endif
263
264 #if !__has_feature(cxx_thread_local)
265 # define BOOST_NO_CXX11_THREAD_LOCAL
266 #endif
267
268 #if __cplusplus < 201400
269 // All versions with __cplusplus above this value seem to support this:
270 # define BOOST_NO_CXX14_DIGIT_SEPARATORS
271 #endif
272
273
274 // Unused attribute:
275 #if defined(__GNUC__) && (__GNUC__ >= 4)
276 # define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
277 #endif
278
279 // Type aliasing hint.
280 #if __has_attribute(__may_alias__)
281 # define BOOST_MAY_ALIAS __attribute__((__may_alias__))
282 #endif
283
284 #ifndef BOOST_COMPILER
285 # define BOOST_COMPILER "Clang version " __clang_version__
286 #endif
287
288 // Macro used to identify the Clang compiler.
289 #define BOOST_CLANG 1
290
291 #define BOOST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)