Enable __is_trivially* intrinsics for GCC 5.1

Until GCC 5.1 the __is_trivially* intrinsics were not provided. Enable use of
the builtins for GCC 5.1.

Also enable Reference qualified member functions for GCC 4.9 and greater.

This patch also defines _GNUC_VER to 0 when __GNUC__ is not defined because
libc++ assumes _GNUC_VER is always defined.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239653 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier 2015-06-13 02:18:44 +00:00
parent 724b5ab350
commit eeeada1c77
2 changed files with 11 additions and 6 deletions

View File

@ -17,6 +17,8 @@
#ifdef __GNUC__ #ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) #define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#else
#define _GNUC_VER 0
#endif #endif
#if !_WIN32 #if !_WIN32

View File

@ -1789,7 +1789,8 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
typedef _Rp (_FnType) (_Param..., ...); typedef _Rp (_FnType) (_Param..., ...);
}; };
#if __has_feature(cxx_reference_qualified_functions) #if __has_feature(cxx_reference_qualified_functions) || \
(defined(_GNUC_VER) && _GNUC_VER >= 409)
template <class _Rp, class _Class, class ..._Param> template <class _Rp, class _Class, class ..._Param>
struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false> struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
@ -1919,7 +1920,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatil
typedef _Rp (_FnType) (_Param..., ...); typedef _Rp (_FnType) (_Param..., ...);
}; };
#endif // __has_feature(cxx_reference_qualified_functions) #endif // __has_feature(cxx_reference_qualified_functions) || _GNUC_VER >= 409
#else // _LIBCPP_HAS_NO_VARIADICS #else // _LIBCPP_HAS_NO_VARIADICS
@ -2691,7 +2692,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
#if __has_feature(is_trivially_constructible) #if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
template <class _Tp, class... _Args> template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
@ -2750,7 +2751,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible
{ {
}; };
#if __has_feature(is_trivially_constructible) #if __has_feature(is_trivially_constructible) || _GNUC_VER >= 501
template <class _Tp> template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat, struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, __is_construct::__nat,
@ -2838,7 +2839,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructibl
// is_trivially_assignable // is_trivially_assignable
#if __has_feature(is_trivially_assignable) #if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501
template <class _Tp, class _Arg> template <class _Tp, class _Arg>
struct is_trivially_assignable struct is_trivially_assignable
@ -3276,6 +3277,8 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
#if __has_feature(is_trivially_copyable) #if __has_feature(is_trivially_copyable)
: public integral_constant<bool, __is_trivially_copyable(_Tp)> : public integral_constant<bool, __is_trivially_copyable(_Tp)>
#elif _GNUC_VER >= 501
: public integral_constant<bool, !is_volatile<_Tp>::value && __is_trivially_copyable(_Tp)>
#else #else
: integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value> : integral_constant<bool, is_scalar<typename remove_all_extents<_Tp>::type>::value>
#endif #endif
@ -3284,7 +3287,7 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
// is_trivial; // is_trivial;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
#if __has_feature(is_trivial) || (_GNUC_VER >= 407) #if __has_feature(is_trivial) || _GNUC_VER >= 407
: public integral_constant<bool, __is_trivial(_Tp)> : public integral_constant<bool, __is_trivial(_Tp)>
#else #else
: integral_constant<bool, is_trivially_copyable<_Tp>::value && : integral_constant<bool, is_trivially_copyable<_Tp>::value &&