1 // (C) Copyright Douglas Gregor 2010
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)
7 // See http://www.boost.org for most recent version.
9 // compiler setup for IBM XL C/C++ for Linux (Little Endian) based on clang.
11 #define BOOST_HAS_PRAGMA_ONCE
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
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:
22 #ifndef __has_extension
23 #define __has_extension __has_feature
26 #if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS)
27 # define BOOST_NO_EXCEPTIONS
30 #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI)
31 # define BOOST_NO_RTTI
34 #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID)
35 # define BOOST_NO_TYPEID
38 #if defined(__int64) && !defined(__GNUC__)
39 # define BOOST_HAS_MS_INT64
42 #define BOOST_HAS_NRVO
44 // Branch prediction hints
45 #if defined(__has_builtin)
46 #if __has_builtin(__builtin_expect)
47 #define BOOST_LIKELY(x) __builtin_expect(x, 1)
48 #define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
52 // Clang supports "long long" in all compilation modes.
53 #define BOOST_HAS_LONG_LONG
56 // Dynamic shared object (DSO) and dynamic-link library (DLL) support
58 #if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
59 # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
60 # define BOOST_SYMBOL_IMPORT
61 # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
65 // The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
66 // between switch labels.
68 #if __cplusplus >= 201103L && defined(__has_warning)
69 # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
70 # define BOOST_FALLTHROUGH [[clang::fallthrough]]
74 #if !__has_feature(cxx_auto_type)
75 # define BOOST_NO_CXX11_AUTO_DECLARATIONS
76 # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
80 // Currently clang on Windows using VC++ RTL does not support C++11's char16_t or char32_t
82 #if defined(_MSC_VER) || !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
83 # define BOOST_NO_CXX11_CHAR16_T
84 # define BOOST_NO_CXX11_CHAR32_T
87 #if !__has_feature(cxx_constexpr)
88 # define BOOST_NO_CXX11_CONSTEXPR
91 #if !__has_feature(cxx_decltype)
92 # define BOOST_NO_CXX11_DECLTYPE
95 #if !__has_feature(cxx_decltype_incomplete_return_types)
96 # define BOOST_NO_CXX11_DECLTYPE_N3276
99 #if !__has_feature(cxx_defaulted_functions)
100 # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
103 #if !__has_feature(cxx_deleted_functions)
104 # define BOOST_NO_CXX11_DELETED_FUNCTIONS
107 #if !__has_feature(cxx_explicit_conversions)
108 # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
111 #if !__has_feature(cxx_default_function_template_args)
112 # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
115 #if !__has_feature(cxx_generalized_initializers)
116 # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
119 #if !__has_feature(cxx_lambdas)
120 # define BOOST_NO_CXX11_LAMBDAS
123 #if !__has_feature(cxx_local_type_template_args)
124 # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
127 #if !__has_feature(cxx_noexcept)
128 # define BOOST_NO_CXX11_NOEXCEPT
131 #if !__has_feature(cxx_nullptr)
132 # define BOOST_NO_CXX11_NULLPTR
135 #if !__has_feature(cxx_range_for)
136 # define BOOST_NO_CXX11_RANGE_BASED_FOR
139 #if !__has_feature(cxx_raw_string_literals)
140 # define BOOST_NO_CXX11_RAW_LITERALS
143 #if !__has_feature(cxx_reference_qualified_functions)
144 # define BOOST_NO_CXX11_REF_QUALIFIERS
147 #if !__has_feature(cxx_generalized_initializers)
148 # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
151 #if !__has_feature(cxx_rvalue_references)
152 # define BOOST_NO_CXX11_RVALUE_REFERENCES
155 #if !__has_feature(cxx_strong_enums)
156 # define BOOST_NO_CXX11_SCOPED_ENUMS
159 #if !__has_feature(cxx_static_assert)
160 # define BOOST_NO_CXX11_STATIC_ASSERT
163 #if !__has_feature(cxx_alias_templates)
164 # define BOOST_NO_CXX11_TEMPLATE_ALIASES
167 #if !__has_feature(cxx_unicode_literals)
168 # define BOOST_NO_CXX11_UNICODE_LITERALS
171 #if !__has_feature(cxx_variadic_templates)
172 # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
175 #if !__has_feature(cxx_user_literals)
176 # define BOOST_NO_CXX11_USER_DEFINED_LITERALS
179 #if !__has_feature(cxx_alignas)
180 # define BOOST_NO_CXX11_ALIGNAS
183 #if !__has_feature(cxx_trailing_return)
184 # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
187 #if !__has_feature(cxx_inline_namespaces)
188 # define BOOST_NO_CXX11_INLINE_NAMESPACES
191 #if !__has_feature(cxx_override_control)
192 # define BOOST_NO_CXX11_FINAL
195 #if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))
196 # define BOOST_NO_CXX14_BINARY_LITERALS
199 #if !__has_feature(__cxx_decltype_auto__)
200 # define BOOST_NO_CXX14_DECLTYPE_AUTO
203 #if !__has_feature(__cxx_aggregate_nsdmi__)
204 # define BOOST_NO_CXX14_AGGREGATE_NSDMI
207 #if !__has_feature(__cxx_init_captures__)
208 # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
211 #if !__has_feature(__cxx_generic_lambdas__)
212 # define BOOST_NO_CXX14_GENERIC_LAMBDAS
215 // clang < 3.5 has a defect with dependent type, like following.
217 // template <class T>
218 // constexpr typename enable_if<pred<T> >::type foo(T &)
219 // { } // error: no return statement in constexpr function
221 // This issue also affects C++11 mode, but C++11 constexpr requires return stmt.
222 // Therefore we don't care such case.
224 // Note that we can't check Clang version directly as the numbering system changes depending who's
225 // creating the Clang release (see https://github.com/boostorg/config/pull/39#issuecomment-59927873)
226 // so instead verify that we have a feature that was introduced at the same time as working C++14
227 // constexpr (generic lambda's in this case):
229 #if !__has_feature(__cxx_generic_lambdas__) || !__has_feature(__cxx_relaxed_constexpr__)
230 # define BOOST_NO_CXX14_CONSTEXPR
233 #if !__has_feature(__cxx_return_type_deduction__)
234 # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
237 #if !__has_feature(__cxx_variable_templates__)
238 # define BOOST_NO_CXX14_VARIABLE_TEMPLATES
241 #if !__has_feature(cxx_thread_local)
242 # define BOOST_NO_CXX11_THREAD_LOCAL
245 #if __cplusplus < 201400
246 // All versions with __cplusplus above this value seem to support this:
247 # define BOOST_NO_CXX14_DIGIT_SEPARATORS
252 #if defined(__GNUC__) && (__GNUC__ >= 4)
253 # define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
256 #ifndef BOOST_COMPILER
257 # define BOOST_COMPILER "Clang version " __clang_version__
260 // Macro used to identify the Clang compiler.
261 #define BOOST_CLANG 1