Skip to content

Commit 69df1dc

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Fix GCC -Werror=return-type
Summary: X-link: facebook/yoga#1910 GCC emits `-Wreturn-type` for `gridTrackSizeFromTypeAndValue` and `styleSizeLengthFromTypeAndValue` because it does not suppress the warning for exhaustive switches over C-style enums (unlike Clang). Add `fatalWithMessage` after each switch to satisfy `-Werror=return-type`, matching the existing pattern used in `Style.h` for similar exhaustive switches. Differential Revision: D95513063
1 parent 53cd9ce commit 69df1dc

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ GridTrackSize gridTrackSizeFromTypeAndValue(YGGridTrackType type, float value) {
622622
case YGGridTrackTypeMinmax:
623623
return GridTrackSize::auto_();
624624
}
625+
fatalWithMessage("Unknown YGGridTrackType");
625626
}
626627

627628
StyleSizeLength styleSizeLengthFromTypeAndValue(
@@ -639,6 +640,7 @@ StyleSizeLength styleSizeLengthFromTypeAndValue(
639640
case YGGridTrackTypeMinmax:
640641
return StyleSizeLength::ofAuto();
641642
}
643+
fatalWithMessage("Unknown YGGridTrackType");
642644
}
643645

644646
} // namespace

0 commit comments

Comments
 (0)