Repository navigation
Conversation
…t/executorch`
Summary:
D127334907 enables `-Wunreachable-code-break` through the PACKAGE files of `fbcode/example`, `fbcode/excalibur`, `fbcode/executorch`, `fbcode/experience-ai`, `xplat/executorch`. This diff fixes the code that warning flags there, so the PACKAGE change builds cleanly on top of it.
Fixes the new warning in executorch (fbcode side edited; the `xplat/executorch` dirsync mirror is identical): removes `break;` statements that can never run because the preceding statement always leaves the case. In `devtools/bundled_program/bundled_program.cpp` they follow `ET_CHECK_OR_RETURN_ERROR(false, ...)` (always returns) or `return`; in `extension/fb/ptez/ptez_data_loader.cpp` and `runtime/executor/method_meta.cpp` (`get_tag`) they follow `return`; in `backends/vulkan/runtime/vk_api/Pipeline.cpp` (`vk_layout`) the inner `switch` returns on every path. Behavior is unchanged.
Removes unreachable `break;` statements in Vulkan test and tool code (fbcode side edited; the `xplat/executorch` mirror is identical): `backends/vulkan/test/utils/test_utils.cpp` (after `throw`), `backends/vulkan/test/vulkan_compute_api_test.cpp` (after an inner `switch` that returns on every path), and `backends/vulkan/fb/tools/cli/{benchmark,correctness}/optparser.cpp` (after `exit(1)`).
Reviewed By: dtolnay
Differential Revision: D127368223
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24155
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 56eadce with merge base f1de711 ( BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@r-barnes has exported this pull request. If you are a Meta employee, you can view the originating Diff in D127368223. |
This PR needs a
|
There was a problem hiding this comment.
🟢 Approval recommended
The supplied changes remove only unreachable statements, preserve existing control flow, and have no unresolved findings.
No open issues 🎉
What changed in this PR
Removes unreachable break; statements from ExecuTorch runtime, bundled-program utilities, and Vulkan code to support enabling -Wunreachable-code-break without changing behavior.
Changes:
- Removes redundant breaks after returns, error-return macros, and a throw.
- Removes breaks after nested switches that return on every path.
| File | Description |
|---|---|
runtime/executor/method_meta.cpp |
Removes breaks after tag returns. |
devtools/bundled_program/bundled_program.cpp |
Removes breaks after error returns. |
backends/vulkan/test/vulkan_compute_api_test.cpp |
Removes a break after an always-returning switch. |
backends/vulkan/test/utils/test_utils.cpp |
Removes a break after a throw. |
backends/vulkan/runtime/vk_api/Pipeline.cpp |
Removes a break after an always-returning layout switch. |
Review effort: Balanced
Summary:
D127334907 enables
-Wunreachable-code-breakthrough the PACKAGE files offbcode/example,fbcode/excalibur,fbcode/executorch,fbcode/experience-ai,xplat/executorch. This diff fixes the code that warning flags there, so the PACKAGE change builds cleanly on top of it.Fixes the new warning in executorch (fbcode side edited; the
xplat/executorchdirsync mirror is identical): removesbreak;statements that can never run because the preceding statement always leaves the case. Indevtools/bundled_program/bundled_program.cppthey followET_CHECK_OR_RETURN_ERROR(false, ...)(always returns) orreturn; inextension/fb/ptez/ptez_data_loader.cppandruntime/executor/method_meta.cpp(get_tag) they followreturn; inbackends/vulkan/runtime/vk_api/Pipeline.cpp(vk_layout) the innerswitchreturns on every path. Behavior is unchanged.Removes unreachable
break;statements in Vulkan test and tool code (fbcode side edited; thexplat/executorchmirror is identical):backends/vulkan/test/utils/test_utils.cpp(afterthrow),backends/vulkan/test/vulkan_compute_api_test.cpp(after an innerswitchthat returns on every path), andbackends/vulkan/fb/tools/cli/{benchmark,correctness}/optparser.cpp(afterexit(1)).Reviewed By: dtolnay
Differential Revision: D127368223