From 014bc95135a38d65b991509492c0979cfd153e71 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Wed, 5 Feb 2020 13:35:21 -0800 Subject: [PATCH] Make YGValue.h compile with Clang on Windows Summary: - We use a fork of Microsoft's react-native-windows which uses a fork of Facebook's react-native - YGValue.h does not compile with Clang on Windows - This change should fix that - I want to put the change here so that it bubbles back to our fork > https://our.intern.facebook.com/intern/diff/D19656093/ #Changelog: [General][Fixed] Make YGValue.h compile with Clang on Windows Reviewed By: SidharthGuglani Differential Revision: D19717489 fbshipit-source-id: ad867ecaf910bb64a777a06c656a1867bb15484b --- ReactCommon/yoga/yoga/YGValue.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ReactCommon/yoga/yoga/YGValue.h b/ReactCommon/yoga/yoga/YGValue.h index aaa10c3f5f4add..a20009784ea8ed 100644 --- a/ReactCommon/yoga/yoga/YGValue.h +++ b/ReactCommon/yoga/yoga/YGValue.h @@ -11,6 +11,13 @@ #include "YGEnums.h" #include "YGMacros.h" +#if defined(_MSC_VER) && defined(__clang__) +#define COMPILING_WITH_CLANG_ON_WINDOWS +#endif +#if defined(COMPILING_WITH_CLANG_ON_WINDOWS) +#include +constexpr float YGUndefined = std::numeric_limits::quiet_NaN(); +#else YG_EXTERN_C_BEGIN // Not defined in MSVC++ @@ -20,6 +27,7 @@ static const uint32_t __nan = 0x7fc00000; #endif #define YGUndefined NAN +#endif typedef struct YGValue { float value; @@ -30,7 +38,10 @@ YOGA_EXPORT extern const YGValue YGValueAuto; YOGA_EXPORT extern const YGValue YGValueUndefined; YOGA_EXPORT extern const YGValue YGValueZero; +#if !defined(COMPILING_WITH_CLANG_ON_WINDOWS) YG_EXTERN_C_END +#endif +#undef COMPILING_WITH_CLANG_ON_WINDOWS #ifdef __cplusplus