Chris@16: // (C) Copyright Douglas Gregor 2010 Chris@16: // Chris@16: // Use, modification and distribution are subject to the Chris@16: // Boost Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org for most recent version. Chris@16: Chris@16: // Clang compiler setup. Chris@16: Chris@16: #define BOOST_HAS_PRAGMA_ONCE Chris@16: Chris@101: // Detecting `-fms-extension` compiler flag assuming that _MSC_VER defined when that flag is used. Chris@101: #if defined (_MSC_VER) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)) Chris@101: # define BOOST_HAS_PRAGMA_DETECT_MISMATCH Chris@101: #endif Chris@101: Chris@101: // When compiling with clang before __has_extension was defined, Chris@101: // even if one writes 'defined(__has_extension) && __has_extension(xxx)', Chris@101: // clang reports a compiler error. So the only workaround found is: Chris@101: Chris@101: #ifndef __has_extension Chris@101: #define __has_extension __has_feature Chris@101: #endif Chris@101: Chris@16: #if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) Chris@16: # define BOOST_NO_EXCEPTIONS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI) Chris@16: # define BOOST_NO_RTTI Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID) Chris@16: # define BOOST_NO_TYPEID Chris@16: #endif Chris@16: Chris@16: #if defined(__int64) && !defined(__GNUC__) Chris@16: # define BOOST_HAS_MS_INT64 Chris@16: #endif Chris@16: Chris@16: #define BOOST_HAS_NRVO Chris@16: Chris@16: // Branch prediction hints Chris@16: #if defined(__has_builtin) Chris@16: #if __has_builtin(__builtin_expect) Chris@16: #define BOOST_LIKELY(x) __builtin_expect(x, 1) Chris@16: #define BOOST_UNLIKELY(x) __builtin_expect(x, 0) Chris@16: #endif Chris@16: #endif Chris@16: Chris@16: // Clang supports "long long" in all compilation modes. Chris@16: #define BOOST_HAS_LONG_LONG Chris@16: Chris@16: // Chris@101: // We disable this if the compiler is really nvcc as it Chris@101: // doesn't actually support __int128 as of CUDA_VERSION=5000 Chris@101: // even though it defines __SIZEOF_INT128__. Chris@101: // See https://svn.boost.org/trac/boost/ticket/10418 Chris@101: // Only re-enable this for nvcc if you're absolutely sure Chris@101: // of the circumstances under which it's supported: Chris@101: // Chris@101: #if defined(__SIZEOF_INT128__) && !defined(__CUDACC__) Chris@101: # define BOOST_HAS_INT128 Chris@101: #endif Chris@101: Chris@101: Chris@101: // Chris@16: // Dynamic shared object (DSO) and dynamic-link library (DLL) support Chris@16: // Chris@16: #if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32) Chris@16: # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default"))) Chris@16: # define BOOST_SYMBOL_IMPORT Chris@16: # define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default"))) Chris@16: #endif Chris@16: Chris@16: // Chris@16: // The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through Chris@16: // between switch labels. Chris@16: // Chris@16: #if __cplusplus >= 201103L && defined(__has_warning) Chris@16: # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") Chris@16: # define BOOST_FALLTHROUGH [[clang::fallthrough]] Chris@16: # endif Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_auto_type) Chris@16: # define BOOST_NO_CXX11_AUTO_DECLARATIONS Chris@16: # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS Chris@16: #endif Chris@16: Chris@101: // Chris@101: // Currently clang on Windows using VC++ RTL does not support C++11's char16_t or char32_t Chris@101: // Chris@101: #if defined(_MSC_VER) || !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) Chris@16: # define BOOST_NO_CXX11_CHAR16_T Chris@16: # define BOOST_NO_CXX11_CHAR32_T Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_constexpr) Chris@16: # define BOOST_NO_CXX11_CONSTEXPR Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_decltype) Chris@16: # define BOOST_NO_CXX11_DECLTYPE Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_decltype_incomplete_return_types) Chris@16: # define BOOST_NO_CXX11_DECLTYPE_N3276 Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_defaulted_functions) Chris@16: # define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_deleted_functions) Chris@16: # define BOOST_NO_CXX11_DELETED_FUNCTIONS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_explicit_conversions) Chris@16: # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_default_function_template_args) Chris@16: # define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_generalized_initializers) Chris@16: # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_lambdas) Chris@16: # define BOOST_NO_CXX11_LAMBDAS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_local_type_template_args) Chris@16: # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_noexcept) Chris@16: # define BOOST_NO_CXX11_NOEXCEPT Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_nullptr) Chris@16: # define BOOST_NO_CXX11_NULLPTR Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_range_for) Chris@16: # define BOOST_NO_CXX11_RANGE_BASED_FOR Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_raw_string_literals) Chris@16: # define BOOST_NO_CXX11_RAW_LITERALS Chris@16: #endif Chris@16: Chris@101: #if !__has_feature(cxx_reference_qualified_functions) Chris@101: # define BOOST_NO_CXX11_REF_QUALIFIERS Chris@101: #endif Chris@101: Chris@16: #if !__has_feature(cxx_generalized_initializers) Chris@16: # define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_rvalue_references) Chris@16: # define BOOST_NO_CXX11_RVALUE_REFERENCES Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_strong_enums) Chris@16: # define BOOST_NO_CXX11_SCOPED_ENUMS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_static_assert) Chris@16: # define BOOST_NO_CXX11_STATIC_ASSERT Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_alias_templates) Chris@16: # define BOOST_NO_CXX11_TEMPLATE_ALIASES Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_unicode_literals) Chris@16: # define BOOST_NO_CXX11_UNICODE_LITERALS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_variadic_templates) Chris@16: # define BOOST_NO_CXX11_VARIADIC_TEMPLATES Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_user_literals) Chris@16: # define BOOST_NO_CXX11_USER_DEFINED_LITERALS Chris@16: #endif Chris@16: Chris@101: #if !__has_feature(cxx_alignas) Chris@16: # define BOOST_NO_CXX11_ALIGNAS Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_trailing_return) Chris@16: # define BOOST_NO_CXX11_TRAILING_RESULT_TYPES Chris@16: #endif Chris@16: Chris@16: #if !__has_feature(cxx_inline_namespaces) Chris@16: # define BOOST_NO_CXX11_INLINE_NAMESPACES Chris@16: #endif Chris@16: Chris@101: #if !__has_feature(cxx_override_control) Chris@101: # define BOOST_NO_CXX11_FINAL Chris@101: #endif Chris@101: Chris@101: #if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__)) Chris@101: # define BOOST_NO_CXX14_BINARY_LITERALS Chris@101: #endif Chris@101: Chris@101: #if !__has_feature(__cxx_decltype_auto__) Chris@101: # define BOOST_NO_CXX14_DECLTYPE_AUTO Chris@101: #endif Chris@101: Chris@101: #if !__has_feature(__cxx_aggregate_nsdmi__) Chris@101: # define BOOST_NO_CXX14_AGGREGATE_NSDMI Chris@101: #endif Chris@101: Chris@101: #if !__has_feature(__cxx_init_captures__) Chris@101: # define BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES Chris@101: #endif Chris@101: Chris@101: #if !__has_feature(__cxx_generic_lambdas__) Chris@101: # define BOOST_NO_CXX14_GENERIC_LAMBDAS Chris@101: #endif Chris@101: Chris@101: // clang < 3.5 has a defect with dependent type, like following. Chris@101: // Chris@101: // template Chris@101: // constexpr typename enable_if >::type foo(T &) Chris@101: // { } // error: no return statement in constexpr function Chris@101: // Chris@101: // This issue also affects C++11 mode, but C++11 constexpr requires return stmt. Chris@101: // Therefore we don't care such case. Chris@101: // Chris@101: // Note that we can't check Clang version directly as the numbering system changes depending who's Chris@101: // creating the Clang release (see https://github.com/boostorg/config/pull/39#issuecomment-59927873) Chris@101: // so instead verify that we have a feature that was introduced at the same time as working C++14 Chris@101: // constexpr (generic lambda's in this case): Chris@101: // Chris@101: #if !__has_feature(__cxx_generic_lambdas__) || !__has_feature(__cxx_relaxed_constexpr__) Chris@101: # define BOOST_NO_CXX14_CONSTEXPR Chris@101: #endif Chris@101: Chris@101: #if !__has_feature(__cxx_return_type_deduction__) Chris@101: # define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION Chris@101: #endif Chris@101: Chris@101: #if !__has_feature(__cxx_variable_templates__) Chris@101: # define BOOST_NO_CXX14_VARIABLE_TEMPLATES Chris@101: #endif Chris@101: Chris@101: #if __cplusplus < 201400 Chris@101: // All versions with __cplusplus above this value seem to support this: Chris@101: # define BOOST_NO_CXX14_DIGIT_SEPARATORS Chris@101: #endif Chris@101: Chris@101: Chris@101: // Unused attribute: Chris@101: #if defined(__GNUC__) && (__GNUC__ >= 4) Chris@101: # define BOOST_ATTRIBUTE_UNUSED __attribute__((unused)) Chris@101: #endif Chris@16: Chris@16: #ifndef BOOST_COMPILER Chris@16: # define BOOST_COMPILER "Clang version " __clang_version__ Chris@16: #endif Chris@16: Chris@16: // Macro used to identify the Clang compiler. Chris@16: #define BOOST_CLANG 1 Chris@16: