From: Marshall Clow Date: Thu, 26 Jun 2014 01:07:56 +0000 (+0000) Subject: Patch from Albert J. Wong to make type_traits take advantage of gcc intrinsics in... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=157a8f91bdf1216b48bb3a116cf06e54cd8e27a1;p=platform%2Fupstream%2Fllvm.git Patch from Albert J. Wong to make type_traits take advantage of gcc intrinsics in 4.7 and later. No functionality change when using clang. llvm-svn: 211755 --- diff --git a/libcxx/include/__config b/libcxx/include/__config index c628524..981cc9f 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -339,7 +339,11 @@ typedef __char32_t char32_t; #endif #if __has_feature(underlying_type) -# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T) +# define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) +#endif + +#if __has_feature(is_literal) +# define _LIBCPP_IS_LITERAL(T) __is_literal(T) #endif // Inline namespaces are available in Clang regardless of C++ dialect. @@ -363,6 +367,11 @@ namespace std { #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) +#endif + #if !__EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS #endif diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 6846af5..94a7362 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -2971,8 +2971,8 @@ template struct _LIBCPP_TYPE_VIS_ONLY is_pod // is_literal_type; template struct _LIBCPP_TYPE_VIS_ONLY is_literal_type -#if __has_feature(is_literal) - : public integral_constant +#ifdef _LIBCPP_IS_LITERAL + : public integral_constant #else : integral_constant::type>::value || is_reference::type>::value> @@ -3363,19 +3363,19 @@ struct __is_nothrow_swappable #endif // __has_feature(cxx_noexcept) -#ifdef _LIBCXX_UNDERLYING_TYPE +#ifdef _LIBCPP_UNDERLYING_TYPE template struct underlying_type { - typedef _LIBCXX_UNDERLYING_TYPE(_Tp) type; + typedef _LIBCPP_UNDERLYING_TYPE(_Tp) type; }; #if _LIBCPP_STD_VER > 11 template using underlying_type_t = typename underlying_type<_Tp>::type; #endif -#else // _LIBCXX_UNDERLYING_TYPE +#else // _LIBCPP_UNDERLYING_TYPE template struct underlying_type @@ -3385,7 +3385,7 @@ struct underlying_type "libc++ does not know how to use it."); }; -#endif // _LIBCXX_UNDERLYING_TYPE +#endif // _LIBCPP_UNDERLYING_TYPE #ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE