From 8c13cbe0fd8680780d0e09af657362df1a18592b Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 3 May 2023 22:03:47 -0700 Subject: [PATCH] Try to fix MSVC Buck Build (#37242) Summary: X-link: https://github.com/facebook/react-native/pull/37242 Pull Request resolved: https://github.com/facebook/yoga/pull/1278 Reviewed By: yungsters Differential Revision: D45552325 fbshipit-source-id: 881e83b72166900fc475bcf77ec2849759766894 --- enums.py | 4 ++-- yoga/BitUtils.h | 3 ++- yoga/CompactValue.h | 12 +++++++----- yoga/YGConfig.h | 5 +++-- yoga/YGEnums.cpp | 2 +- yoga/YGEnums.h | 2 +- yoga/YGNodePrint.cpp | 7 +++++-- yoga/YGNodePrint.h | 2 +- yoga/YGStyle.h | 5 +++-- yoga/YGValue.cpp | 2 +- yoga/YGValue.h | 4 ++-- yoga/Yoga-internal.h | 4 +++- yoga/Yoga.cpp | 16 ++++------------ yoga/Yoga.h | 6 +++--- yoga/log.cpp | 4 ++-- yoga/log.h | 2 +- 16 files changed, 41 insertions(+), 39 deletions(-) diff --git a/enums.py b/enums.py index f2dfd04deb..be219cd7d5 100644 --- a/enums.py +++ b/enums.py @@ -130,7 +130,7 @@ def to_log_lower(symbol): with open(root + "/yoga/YGEnums.h", "w") as f: f.write(get_license("cpp")) f.write("#pragma once\n") - f.write('#include "YGMacros.h"\n\n') + f.write("#include \n\n") f.write("// clang-format off\n\n\n") f.write("YG_EXTERN_C_BEGIN\n\n") @@ -159,7 +159,7 @@ def to_log_lower(symbol): # write out C body for printing with open(root + "/yoga/YGEnums.cpp", "w") as f: f.write(get_license("cpp")) - f.write('#include "YGEnums.h"\n\n') + f.write("#include \n\n") items = sorted(ENUMS.items()) for name, values in items: f.write("const char* YG%sToString(const YG%s value) {\n" % (name, name)) diff --git a/yoga/BitUtils.h b/yoga/BitUtils.h index c8247e1390..e544defae7 100644 --- a/yoga/BitUtils.h +++ b/yoga/BitUtils.h @@ -10,7 +10,8 @@ #include #include #include -#include "YGEnums.h" + +#include namespace facebook { namespace yoga { diff --git a/yoga/CompactValue.h b/yoga/CompactValue.h index 26859330f3..20462ce35d 100644 --- a/yoga/CompactValue.h +++ b/yoga/CompactValue.h @@ -7,6 +7,13 @@ #pragma once +#include +#include +#include + +#include +#include + #if defined(__has_include) && __has_include() // needed to be able to evaluate defined(__cpp_lib_bit_cast) #include @@ -20,11 +27,6 @@ #else #include #endif -#include "YGValue.h" -#include "YGMacros.h" -#include -#include -#include static_assert( std::numeric_limits::is_iec559, diff --git a/yoga/YGConfig.h b/yoga/YGConfig.h index 4d4038de9f..f4e454262c 100644 --- a/yoga/YGConfig.h +++ b/yoga/YGConfig.h @@ -7,9 +7,10 @@ #pragma once -#include "Yoga-internal.h" -#include "Yoga.h" +#include + #include "BitUtils.h" +#include "Yoga-internal.h" namespace facebook { namespace yoga { diff --git a/yoga/YGEnums.cpp b/yoga/YGEnums.cpp index 50cc418a91..96b424a3bf 100644 --- a/yoga/YGEnums.cpp +++ b/yoga/YGEnums.cpp @@ -7,7 +7,7 @@ // @generated by enums.py -#include "YGEnums.h" +#include const char* YGAlignToString(const YGAlign value) { switch (value) { diff --git a/yoga/YGEnums.h b/yoga/YGEnums.h index eb4fbe7273..72146fe279 100644 --- a/yoga/YGEnums.h +++ b/yoga/YGEnums.h @@ -8,7 +8,7 @@ // @generated by enums.py #pragma once -#include "YGMacros.h" +#include // clang-format off diff --git a/yoga/YGNodePrint.cpp b/yoga/YGNodePrint.cpp index 7e53549c26..d4d3499a3f 100644 --- a/yoga/YGNodePrint.cpp +++ b/yoga/YGNodePrint.cpp @@ -6,9 +6,12 @@ */ #ifdef DEBUG -#include "YGNodePrint.h" + #include -#include "YGEnums.h" + +#include + +#include "YGNodePrint.h" #include "YGNode.h" #include "Yoga-internal.h" #include "Utils.h" diff --git a/yoga/YGNodePrint.h b/yoga/YGNodePrint.h index f06d457c4d..ac550e9611 100644 --- a/yoga/YGNodePrint.h +++ b/yoga/YGNodePrint.h @@ -11,7 +11,7 @@ #include -#include "Yoga.h" +#include namespace facebook { namespace yoga { diff --git a/yoga/YGStyle.h b/yoga/YGStyle.h index 20ce4e0562..4f182d0691 100644 --- a/yoga/YGStyle.h +++ b/yoga/YGStyle.h @@ -11,11 +11,12 @@ #include #include #include + +#include + #include "CompactValue.h" -#include "YGEnums.h" #include "YGFloatOptional.h" #include "Yoga-internal.h" -#include "Yoga.h" #include "BitUtils.h" class YOGA_EXPORT YGStyle { diff --git a/yoga/YGValue.cpp b/yoga/YGValue.cpp index 89ff41bab1..194d22caa8 100644 --- a/yoga/YGValue.cpp +++ b/yoga/YGValue.cpp @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -#include "YGValue.h" +#include const YGValue YGValueZero = {0, YGUnitPoint}; const YGValue YGValueUndefined = {YGUndefined, YGUnitUndefined}; diff --git a/yoga/YGValue.h b/yoga/YGValue.h index a4f89f3b39..59f6f5e461 100644 --- a/yoga/YGValue.h +++ b/yoga/YGValue.h @@ -7,8 +7,8 @@ #pragma once -#include "YGEnums.h" -#include "YGMacros.h" +#include +#include YG_EXTERN_C_BEGIN diff --git a/yoga/Yoga-internal.h b/yoga/Yoga-internal.h index e6f370d6bf..6f60e4e149 100644 --- a/yoga/Yoga-internal.h +++ b/yoga/Yoga-internal.h @@ -11,8 +11,10 @@ #include #include #include + +#include + #include "CompactValue.h" -#include "Yoga.h" using YGVector = std::vector; diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 6201efb025..d9863a2f19 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -5,28 +5,20 @@ * LICENSE file in the root directory of this source tree. */ -#include "Yoga.h" -#include "log.h" #include #include #include #include #include + +#include + +#include "log.h" #include "Utils.h" #include "YGNode.h" #include "YGNodePrint.h" #include "Yoga-internal.h" #include "event/event.h" -#ifdef _MSC_VER -#include - -/* define fmaxf if < VC12 */ -#if _MSC_VER < 1800 -__forceinline const float fmaxf(const float a, const float b) { - return (a > b) ? a : b; -} -#endif -#endif using namespace facebook::yoga; using detail::Log; diff --git a/yoga/Yoga.h b/yoga/Yoga.h index 9e9060b9b4..1beb320e08 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -18,9 +18,9 @@ #include #endif -#include "YGEnums.h" -#include "YGMacros.h" -#include "YGValue.h" +#include +#include +#include YG_EXTERN_C_BEGIN diff --git a/yoga/log.cpp b/yoga/log.cpp index dbf7b4376e..6cdd3f69f4 100644 --- a/yoga/log.cpp +++ b/yoga/log.cpp @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#include "log.h" +#include -#include "Yoga.h" +#include "log.h" #include "YGConfig.h" #include "YGNode.h" diff --git a/yoga/log.h b/yoga/log.h index 1d270e82e4..419724e223 100644 --- a/yoga/log.h +++ b/yoga/log.h @@ -7,7 +7,7 @@ #pragma once -#include "YGEnums.h" +#include struct YGNode; struct YGConfig;