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 // Clang compiler setup.
11 #define BOOST_HAS_PRAGMA_ONCE
13 #if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS)
14 # define BOOST_NO_EXCEPTIONS
17 #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI)
18 # define BOOST_NO_RTTI
21 #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID)
22 # define BOOST_NO_TYPEID
25 #if defined(__int64) && !defined(__GNUC__)
26 # define BOOST_HAS_MS_INT64
29 #define BOOST_HAS_NRVO
31 // Branch prediction hints
32 #if defined(__has_builtin)
33 #if __has_builtin(__builtin_expect)
34 #define BOOST_LIKELY(x) __builtin_expect(x, 1)
35 #define BOOST_UNLIKELY(x) __builtin_expect(x, 0)
39 // Clang supports "long long" in all compilation modes.
40 #define BOOST_HAS_LONG_LONG
43 // Dynamic shared object (DSO) and dynamic-link library (DLL) support
45 #if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
46 # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
47 # define BOOST_SYMBOL_IMPORT
48 # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
52 // The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through
53 // between switch labels.
55 #if __cplusplus >= 201103L && defined(__has_warning)
56 # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
57 # define BOOST_FALLTHROUGH [[clang::fallthrough]]
61 #if !__has_feature(cxx_auto_type)
62 # define BOOST_NO_CXX11_AUTO_DECLARATIONS
63 # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
66 #if !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L)
67 # define BOOST_NO_CXX11_CHAR16_T
68 # define BOOST_NO_CXX11_CHAR32_T
71 #if !__has_feature(cxx_constexpr)
72 # define BOOST_NO_CXX11_CONSTEXPR
75 #if !__has_feature(cxx_decltype)
76 # define BOOST_NO_CXX11_DECLTYPE
79 #if !__has_feature(cxx_decltype_incomplete_return_types)
80 # define BOOST_NO_CXX11_DECLTYPE_N3276
83 #if !__has_feature(cxx_defaulted_functions)
84 # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
87 #if !__has_feature(cxx_deleted_functions)
88 # define BOOST_NO_CXX11_DELETED_FUNCTIONS
91 #if !__has_feature(cxx_explicit_conversions)
92 # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
95 #if !__has_feature(cxx_default_function_template_args)
96 # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
99 #if !__has_feature(cxx_generalized_initializers)
100 # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
103 #if !__has_feature(cxx_lambdas)
104 # define BOOST_NO_CXX11_LAMBDAS
107 #if !__has_feature(cxx_local_type_template_args)
108 # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
111 #if !__has_feature(cxx_noexcept)
112 # define BOOST_NO_CXX11_NOEXCEPT
115 #if !__has_feature(cxx_nullptr)
116 # define BOOST_NO_CXX11_NULLPTR
119 #if !__has_feature(cxx_range_for)
120 # define BOOST_NO_CXX11_RANGE_BASED_FOR
123 #if !__has_feature(cxx_raw_string_literals)
124 # define BOOST_NO_CXX11_RAW_LITERALS
127 #if !__has_feature(cxx_generalized_initializers)
128 # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
131 #if !__has_feature(cxx_rvalue_references)
132 # define BOOST_NO_CXX11_RVALUE_REFERENCES
135 #if !__has_feature(cxx_strong_enums)
136 # define BOOST_NO_CXX11_SCOPED_ENUMS
139 #if !__has_feature(cxx_static_assert)
140 # define BOOST_NO_CXX11_STATIC_ASSERT
143 #if !__has_feature(cxx_alias_templates)
144 # define BOOST_NO_CXX11_TEMPLATE_ALIASES
147 #if !__has_feature(cxx_unicode_literals)
148 # define BOOST_NO_CXX11_UNICODE_LITERALS
151 #if !__has_feature(cxx_variadic_templates)
152 # define BOOST_NO_CXX11_VARIADIC_TEMPLATES
155 #if !__has_feature(cxx_user_literals)
156 # define BOOST_NO_CXX11_USER_DEFINED_LITERALS
159 #if !(__has_feature(cxx_alignas) || __has_extension(cxx_alignas))
160 # define BOOST_NO_CXX11_ALIGNAS
163 #if !__has_feature(cxx_trailing_return)
164 # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES
167 #if !__has_feature(cxx_inline_namespaces)
168 # define BOOST_NO_CXX11_INLINE_NAMESPACES
171 // Clang always supports variadic macros
172 // Clang always supports extern templates
174 #ifndef BOOST_COMPILER
175 # define BOOST_COMPILER "Clang version " __clang_version__
178 // Macro used to identify the Clang compiler.
179 #define BOOST_CLANG 1