From 9172bfe647d7489bc9e0067f85752e3e30e557e0 Mon Sep 17 00:00:00 2001 From: Ingrid Wang Date: Tue, 7 Apr 2026 14:03:21 -0700 Subject: [PATCH] Fixing unreachable-code-return in react-native-github (#56338) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56338 ## Changelog: [iOS] [Fixed] - Addressed -Wunreachable-code-return violations Reviewed By: NickGerleman Differential Revision: D97797196 fbshipit-source-id: 0a7a34d69fb4592094bbcbae5d56bc848eb8f01b --- .../tracing/TracingCategory.h | 1 - .../tests/RuntimeSchedulerTest.cpp | 40 +++++++++---------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tracing/TracingCategory.h b/packages/react-native/ReactCommon/jsinspector-modern/tracing/TracingCategory.h index 4c8df921c2d..24c1880b9df 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tracing/TracingCategory.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/tracing/TracingCategory.h @@ -44,7 +44,6 @@ inline std::string tracingCategoryToString(const Category &category) return "disabled-by-default-devtools.screenshot"; default: folly::assume_unreachable(); - return "unknown"; } } diff --git a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp index f04ad51bffc..803530c5e14 100644 --- a/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +++ b/packages/react-native/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp @@ -858,11 +858,10 @@ TEST_P(RuntimeSchedulerTest, scheduleTaskFromTask) { TEST_P(RuntimeSchedulerTest, handlingError) { bool didRunTask = false; - auto firstCallback = - createHostFunctionFromLambda([this, &didRunTask](bool /*unused*/) { + auto firstCallback = createHostFunctionFromLambda( + [this, &didRunTask](bool /*unused*/) -> jsi::Value { didRunTask = true; throw jsi::JSError(*runtime_, "Test error"); - return jsi::Value::undefined(); }); runtimeScheduler_->scheduleTask( @@ -1169,27 +1168,26 @@ TEST_P(RuntimeSchedulerTest, errorInTaskShouldNotStopMicrotasks) { auto microtaskRan = false; auto taskRan = false; - auto callback = createHostFunctionFromLambda([&](bool /* unused */) { - taskRan = true; + auto callback = + createHostFunctionFromLambda([&](bool /* unused */) -> jsi::Value { + taskRan = true; - auto microtaskCallback = jsi::Function::createFromHostFunction( - *runtime_, - jsi::PropNameID::forUtf8(*runtime_, "microtask1"), - 3, - [&](jsi::Runtime& /*unused*/, - const jsi::Value& /*unused*/, - const jsi::Value* /*arguments*/, - size_t /*unused*/) -> jsi::Value { - microtaskRan = true; - return jsi::Value::undefined(); - }); + auto microtaskCallback = jsi::Function::createFromHostFunction( + *runtime_, + jsi::PropNameID::forUtf8(*runtime_, "microtask1"), + 3, + [&](jsi::Runtime& /*unused*/, + const jsi::Value& /*unused*/, + const jsi::Value* /*arguments*/, + size_t /*unused*/) -> jsi::Value { + microtaskRan = true; + return jsi::Value::undefined(); + }); - runtime_->queueMicrotask(microtaskCallback); + runtime_->queueMicrotask(microtaskCallback); - throw jsi::JSError(*runtime_, "Test error"); - - return jsi::Value::undefined(); - }); + throw jsi::JSError(*runtime_, "Test error"); + }); runtimeScheduler_->scheduleTask( SchedulerPriority::NormalPriority, std::move(callback));