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
This commit is contained in:
Christoph Purrer 2020-02-05 13:35:21 -08:00 коммит произвёл Facebook Github Bot
Родитель 46dcce0031
Коммит 014bc95135
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -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 <limits>
constexpr float YGUndefined = std::numeric_limits<float>::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