Skip to content

Commit a18f802

Browse files
NickGerlemanmeta-codesync[bot]
authored andcommitted
Fix GCC -Werror=return-type (#55967)
Summary: Pull Request resolved: #55967 X-link: facebook/yoga#1910 GCC with `-Wall -Werror` 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. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D95513063 fbshipit-source-id: aab3635b34ff2ca57bf138b92b7378f2608e605d
1 parent 3483dfa commit a18f802

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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)