Skip to content

Fix GCC -Werror=return-type#1910

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

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

Conversation

@NickGerleman

Copy link
Copy Markdown
Contributor

Summary:
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:
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
@vercel

vercel Bot commented Mar 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
yoga-website Ready Ready Preview, Comment Mar 6, 2026 7:53am

Request Review

@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.

@meta-cla meta-cla Bot added the CLA Signed label Mar 6, 2026
NickGerleman added a commit to NickGerleman/react-native that referenced this pull request Mar 6, 2026
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

@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

meta-codesync Bot commented Mar 6, 2026

Copy link
Copy Markdown

This pull request has been merged in 8484a8c.

meta-codesync Bot pushed a commit to react/react-native that referenced this pull request Mar 6, 2026
Summary:
Pull Request resolved: #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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants