Fixup Yoga UT compilation on non-clang compilers (#1333)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1333 Yoga is compiled on more than clang, both internally, and in OSS. D47345669 added unguarded usage of ` #pragma clang diagnostic push` to Yoga UTs which will cause unrecognized pragma errors if building the tests on other platforms. The code here is flagged for implicitly converting enum to float. This is test code which is using the enum as an arbitrary differentiating input, so I just changed this to an explicit cast, which I assume should silence the warning. Reviewed By: NuriAmari Differential Revision: D47460301 fbshipit-source-id: 952ff61e0c26deb8bbff8b860faf30896753a3bd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
45b0697960
commit
61bf4d15ab
@@ -33,11 +33,7 @@ TEST(YGNode, measure_with_measure_fn) {
|
|||||||
|
|
||||||
n.setMeasureFunc(
|
n.setMeasureFunc(
|
||||||
[](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) {
|
[](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) {
|
||||||
// TODO: Correctly fix enum - float conversion warning: T158155910
|
return YGSize{w * static_cast<int>(wm), h / static_cast<int>(hm)};
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wenum-float-conversion"
|
|
||||||
return YGSize{w * wm, h / hm};
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(
|
||||||
@@ -62,19 +58,11 @@ TEST(YGNode, switching_measure_fn_types) {
|
|||||||
auto n = YGNode{};
|
auto n = YGNode{};
|
||||||
n.setMeasureFunc(
|
n.setMeasureFunc(
|
||||||
[](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*) {
|
[](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*) {
|
||||||
// TODO: Properly fix enum - float conversion warning: T158155910
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wenum-float-conversion"
|
|
||||||
return YGSize{};
|
return YGSize{};
|
||||||
#pragma clang diagnostic pop
|
|
||||||
});
|
});
|
||||||
n.setMeasureFunc(
|
n.setMeasureFunc(
|
||||||
[](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) {
|
[](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) {
|
||||||
// TODO: Properly fix enum - float conversion warning: T158155910
|
return YGSize{w * static_cast<int>(wm), h / static_cast<int>(hm)};
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wenum-float-conversion"
|
|
||||||
return YGSize{w * wm, h / hm};
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_EQ(
|
ASSERT_EQ(
|
||||||
|
Reference in New Issue
Block a user