Skip to content

Commit

Permalink
Make YGValue.h compile with Clang on Windows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
christophpurrer authored and facebook-github-bot committed Feb 5, 2020
1 parent 46dcce0 commit 014bc95
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ReactCommon/yoga/yoga/YGValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand All @@ -20,6 +27,7 @@ static const uint32_t __nan = 0x7fc00000;
#endif

#define YGUndefined NAN
#endif

typedef struct YGValue {
float value;
Expand All @@ -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

Expand Down

0 comments on commit 014bc95

Please sign in to comment.