Skip to content

Fix GCC -Werror=return-type#55967

Closed
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D95513063
Closed

Fix GCC -Werror=return-type#55967
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D95513063

Conversation

@NickGerleman

Copy link
Copy Markdown
Contributor

Summary:
X-link: react/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

Summary:
X-link: react/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
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 6, 2026
@meta-codesync

meta-codesync Bot commented Mar 6, 2026

Copy link
Copy Markdown

@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95513063.

@cortinico cortinico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

meta-codesync Bot pushed a commit to react/yoga that referenced this pull request Mar 6, 2026
Summary:
X-link: react/react-native#55967

Pull Request resolved: #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
@meta-codesync meta-codesync Bot closed this in a18f802 Mar 6, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @NickGerleman in a18f802

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Mar 6, 2026
@meta-codesync

meta-codesync Bot commented Mar 6, 2026

Copy link
Copy Markdown

This pull request has been merged in a18f802.

zoontek pushed a commit to zoontek/react-native that referenced this pull request Mar 9, 2026
Summary:
Pull Request resolved: react#55967

X-link: react/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants