annotate DEPENDENCIES/generic/include/boost/config/compiler/clang.hpp @ 125:34e428693f5d vext

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