From 1f0d7bfe23d53774e850ca9ed61039b73d3044b2 Mon Sep 17 00:00:00 2001 From: Nolan O'Brien Date: Mon, 3 Nov 2025 21:20:33 -0800 Subject: [PATCH] Fix missing enum values in switch statements (xplat/js) Summary: X-link: https://github.com/facebook/react-native/pull/54397 Make improvements so that it is safe to use the `-Wswitch-enum` compiler error in a project consuming RN Differential Revision: D86026884 --- yoga/style/StyleLength.h | 7 +++++++ yoga/style/StyleSizeLength.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/yoga/style/StyleLength.h b/yoga/style/StyleLength.h index 01e69718b2..8099ce7df4 100644 --- a/yoga/style/StyleLength.h +++ b/yoga/style/StyleLength.h @@ -74,7 +74,14 @@ class StyleLength { } constexpr FloatOptional resolve(float referenceLength) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wswitch-enum" +#endif switch (unit_) { +#ifdef __clang__ +#pragma clang diagnostic pop +#endif case Unit::Point: return value_; case Unit::Percent: diff --git a/yoga/style/StyleSizeLength.h b/yoga/style/StyleSizeLength.h index 8dc4f24013..fc4d371e42 100644 --- a/yoga/style/StyleSizeLength.h +++ b/yoga/style/StyleSizeLength.h @@ -99,7 +99,14 @@ class StyleSizeLength { } constexpr FloatOptional resolve(float referenceLength) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wswitch-enum" +#endif switch (unit_) { +#ifdef __clang__ +#pragma clang diagnostic pop +#endif case Unit::Point: return value_; case Unit::Percent: