Skip to content

Commit 4c560b1

Browse files
NSProgrammermeta-codesync[bot]
authored andcommitted
Fix -Wswitch-default issues (facebook#54661)
Summary: Pull Request resolved: facebook#54661 Changelog: [iOS] [Fixed] - Address `-Wswitch-default` warnings for projects that use that compiler flag Differential Revision: D87817060 fbshipit-source-id: caab371f59b6771b3f6bb16215ae8a4697206173
1 parent be94707 commit 4c560b1

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

packages/react-native/ReactCommon/jsinspector-modern/tracing/TracingCategory.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ inline std::string tracingCategoryToString(const Category &category)
3939
return "v8.execute";
4040
case Category::Screenshot:
4141
return "disabled-by-default-devtools.screenshot";
42+
default:
43+
folly::assume_unreachable();
44+
return "unknown";
4245
}
4346
}
4447

packages/react-native/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ struct std::hash<facebook::react::AttributedStringBox> {
7171
return std::hash<facebook::react::AttributedString>()(attributedStringBox.getValue());
7272
case facebook::react::AttributedStringBox::Mode::OpaquePointer:
7373
return std::hash<std::shared_ptr<void>>()(attributedStringBox.getOpaquePointer());
74+
default:
75+
react_native_assert(false && "Invalid AttributedStringBox::Mode");
76+
return 0;
7477
}
7578
}
7679
};

packages/react-native/ReactCommon/react/renderer/components/image/conversions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ inline std::string toString(const ImageResizeMode &value)
163163
return "repeat";
164164
case ImageResizeMode::None:
165165
return "none";
166+
default:
167+
LOG(ERROR) << "Unsupported ImageResizeMode value: " << (int)value;
168+
react_native_expect(false);
169+
// "cover" is default in non-Fabric web and iOS
170+
return "cover";
166171
}
167172
}
168173

0 commit comments

Comments
 (0)