Index: include/private/SkTLogic.h |
diff --git a/include/private/SkTLogic.h b/include/private/SkTLogic.h |
index b38fd50435cbccfd5de0dbeff15eca9e0d9fdd88..298033ad462e75e29917d960b58b6a1201bd81ae 100644 |
--- a/include/private/SkTLogic.h |
+++ b/include/private/SkTLogic.h |
@@ -14,8 +14,6 @@ |
#ifndef SkTLogic_DEFINED |
#define SkTLogic_DEFINED |
-#include "SkTypes.h" |
- |
#include <stddef.h> |
#include <stdint.h> |
#include <type_traits> |
@@ -42,7 +40,7 @@ template <typename T> using remove_extent_t = typename std::remove_extent<T>::ty |
// On all platforms, variadic functions only exist in the c calling convention. |
// mcvc 2013 introduced __vectorcall, but it wan't until 2015 that it was added to is_function. |
template <typename> struct is_function : std::false_type {}; |
-#if !defined(SK_BUILD_FOR_WIN) |
+#if !defined(WIN32) |
template <typename R, typename... Args> struct is_function<R(Args...)> : std::true_type {}; |
#else |
template <typename R, typename... Args> struct is_function<R __cdecl (Args...)> : std::true_type {}; |
@@ -50,7 +48,7 @@ template <typename R, typename... Args> struct is_function<R __cdecl (Args...)> |
template <typename R, typename... Args> struct is_function<R __stdcall (Args...)> : std::true_type {}; |
template <typename R, typename... Args> struct is_function<R __fastcall (Args...)> : std::true_type {}; |
#endif |
-#if defined(_MSC_VER) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
+#if defined(_MSC_VER) && (_M_IX86_FP >= 2 || defined(_M_AMD64) || defined(_M_X64)) |
template <typename R, typename... Args> struct is_function<R __vectorcall (Args...)> : std::true_type {}; |
#endif |
#endif |
@@ -64,6 +62,27 @@ template <typename T> using add_lvalue_reference_t = typename std::add_lvalue_re |
template <typename... T> using common_type_t = typename std::common_type<T...>::type; |
+// Chromium currently requires gcc 4.8.2 or a recent clang compiler, but uses libstdc++4.6.4. |
+// Note that Precise actually uses libstdc++4.6.3. |
+// Unfortunately, libstdc++ STL before libstdc++4.7 do not define std::underlying_type. |
+// Newer gcc and clang compilers have __underlying_type which does not depend on runtime support. |
+// See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html for __GLIBCXX__ values. |
+// Unfortunately __GLIBCXX__ is a date, but no updates to versions before 4.7 are now anticipated. |
+#define SK_GLIBCXX_4_7_0 20120322 |
+// Updates to versions before 4.7 but released after 4.7 was released. |
+#define SK_GLIBCXX_4_5_4 20120702 |
+#define SK_GLIBCXX_4_6_4 20121127 |
+#if defined(__GLIBCXX__) && (__GLIBCXX__ < SK_GLIBCXX_4_7_0 || \ |
+ __GLIBCXX__ == SK_GLIBCXX_4_5_4 || \ |
+ __GLIBCXX__ == SK_GLIBCXX_4_6_4) |
+template <typename T> struct underlying_type { |
+ using type = __underlying_type(T); |
+}; |
+#else |
+template <typename T> using underlying_type = std::underlying_type<T>; |
+#endif |
+template <typename T> using underlying_type_t = typename skstd::underlying_type<T>::type; |
+ |
template <typename S, typename D, |
bool=std::is_void<S>::value || is_function<D>::value || std::is_array<D>::value> |
struct is_convertible_detector { |