diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-04-25 20:02:10 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-04-25 20:02:10 +0000 |
commit | ae62727a28d86ed4fc26079b9a1be09865ea270b (patch) | |
tree | 5e236aafcb624a21d5130faf33f2fdb6c06331c8 | |
parent | f54258c88842dccf6d63c09e395e5889267c1836 (diff) | |
download | bcm5719-llvm-ae62727a28d86ed4fc26079b9a1be09865ea270b.tar.gz bcm5719-llvm-ae62727a28d86ed4fc26079b9a1be09865ea270b.zip |
Remove libc++ checks and workarounds for unsupported old versions of GCC (<4.9).
Differential Revision: https://reviews.llvm.org/D61107
llvm-svn: 359232
-rw-r--r-- | libcxx/include/__config | 38 | ||||
-rw-r--r-- | libcxx/include/memory | 6 | ||||
-rw-r--r-- | libcxx/include/type_traits | 63 |
3 files changed, 39 insertions, 68 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index f597e195a2d..c65f23abcc7 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -519,13 +519,11 @@ typedef __char32_t char32_t; #define _LIBCPP_NORETURN __attribute__((noreturn)) -#if _GNUC_VER >= 407 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) #define _LIBCPP_HAS_IS_FINAL -#endif -#if defined(__GNUC__) && _GNUC_VER >= 403 +#if defined(__GNUC__) #define _LIBCPP_HAS_IS_BASE_OF #endif @@ -533,26 +531,19 @@ typedef __char32_t char32_t; #define _LIBCPP_NO_EXCEPTIONS #endif -// constexpr was added to GCC in 4.6. -#if _GNUC_VER < 406 -# define _LIBCPP_HAS_NO_CONSTEXPR -// Can only use constexpr in c++11 mode. -#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L -# define _LIBCPP_HAS_NO_CONSTEXPR -#endif - // Determine if GCC supports relaxed constexpr #if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #endif -// GCC 5 will support variable templates +// GCC 5 supports variable templates #if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #endif #ifndef __GXX_EXPERIMENTAL_CXX0X__ +#define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_UNICODE_CHARS @@ -561,25 +552,6 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_STRONG_ENUMS #define _LIBCPP_HAS_NO_NOEXCEPT -#else // __GXX_EXPERIMENTAL_CXX0X__ - -#if _GNUC_VER < 403 -#define _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif - - -#if _GNUC_VER < 404 -#define _LIBCPP_HAS_NO_DECLTYPE -#define _LIBCPP_HAS_NO_UNICODE_CHARS -#define _LIBCPP_HAS_NO_VARIADICS -#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS -#endif // _GNUC_VER < 404 - -#if _GNUC_VER < 406 -#define _LIBCPP_HAS_NO_NOEXCEPT -#define _LIBCPP_HAS_NO_NULLPTR -#endif - #endif // __GXX_EXPERIMENTAL_CXX0X__ #if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__) @@ -883,7 +855,7 @@ template <unsigned> struct __static_assert_check {}; #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. -# if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 +# if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || defined(_LIBCPP_COMPILER_GCC) # define decltype(__x) __decltype(__x) # else # define decltype(__x) __typeof__(__x) @@ -1219,7 +1191,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( #if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) # define _LIBCPP_HAS_C_ATOMIC_IMP -#elif _GNUC_VER > 407 +#elif defined(_LIBCPP_COMPILER_GCC) # define _LIBCPP_HAS_GCC_ATOMIC_IMP #endif diff --git a/libcxx/include/memory b/libcxx/include/memory index 3398629c168..8d88617f4e6 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -683,7 +683,7 @@ inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_relaxed_load(_ValueType const* __value) { #if !defined(_LIBCPP_HAS_NO_THREADS) && \ defined(__ATOMIC_RELAXED) && \ - (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407) + (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC)) return __atomic_load_n(__value, __ATOMIC_RELAXED); #else return *__value; @@ -695,7 +695,7 @@ inline _LIBCPP_INLINE_VISIBILITY _ValueType __libcpp_acquire_load(_ValueType const* __value) { #if !defined(_LIBCPP_HAS_NO_THREADS) && \ defined(__ATOMIC_ACQUIRE) && \ - (__has_builtin(__atomic_load_n) || _GNUC_VER >= 407) + (__has_builtin(__atomic_load_n) || defined(_LIBCPP_COMPILER_GCC)) return __atomic_load_n(__value, __ATOMIC_ACQUIRE); #else return *__value; @@ -3466,7 +3466,7 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) { && defined(__ATOMIC_RELAXED) \ && defined(__ATOMIC_ACQ_REL) # define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT -#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407 +#elif defined(_LIBCPP_COMPILER_GCC) # define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT #endif diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 7ceaa2d03fe..a0bdb2b418e 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -833,7 +833,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_rvalue_reference_v #endif // is_union -#if __has_feature(is_union) || (_GNUC_VER >= 403) +#if __has_feature(is_union) || defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union : public integral_constant<bool, __is_union(_Tp)> {}; @@ -854,7 +854,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_union_v // is_class -#if __has_feature(is_class) || (_GNUC_VER >= 403) +#if __has_feature(is_class) || defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class : public integral_constant<bool, __is_class(_Tp)> {}; @@ -976,7 +976,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_member_object_pointer_v // is_enum -#if __has_feature(is_enum) || (_GNUC_VER >= 403) +#if __has_feature(is_enum) || defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant<bool, __is_enum(_Tp)> {}; @@ -1617,7 +1617,7 @@ inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To // is_empty -#if __has_feature(is_empty) || (_GNUC_VER >= 407) +#if __has_feature(is_empty) || defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_empty @@ -1680,7 +1680,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_polymorphic_v // has_virtual_destructor -#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403) +#if __has_feature(has_virtual_destructor) || defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; @@ -2498,8 +2498,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil typedef _Rp (_FnType) (_Param..., ...); }; -#if __has_feature(cxx_reference_qualified_functions) || \ - (defined(_GNUC_VER) && _GNUC_VER >= 409) +#if __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC) template <class _Rp, class _Class, class ..._Param> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> @@ -2629,7 +2628,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil typedef _Rp (_FnType) (_Param..., ...); }; -#endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409 +#endif // __has_feature(cxx_reference_qualified_functions) || defined(_LIBCPP_COMPILER_GCC) #else // _LIBCPP_HAS_NO_VARIADICS @@ -3503,7 +3502,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible<_Tp> -#if __has_feature(has_trivial_constructor) || (_GNUC_VER >= 403) +#if __has_feature(has_trivial_constructor) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_trivial_constructor(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3734,7 +3733,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible : public integral_constant<bool, __is_trivially_destructible(_Tp)> {}; -#elif __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403) +#elif __has_feature(has_trivial_destructor) || defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {}; @@ -3769,7 +3768,7 @@ template <class _Tp, class... _Args> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible : public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {}; -#elif __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) +#elif !defined(_LIBCPP_HAS_NO_NOEXCEPT) template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible; @@ -3806,7 +3805,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]> { }; -#else // __has_keyword(__is_nothrow_constructible) || __has_feature(cxx_noexcept) +#else // __has_keyword(__is_nothrow_constructible) || !defined(_LIBCPP_HAS_NO_NOEXCEPT) template <class _Tp, class... _Args> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible @@ -3816,7 +3815,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp> -#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_constructor) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_constructor(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3830,7 +3829,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&&> #else struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp> #endif -#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3840,7 +3839,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp> template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&> -#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3850,7 +3849,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&> template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&> -#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3858,7 +3857,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&> { }; -#endif // __has_feature(cxx_noexcept) +#endif // _LIBCPP_HAS_NO_NOEXCEPT #else // _LIBCPP_HAS_NO_VARIADICS @@ -3889,7 +3888,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat, __is_construct::__nat> -#if __has_feature(has_nothrow_constructor) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_constructor) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_constructor(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3900,7 +3899,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, __is_construct::__nat, template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3911,7 +3910,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp, template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3922,7 +3921,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, const _Tp&, template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp, _Tp&, __is_construct::__nat> -#if __has_feature(has_nothrow_copy) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_copy) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_copy(_Tp)> #else : integral_constant<bool, is_scalar<_Tp>::value> @@ -3987,7 +3986,7 @@ template <class _Tp, class _Arg> struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {}; -#elif __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) +#elif !defined(_LIBCPP_HAS_NO_NOEXCEPT) template <bool, class _Tp, class _Arg> struct __libcpp_is_nothrow_assignable; @@ -4009,7 +4008,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable { }; -#else // __has_keyword(__is_nothrow_assignable) || __has_feature(cxx_noexcept) +#else // __has_keyword(__is_nothrow_assignable) || !defined(_LIBCPP_HAS_NO_NOEXCEPT) template <class _Tp, class _Arg> struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable @@ -4017,7 +4016,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp> -#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -4025,7 +4024,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp> template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp&> -#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -4033,7 +4032,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, _Tp&> template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, const _Tp&> -#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -4043,7 +4042,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable<_Tp&, const _Tp&> template <class _Tp> struct is_nothrow_assignable<_Tp&, _Tp&&> -#if __has_feature(has_nothrow_assign) || (_GNUC_VER >= 403) +#if __has_feature(has_nothrow_assign) || defined(_LIBCPP_COMPILER_GCC) : integral_constant<bool, __has_nothrow_assign(_Tp)> {}; #else : integral_constant<bool, is_scalar<_Tp>::value> {}; @@ -4051,7 +4050,7 @@ struct is_nothrow_assignable<_Tp&, _Tp&&> #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif // __has_feature(cxx_noexcept) +#endif // _LIBCPP_HAS_NO_NOEXCEPT #if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) template <class _Tp, class _Arg> @@ -4090,7 +4089,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v // is_nothrow_destructible -#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L) +#if !defined(_LIBCPP_HAS_NO_NOEXCEPT) template <bool, class _Tp> struct __libcpp_is_nothrow_destructible; @@ -4157,7 +4156,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v // is_pod -#if __has_feature(is_pod) || (_GNUC_VER >= 403) +#if __has_feature(is_pod) || defined(_LIBCPP_COMPILER_GCC) template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod : public integral_constant<bool, __is_pod(_Tp)> {}; @@ -4198,7 +4197,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_literal_type_v // is_standard_layout; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout -#if __has_feature(is_standard_layout) || (_GNUC_VER >= 407) +#if __has_feature(is_standard_layout) || defined(_LIBCPP_COMPILER_GCC) : public integral_constant<bool, __is_standard_layout(_Tp)> #else : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> @@ -4232,7 +4231,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_trivially_copyable_v // is_trivial; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial -#if __has_feature(is_trivial) || _GNUC_VER >= 407 +#if __has_feature(is_trivial) || defined(_LIBCPP_COMPILER_GCC) : public integral_constant<bool, __is_trivial(_Tp)> #else : integral_constant<bool, is_trivially_copyable<_Tp>::value && |