From 9c5623f93fedce5f6982774cedf3221b04faa1aa Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Wed, 16 Jul 2025 11:01:41 -0700 Subject: [PATCH] Fix unreachable-break issue in executorch/runtime/executor/method_meta.cpp +5 (#12489) Summary: LLVM has a warning `-Wunreachable-code-break` which identifies `break` statements that cannot be reached. These compromise readability, are misleading, and may identify bugs. This diff removes such statements. Such statements once existed to prevent accidental fallthroughs in switch statements. However, this is no longer necessary in C++17 because `[[fallthrough]]` is used to indicate intentional fallthroughs and we raise compilation errors for fallthroughs that are not annotated with `[[fallthrough]]` using `-Wimplicit-fallthrough`. For questions/comments, contact r-barnes. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: dtolnay, JacobSzwejbka Differential Revision: D78275955 --- runtime/executor/method_meta.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/runtime/executor/method_meta.cpp b/runtime/executor/method_meta.cpp index 2f45660b290..53568e5497c 100644 --- a/runtime/executor/method_meta.cpp +++ b/runtime/executor/method_meta.cpp @@ -24,24 +24,18 @@ Result get_tag( return_type serialization_value, size_t index) { switch (serialization_value->val_type()) { - case executorch_flatbuffer::KernelTypes::Null: { + case executorch_flatbuffer::KernelTypes::Null: return Tag::None; - } break; - case executorch_flatbuffer::KernelTypes::Int: { + case executorch_flatbuffer::KernelTypes::Int: return Tag::Int; - } break; - case executorch_flatbuffer::KernelTypes::Double: { + case executorch_flatbuffer::KernelTypes::Double: return Tag::Double; - } break; - case executorch_flatbuffer::KernelTypes::Bool: { + case executorch_flatbuffer::KernelTypes::Bool: return Tag::Bool; - } break; - case executorch_flatbuffer::KernelTypes::String: { + case executorch_flatbuffer::KernelTypes::String: return Tag::String; - } break; - case executorch_flatbuffer::KernelTypes::Tensor: { + case executorch_flatbuffer::KernelTypes::Tensor: return Tag::Tensor; - } break; default: ET_LOG( Error,