Skip to content

Commit 014bc95

Browse files
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
1 parent 46dcce0 commit 014bc95

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ReactCommon/yoga/yoga/YGValue.h

+11
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
#include "YGEnums.h"
1212
#include "YGMacros.h"
1313

14+
#if defined(_MSC_VER) && defined(__clang__)
15+
#define COMPILING_WITH_CLANG_ON_WINDOWS
16+
#endif
17+
#if defined(COMPILING_WITH_CLANG_ON_WINDOWS)
18+
#include <limits>
19+
constexpr float YGUndefined = std::numeric_limits<float>::quiet_NaN();
20+
#else
1421
YG_EXTERN_C_BEGIN
1522

1623
// Not defined in MSVC++
@@ -20,6 +27,7 @@ static const uint32_t __nan = 0x7fc00000;
2027
#endif
2128

2229
#define YGUndefined NAN
30+
#endif
2331

2432
typedef struct YGValue {
2533
float value;
@@ -30,7 +38,10 @@ YOGA_EXPORT extern const YGValue YGValueAuto;
3038
YOGA_EXPORT extern const YGValue YGValueUndefined;
3139
YOGA_EXPORT extern const YGValue YGValueZero;
3240

41+
#if !defined(COMPILING_WITH_CLANG_ON_WINDOWS)
3342
YG_EXTERN_C_END
43+
#endif
44+
#undef COMPILING_WITH_CLANG_ON_WINDOWS
3445

3546
#ifdef __cplusplus
3647

0 commit comments

Comments
 (0)