aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkFloatingPoint.h
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2014-09-17 11:16:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-17 11:16:51 -0700
commitef59adba5b5058c60c1b92b17904b2813be644ea (patch)
tree9fb4f7400fa10ed1b54cc0601224a60129084929 /include/core/SkFloatingPoint.h
parent85265ffebe78982589ed85457ae1cefba5d4355d (diff)
Clarify build test for presense of 'float copysign(float, float)'.
Clang-cl reports __cplusplus based on the version of clang instead of reporting the __cplusplus the vc++ version _MSC_VER would. This is important as the _MSC_VER also indicates which vc++ runtime library will be used. As a result, do not trust the __cplusplus version reported by clang-cl. This change clarifies the intent of https://skia.googlesource.com/skia/+/c34b0d4e9ad5806c1f882a1f85191f2ea8ddcdba R=reed@google.com Author: bungeman@google.com Review URL: https://codereview.chromium.org/576023003
Diffstat (limited to 'include/core/SkFloatingPoint.h')
-rw-r--r--include/core/SkFloatingPoint.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/core/SkFloatingPoint.h b/include/core/SkFloatingPoint.h
index 93d479cf87..2df8f9bf65 100644
--- a/include/core/SkFloatingPoint.h
+++ b/include/core/SkFloatingPoint.h
@@ -31,7 +31,9 @@ static inline float sk_float_pow(float base, float exp) {
static inline float sk_float_copysign(float x, float y) {
// c++11 contains a 'float copysign(float, float)' function in <cmath>.
-#if (!defined(_MSC_VER) && __cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
+// clang-cl reports __cplusplus for clang, not the __cplusplus vc++ version _MSC_VER would report.
+#define SK_BUILD_WITH_CLANG_CL (defined(_MSC_VER) && defined(__clang__))
+#if (!SK_BUILD_WITH_CLANG_CL && __cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
return copysign(x, y);
// Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6.