From a9bddf87ff8ed0ab40fde3962aee3a8682c03319 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Mon, 4 Mar 2019 02:34:33 -0800 Subject: [PATCH] Fix problems with GCC < v8 Summary: @public GCC up until v7 flags our way of reading edges in `YGNodeSetStyleInputs` as unused variables. I managed to work around that by rearranging the casts a bit. Reviewed By: SidharthGuglani Differential Revision: D14299439 fbshipit-source-id: eec0266185504d1b790b9ef574bd4a83c0059d3a --- java/jni/YGJNI.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/java/jni/YGJNI.cpp b/java/jni/YGJNI.cpp index f36e6e20..f1d9feaa 100644 --- a/java/jni/YGJNI.cpp +++ b/java/jni/YGJNI.cpp @@ -755,18 +755,17 @@ static void YGNodeSetStyleInputs( YGNodeStyleSetDisplay(node, static_cast(*styleInputs++)); break; case Margin: { - float edge = *styleInputs++; + auto edge = static_cast(*styleInputs++); float marginValue = *styleInputs++; ygNodeRefToYGNodeContext(node)->edgeSetFlag |= MARGIN; - YGNodeStyleSetMargin(node, static_cast(edge), marginValue); + YGNodeStyleSetMargin(node, edge, marginValue); break; } case MarginPercent: { - float edge = *styleInputs++; + auto edge = static_cast(*styleInputs++); float marginPercent = *styleInputs++; ygNodeRefToYGNodeContext(node)->edgeSetFlag |= MARGIN; - YGNodeStyleSetMarginPercent( - node, static_cast(edge), marginPercent); + YGNodeStyleSetMarginPercent(node, edge, marginPercent); break; } case MarginAuto: { @@ -775,38 +774,36 @@ static void YGNodeSetStyleInputs( break; } case Padding: { - float edge = *styleInputs++; + auto edge = static_cast(*styleInputs++); float paddingValue = *styleInputs++; ygNodeRefToYGNodeContext(node)->edgeSetFlag |= PADDING; - YGNodeStyleSetPadding(node, static_cast(edge), paddingValue); + YGNodeStyleSetPadding(node, edge, paddingValue); break; } case PaddingPercent: { - float edge = *styleInputs++; + auto edge = static_cast(*styleInputs++); float paddingPercent = *styleInputs++; ygNodeRefToYGNodeContext(node)->edgeSetFlag |= PADDING; - YGNodeStyleSetPaddingPercent( - node, static_cast(edge), paddingPercent); + YGNodeStyleSetPaddingPercent(node, edge, paddingPercent); break; } case Border: { - float edge = *styleInputs++; + auto edge = static_cast(*styleInputs++); float borderValue = *styleInputs++; ygNodeRefToYGNodeContext(node)->edgeSetFlag |= BORDER; - YGNodeStyleSetBorder(node, static_cast(edge), borderValue); + YGNodeStyleSetBorder(node, edge, borderValue); break; } case Position: { - float edge = *styleInputs++; + auto edge = static_cast(*styleInputs++); float positionValue = *styleInputs++; - YGNodeStyleSetPosition(node, static_cast(edge), positionValue); + YGNodeStyleSetPosition(node, edge, positionValue); break; } case PositionPercent: { - float edge = *styleInputs++; + auto edge = static_cast(*styleInputs++); float positionPercent = *styleInputs++; - YGNodeStyleSetPositionPercent( - node, static_cast(edge), positionPercent); + YGNodeStyleSetPositionPercent(node, edge, positionPercent); break; } case IsReferenceBaseline: {