Skip to content

Commit cec299f

Browse files
NSProgrammermeta-codesync[bot]
authored andcommitted
Fix missing enum values in switch statements (xplat/js)
Summary: Make improvements so that it is safe to use the `-Wswitch-enum` compiler error in a project consuming RN Changelog: [iOS] [Fixed] - Improve support for projects with `-Wswitch-enum` compiler error Differential Revision: D86026884 fbshipit-source-id: 0407cc24d39d8da3badcc38a890b1dcff4b8f10c
1 parent 69e87a4 commit cec299f

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

yoga/style/StyleLength.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ class StyleLength {
7474
}
7575

7676
constexpr FloatOptional resolve(float referenceLength) {
77+
#ifdef __clang__
78+
#pragma clang diagnostic push
79+
#pragma clang diagnostic ignored "-Wswitch-enum"
80+
#endif
7781
switch (unit_) {
82+
#ifdef __clang__
83+
#pragma clang diagnostic pop
84+
#endif
7885
case Unit::Point:
7986
return value_;
8087
case Unit::Percent:

yoga/style/StyleSizeLength.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,14 @@ class StyleSizeLength {
9999
}
100100

101101
constexpr FloatOptional resolve(float referenceLength) {
102+
#ifdef __clang__
103+
#pragma clang diagnostic push
104+
#pragma clang diagnostic ignored "-Wswitch-enum"
105+
#endif
102106
switch (unit_) {
107+
#ifdef __clang__
108+
#pragma clang diagnostic pop
109+
#endif
103110
case Unit::Point:
104111
return value_;
105112
case Unit::Percent:

0 commit comments

Comments
 (0)