Fix exhaustive switches (#53032)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53032

## Changelog:

[General][Fixed] - Add default cases to switch statements in headers

Differential Revision: D79148595

fbshipit-source-id: e7260b5e9356b60b238b9f75ab1809fbbbbbeaf4
This commit is contained in:
Nolan O'Brien
2025-08-04 09:42:15 -07:00
committed by Facebook GitHub Bot
parent 0f912f8312
commit 323fe3a5d4
3 changed files with 11 additions and 7 deletions
@@ -158,8 +158,9 @@ class PerformanceEntryReporter {
return resourceTimingBuffer_;
case PerformanceEntryType::_NEXT:
throw std::logic_error("Cannot get buffer for _NEXT entry type");
default:
throw std::logic_error("Unhandled PerformanceEntryType");
}
throw std::logic_error("Unhandled PerformanceEntryType");
}
inline PerformanceEntryBuffer& getBufferRef(PerformanceEntryType entryType) {
@@ -176,8 +177,9 @@ class PerformanceEntryReporter {
return resourceTimingBuffer_;
case PerformanceEntryType::_NEXT:
throw std::logic_error("Cannot get buffer for _NEXT entry type");
default:
throw std::logic_error("Unhandled PerformanceEntryType");
}
throw std::logic_error("Unhandled PerformanceEntryType");
}
void traceMark(
@@ -36,9 +36,9 @@ struct ValueUnit {
case UnitType::Percent:
return value * referenceLength * 0.01f;
case UnitType::Undefined:
default:
return 0.0f;
}
return 0.0f;
}
constexpr operator bool() const {
@@ -32,9 +32,10 @@ static inline SchedulerPriority fromRawValue(double value) {
return SchedulerPriority::LowPriority;
case 5:
return SchedulerPriority::IdlePriority;
default:
react_native_assert(false && "Unsupported SchedulerPriority value");
return SchedulerPriority::NormalPriority;
}
react_native_assert(false && "Unsupported SchedulerPriority value");
return SchedulerPriority::NormalPriority;
}
static inline HighResDuration timeoutForSchedulerPriority(
@@ -50,9 +51,10 @@ static inline HighResDuration timeoutForSchedulerPriority(
return HighResDuration::fromChrono(std::chrono::seconds(10));
case SchedulerPriority::IdlePriority:
return HighResDuration::fromChrono(std::chrono::minutes(5));
default:
react_native_assert(false && "Unsupported SchedulerPriority value");
return HighResDuration::fromChrono(std::chrono::seconds(5));
}
react_native_assert(false && "Unsupported SchedulerPriority value");
return HighResDuration::fromChrono(std::chrono::seconds(5));
}
} // namespace facebook::react