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
This commit is contained in:
parent
85265ffebe
commit
ef59adba5b
@ -31,7 +31,9 @@ static inline float sk_float_pow(float base, float exp) {
|
|||||||
|
|
||||||
static inline float sk_float_copysign(float x, float y) {
|
static inline float sk_float_copysign(float x, float y) {
|
||||||
// c++11 contains a 'float copysign(float, float)' function in <cmath>.
|
// 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);
|
return copysign(x, y);
|
||||||
|
|
||||||
// Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6.
|
// Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6.
|
||||||
|
Loading…
Reference in New Issue
Block a user