diff options
46 files changed, 99 insertions, 98 deletions
diff --git a/compiler/compiled_method.cc b/compiler/compiled_method.cc index ef9d919c75..58f7e4f227 100644 --- a/compiler/compiled_method.cc +++ b/compiler/compiled_method.cc @@ -73,7 +73,7 @@ size_t CompiledCode::CodeDelta(InstructionSet instruction_set) { } default: LOG(FATAL) << "Unknown InstructionSet: " << instruction_set; - return 0; + UNREACHABLE(); } } @@ -94,7 +94,7 @@ const void* CompiledCode::CodePointer(const void* code_pointer, InstructionSet i } default: LOG(FATAL) << "Unknown InstructionSet: " << instruction_set; - return nullptr; + UNREACHABLE(); } } diff --git a/compiler/jni/quick/arm/calling_convention_arm.cc b/compiler/jni/quick/arm/calling_convention_arm.cc index 54f193b551..8b4bab722f 100644 --- a/compiler/jni/quick/arm/calling_convention_arm.cc +++ b/compiler/jni/quick/arm/calling_convention_arm.cc @@ -173,7 +173,7 @@ bool ArmManagedRuntimeCallingConvention::IsCurrentParamOnStack() { ManagedRegister ArmManagedRuntimeCallingConvention::CurrentParamRegister() { LOG(FATAL) << "Should not reach here"; - return ManagedRegister::NoRegister(); + UNREACHABLE(); } FrameOffset ArmManagedRuntimeCallingConvention::CurrentParamStackOffset() { diff --git a/compiler/jni/quick/arm64/calling_convention_arm64.cc b/compiler/jni/quick/arm64/calling_convention_arm64.cc index 328ecbbc5c..4e6221ef6d 100644 --- a/compiler/jni/quick/arm64/calling_convention_arm64.cc +++ b/compiler/jni/quick/arm64/calling_convention_arm64.cc @@ -181,7 +181,7 @@ bool Arm64ManagedRuntimeCallingConvention::IsCurrentParamOnStack() { ManagedRegister Arm64ManagedRuntimeCallingConvention::CurrentParamRegister() { LOG(FATAL) << "Should not reach here"; - return ManagedRegister::NoRegister(); + UNREACHABLE(); } FrameOffset Arm64ManagedRuntimeCallingConvention::CurrentParamStackOffset() { diff --git a/compiler/jni/quick/mips/calling_convention_mips.cc b/compiler/jni/quick/mips/calling_convention_mips.cc index 5ec1addcb9..d3d489ee36 100644 --- a/compiler/jni/quick/mips/calling_convention_mips.cc +++ b/compiler/jni/quick/mips/calling_convention_mips.cc @@ -124,7 +124,7 @@ bool MipsManagedRuntimeCallingConvention::IsCurrentParamOnStack() { ManagedRegister MipsManagedRuntimeCallingConvention::CurrentParamRegister() { LOG(FATAL) << "Should not reach here"; - return ManagedRegister::NoRegister(); + UNREACHABLE(); } FrameOffset MipsManagedRuntimeCallingConvention::CurrentParamStackOffset() { diff --git a/compiler/jni/quick/mips64/calling_convention_mips64.cc b/compiler/jni/quick/mips64/calling_convention_mips64.cc index a7012aefa8..3c7cee6306 100644 --- a/compiler/jni/quick/mips64/calling_convention_mips64.cc +++ b/compiler/jni/quick/mips64/calling_convention_mips64.cc @@ -109,7 +109,7 @@ bool Mips64ManagedRuntimeCallingConvention::IsCurrentParamOnStack() { ManagedRegister Mips64ManagedRuntimeCallingConvention::CurrentParamRegister() { LOG(FATAL) << "Should not reach here"; - return ManagedRegister::NoRegister(); + UNREACHABLE(); } FrameOffset Mips64ManagedRuntimeCallingConvention::CurrentParamStackOffset() { diff --git a/compiler/jni/quick/x86/calling_convention_x86.cc b/compiler/jni/quick/x86/calling_convention_x86.cc index ad58e3820d..71e601926b 100644 --- a/compiler/jni/quick/x86/calling_convention_x86.cc +++ b/compiler/jni/quick/x86/calling_convention_x86.cc @@ -257,7 +257,7 @@ bool X86JniCallingConvention::IsCurrentParamOnStack() { ManagedRegister X86JniCallingConvention::CurrentParamRegister() { LOG(FATAL) << "Should not reach here"; - return ManagedRegister::NoRegister(); + UNREACHABLE(); } FrameOffset X86JniCallingConvention::CurrentParamStackOffset() { diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index c2e83cd2c2..2184f99d76 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -1662,7 +1662,7 @@ QuickEntrypointEnum CodeGenerator::GetArrayAllocationEntrypoint(HNewArray* new_a case 3: return kQuickAllocArrayResolved64; } LOG(FATAL) << "Unreachable"; - return kQuickAllocArrayResolved; + UNREACHABLE(); } } // namespace art diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 48b50ea5d6..bbf167d615 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -3046,7 +3046,7 @@ void InstructionCodeGeneratorARM64::VisitDivZeroCheck(HDivZeroCheck* instruction if (!DataType::IsIntegralType(type)) { LOG(FATAL) << "Unexpected type " << type << " for DivZeroCheck."; - return; + UNREACHABLE(); } if (value.IsConstant()) { diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc index d5b734d55a..dad18134de 100644 --- a/compiler/optimizing/code_generator_arm_vixl.cc +++ b/compiler/optimizing/code_generator_arm_vixl.cc @@ -1037,26 +1037,26 @@ static uint32_t ComputeSRegisterListMask(const SRegisterList& regs) { size_t CodeGeneratorARMVIXL::SaveCoreRegister(size_t stack_index ATTRIBUTE_UNUSED, uint32_t reg_id ATTRIBUTE_UNUSED) { TODO_VIXL32(FATAL); - return 0; + UNREACHABLE(); } // Restores the register from the stack. Returns the size taken on stack. size_t CodeGeneratorARMVIXL::RestoreCoreRegister(size_t stack_index ATTRIBUTE_UNUSED, uint32_t reg_id ATTRIBUTE_UNUSED) { TODO_VIXL32(FATAL); - return 0; + UNREACHABLE(); } size_t CodeGeneratorARMVIXL::SaveFloatingPointRegister(size_t stack_index ATTRIBUTE_UNUSED, uint32_t reg_id ATTRIBUTE_UNUSED) { TODO_VIXL32(FATAL); - return 0; + UNREACHABLE(); } size_t CodeGeneratorARMVIXL::RestoreFloatingPointRegister(size_t stack_index ATTRIBUTE_UNUSED, uint32_t reg_id ATTRIBUTE_UNUSED) { TODO_VIXL32(FATAL); - return 0; + UNREACHABLE(); } static void GenerateDataProcInstruction(HInstruction::InstructionKind kind, @@ -2268,7 +2268,7 @@ Location InvokeDexCallingConventionVisitorARMVIXL::GetNextLocation(DataType::Typ case DataType::Type::kUint64: case DataType::Type::kVoid: LOG(FATAL) << "Unexpected parameter type " << type; - break; + UNREACHABLE(); } return Location::NoLocation(); } diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc index c6d0f3f618..c536dd3db5 100644 --- a/compiler/optimizing/code_generator_mips.cc +++ b/compiler/optimizing/code_generator_mips.cc @@ -147,7 +147,7 @@ Location InvokeDexCallingConventionVisitorMIPS::GetNextLocation(DataType::Type t case DataType::Type::kUint64: case DataType::Type::kVoid: LOG(FATAL) << "Unexpected parameter type " << type; - break; + UNREACHABLE(); } // Space on the stack is reserved for all arguments. diff --git a/compiler/optimizing/code_generator_mips64.cc b/compiler/optimizing/code_generator_mips64.cc index 039b3ca3ff..016aac791c 100644 --- a/compiler/optimizing/code_generator_mips64.cc +++ b/compiler/optimizing/code_generator_mips64.cc @@ -3642,7 +3642,7 @@ void InstructionCodeGeneratorMIPS64::VisitDivZeroCheck(HDivZeroCheck* instructio if (!DataType::IsIntegralType(type)) { LOG(FATAL) << "Unexpected type " << type << " for DivZeroCheck."; - return; + UNREACHABLE(); } if (value.IsConstant()) { diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index fba4da63cc..1b74d22a81 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -1228,7 +1228,7 @@ Location InvokeDexCallingConventionVisitorX86::GetNextLocation(DataType::Type ty case DataType::Type::kUint64: case DataType::Type::kVoid: LOG(FATAL) << "Unexpected parameter type " << type; - break; + UNREACHABLE(); } return Location::NoLocation(); } @@ -2989,7 +2989,7 @@ void LocationsBuilderX86::VisitAdd(HAdd* add) { default: LOG(FATAL) << "Unexpected add type " << add->GetResultType(); - break; + UNREACHABLE(); } } diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index e7212cd479..781f2724a5 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -2425,7 +2425,7 @@ Location InvokeDexCallingConventionVisitorX86_64::GetNextLocation(DataType::Type case DataType::Type::kUint64: case DataType::Type::kVoid: LOG(FATAL) << "Unexpected parameter type " << type; - break; + UNREACHABLE(); } return Location::NoLocation(); } diff --git a/compiler/optimizing/induction_var_analysis.cc b/compiler/optimizing/induction_var_analysis.cc index a4d638f4c6..3a10d5831d 100644 --- a/compiler/optimizing/induction_var_analysis.cc +++ b/compiler/optimizing/induction_var_analysis.cc @@ -1074,8 +1074,8 @@ bool HInductionVarAnalysis::IsTaken(InductionInfo* lower_expr, && lower_value >= upper_value; default: LOG(FATAL) << "CONDITION UNREACHABLE"; + UNREACHABLE(); } - return false; // not certain, may be untaken } bool HInductionVarAnalysis::IsFinite(InductionInfo* upper_expr, @@ -1099,8 +1099,8 @@ bool HInductionVarAnalysis::IsFinite(InductionInfo* upper_expr, return (IsAtLeast(upper_expr, &value) && value >= (min - stride_value)); default: LOG(FATAL) << "CONDITION UNREACHABLE"; + UNREACHABLE(); } - return false; // not certain, may be infinite } bool HInductionVarAnalysis::FitsNarrowerControl(InductionInfo* lower_expr, diff --git a/compiler/optimizing/instruction_simplifier.cc b/compiler/optimizing/instruction_simplifier.cc index 2b6ae2019f..4c6d6bacd8 100644 --- a/compiler/optimizing/instruction_simplifier.cc +++ b/compiler/optimizing/instruction_simplifier.cc @@ -749,8 +749,8 @@ static HCondition* GetOppositeConditionSwapOps(ArenaAllocator* allocator, HInstr return new (allocator) HBelowOrEqual(rhs, lhs); default: LOG(FATAL) << "Unknown ConditionType " << cond->GetKind(); + UNREACHABLE(); } - return nullptr; } static bool CmpHasBoolType(HInstruction* input, HInstruction* cmp) { diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 3f225f354c..d1fba31792 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -1231,7 +1231,7 @@ bool HInstructionList::FoundBefore(const HInstruction* instruction1, } } LOG(FATAL) << "Did not find an order between two instructions of the same block."; - return true; + UNREACHABLE(); } bool HInstruction::StrictlyDominates(HInstruction* other_instruction) const { @@ -1254,7 +1254,7 @@ bool HInstruction::StrictlyDominates(HInstruction* other_instruction) const { } else { // There is no order among phis. LOG(FATAL) << "There is no dominance between phis of a same block."; - return false; + UNREACHABLE(); } } else { // `this` is not a phi. diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc index 75b35556f1..20606fc988 100644 --- a/dex2oat/linker/image_writer.cc +++ b/dex2oat/linker/image_writer.cc @@ -895,7 +895,7 @@ void ImageWriter::SetImageBinSlot(mirror::Object* object, BinSlot bin_slot) { oss << ". Lock owner:" << lw.ThinLockOwner(); } LOG(FATAL) << oss.str(); - break; + UNREACHABLE(); } case LockWord::kUnlocked: // No hash, don't need to save it. diff --git a/disassembler/disassembler.cc b/disassembler/disassembler.cc index aee690e036..0662334852 100644 --- a/disassembler/disassembler.cc +++ b/disassembler/disassembler.cc @@ -75,7 +75,7 @@ Disassembler* Disassembler::Create(InstructionSet instruction_set, DisassemblerO #endif default: UNIMPLEMENTED(FATAL) << static_cast<uint32_t>(instruction_set); - return nullptr; + UNREACHABLE(); } } diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc index 1d106b2cdb..f8d6016315 100644 --- a/libartbase/base/file_utils.cc +++ b/libartbase/base/file_utils.cc @@ -157,7 +157,7 @@ static const char* GetAndroidDir(const char* env_var, const char* default_dir) { return dir; } else { LOG(FATAL) << error_msg; - return nullptr; + UNREACHABLE(); } } diff --git a/libdexfile/dex/dex_instruction.cc b/libdexfile/dex/dex_instruction.cc index 8378211c43..83663c50e8 100644 --- a/libdexfile/dex/dex_instruction.cc +++ b/libdexfile/dex/dex_instruction.cc @@ -85,7 +85,7 @@ int32_t Instruction::GetTargetOffset() const { default: LOG(FATAL) << "Tried to access the branch offset of an instruction " << Name() << " which does not have a target operand."; } - return 0; + UNREACHABLE(); } bool Instruction::CanFlowThrough() const { diff --git a/openjdkjvm/OpenjdkJvm.cc b/openjdkjvm/OpenjdkJvm.cc index 8d0200c346..7a388c9583 100644 --- a/openjdkjvm/OpenjdkJvm.cc +++ b/openjdkjvm/OpenjdkJvm.cc @@ -434,36 +434,37 @@ JNIEXPORT void JVM_SetNativeThreadName(JNIEnv* env, jobject jthread, jstring jav } } -JNIEXPORT jint JVM_IHashCode(JNIEnv* env ATTRIBUTE_UNUSED, +JNIEXPORT __attribute__((noreturn)) jint JVM_IHashCode(JNIEnv* env ATTRIBUTE_UNUSED, jobject javaObject ATTRIBUTE_UNUSED) { UNIMPLEMENTED(FATAL) << "JVM_IHashCode is not implemented"; - return 0; + UNREACHABLE(); } -JNIEXPORT jlong JVM_NanoTime(JNIEnv* env ATTRIBUTE_UNUSED, jclass unused ATTRIBUTE_UNUSED) { +JNIEXPORT __attribute__((noreturn)) jlong JVM_NanoTime(JNIEnv* env ATTRIBUTE_UNUSED, jclass unused ATTRIBUTE_UNUSED) { UNIMPLEMENTED(FATAL) << "JVM_NanoTime is not implemented"; - return 0L; + UNREACHABLE(); } -JNIEXPORT void JVM_ArrayCopy(JNIEnv* /* env */, jclass /* unused */, jobject /* javaSrc */, +JNIEXPORT __attribute__((noreturn)) void JVM_ArrayCopy(JNIEnv* /* env */, jclass /* unused */, jobject /* javaSrc */, jint /* srcPos */, jobject /* javaDst */, jint /* dstPos */, jint /* length */) { UNIMPLEMENTED(FATAL) << "JVM_ArrayCopy is not implemented"; + UNREACHABLE(); } -JNIEXPORT jint JVM_FindSignal(const char* name ATTRIBUTE_UNUSED) { +JNIEXPORT __attribute__((noreturn)) jint JVM_FindSignal(const char* name ATTRIBUTE_UNUSED) { LOG(FATAL) << "JVM_FindSignal is not implemented"; - return 0; + UNREACHABLE(); } -JNIEXPORT void* JVM_RegisterSignal(jint signum ATTRIBUTE_UNUSED, void* handler ATTRIBUTE_UNUSED) { +JNIEXPORT __attribute__((noreturn)) void* JVM_RegisterSignal(jint signum ATTRIBUTE_UNUSED, void* handler ATTRIBUTE_UNUSED) { LOG(FATAL) << "JVM_RegisterSignal is not implemented"; - return nullptr; + UNREACHABLE(); } -JNIEXPORT jboolean JVM_RaiseSignal(jint signum ATTRIBUTE_UNUSED) { +JNIEXPORT __attribute__((noreturn)) jboolean JVM_RaiseSignal(jint signum ATTRIBUTE_UNUSED) { LOG(FATAL) << "JVM_RaiseSignal is not implemented"; - return JNI_FALSE; + UNREACHABLE(); } JNIEXPORT __attribute__((noreturn)) void JVM_Halt(jint code) { diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc index a96436e95a..7fb6a15220 100644 --- a/openjdkjvmti/events.cc +++ b/openjdkjvmti/events.cc @@ -960,7 +960,7 @@ static uint32_t GetInstrumentationEventsFor(ArtJvmtiEvent event) { return art::instrumentation::Instrumentation::kExceptionHandled; default: LOG(FATAL) << "Unknown event "; - return 0; + UNREACHABLE(); } } diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index fcf6bb25e3..7388c2e307 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -139,7 +139,7 @@ void CommonRuntimeTestImpl::SetUp() { PreRuntimeCreate(); if (!Runtime::Create(options, false)) { LOG(FATAL) << "Failed to create runtime"; - return; + UNREACHABLE(); } PostRuntimeCreate(); runtime_.reset(Runtime::Current()); diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc index 0dc07231b6..62788b14ea 100644 --- a/runtime/common_throws.cc +++ b/runtime/common_throws.cc @@ -717,7 +717,7 @@ void ThrowNullPointerExceptionFromDexPC(bool check_address, uintptr_t addr) { << instr.DumpString(dex_file) << " in " << method->PrettyMethod(); - break; + UNREACHABLE(); } } } diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 4af97f0f35..80140b3aa1 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -1228,7 +1228,7 @@ size_t Dbg::GetTagWidth(JDWP::JdwpTag tag) { return 8; default: LOG(FATAL) << "Unknown tag " << tag; - return -1; + UNREACHABLE(); } } @@ -2266,7 +2266,7 @@ JDWP::JdwpThreadStatus Dbg::ToJdwpThreadStatus(ThreadState state) { // Don't add a 'default' here so the compiler can spot incompatible enum changes. } LOG(FATAL) << "Unknown thread state: " << state; - return JDWP::TS_ZOMBIE; + UNREACHABLE(); } JDWP::JdwpError Dbg::GetThreadStatus(JDWP::ObjectId thread_id, JDWP::JdwpThreadStatus* pThreadStatus, @@ -3155,7 +3155,7 @@ void Dbg::ProcessDeoptimizationRequest(const DeoptimizationRequest& request) { break; default: LOG(FATAL) << "Unsupported deoptimization request kind " << request.GetKind(); - break; + UNREACHABLE(); } } @@ -3233,7 +3233,7 @@ void Dbg::RequestDeoptimizationLocked(const DeoptimizationRequest& req) { } default: { LOG(FATAL) << "Unknown deoptimization request kind " << req.GetKind(); - break; + UNREACHABLE(); } } } diff --git a/runtime/dex/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc index 6434828298..9127a27bc8 100644 --- a/runtime/dex/dex_file_annotations.cc +++ b/runtime/dex/dex_file_annotations.cc @@ -240,7 +240,7 @@ bool SkipAnnotationValue(const DexFile& dex_file, const uint8_t** annotation_ptr break; default: LOG(FATAL) << StringPrintf("Bad annotation element value byte 0x%02x", value_type); - return false; + UNREACHABLE(); } annotation += width; diff --git a/runtime/entrypoints/quick/quick_jni_entrypoints.cc b/runtime/entrypoints/quick/quick_jni_entrypoints.cc index 3c41a8c3b5..5c86bbb39e 100644 --- a/runtime/entrypoints/quick/quick_jni_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_jni_entrypoints.cc @@ -252,7 +252,7 @@ extern uint64_t GenericJniMethodEnd(Thread* self, return 0; default: LOG(FATAL) << "Unexpected return shorty character " << return_shorty_char; - return 0; + UNREACHABLE(); } } } diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index 8737f3fc28..6deb509427 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -297,7 +297,7 @@ class QuickArgumentVisitor { case 4: return (6 * GetBytesPerGprSpillLocation(kRuntimeISA)); default: LOG(FATAL) << "Unexpected GPR index: " << gpr_index; - return 0; + UNREACHABLE(); } } #else diff --git a/runtime/gc/allocator/rosalloc.cc b/runtime/gc/allocator/rosalloc.cc index b90a95d802..d4b9fabd0f 100644 --- a/runtime/gc/allocator/rosalloc.cc +++ b/runtime/gc/allocator/rosalloc.cc @@ -286,7 +286,7 @@ void* RosAlloc::AllocPages(Thread* self, size_t num_pages, uint8_t page_map_type break; default: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(page_map_type); - break; + UNREACHABLE(); } if (kIsDebugBuild) { // Clear the first page since it is not madvised due to the magic number. @@ -325,7 +325,7 @@ size_t RosAlloc::FreePages(Thread* self, void* ptr, bool already_zero) { LOG(FATAL) << "Unreachable - " << __PRETTY_FUNCTION__ << " : " << "pm_idx=" << pm_idx << ", pm_type=" << static_cast<int>(pm_type) << ", ptr=" << std::hex << reinterpret_cast<intptr_t>(ptr); - return 0; + UNREACHABLE(); } // Update the page map and count the number of pages. size_t num_pages = 1; @@ -514,7 +514,7 @@ size_t RosAlloc::FreeInternal(Thread* self, void* ptr) { return FreePages(self, ptr, false); case kPageMapLargeObjectPart: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(page_map_[pm_idx]); - return 0; + UNREACHABLE(); case kPageMapRunPart: { // Find the beginning of the run. do { @@ -529,11 +529,11 @@ size_t RosAlloc::FreeInternal(Thread* self, void* ptr) { case kPageMapReleased: case kPageMapEmpty: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(page_map_[pm_idx]); - return 0; + UNREACHABLE(); } default: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(page_map_[pm_idx]); - return 0; + UNREACHABLE(); } } DCHECK(run != nullptr); @@ -1307,7 +1307,7 @@ size_t RosAlloc::UsableSize(const void* ptr) { case kPageMapEmpty: LOG(FATAL) << "Unreachable - " << __PRETTY_FUNCTION__ << ": pm_idx=" << pm_idx << ", ptr=" << std::hex << reinterpret_cast<intptr_t>(ptr); - break; + UNREACHABLE(); case kPageMapLargeObject: { size_t num_pages = 1; size_t idx = pm_idx + 1; @@ -1321,7 +1321,7 @@ size_t RosAlloc::UsableSize(const void* ptr) { case kPageMapLargeObjectPart: LOG(FATAL) << "Unreachable - " << __PRETTY_FUNCTION__ << ": pm_idx=" << pm_idx << ", ptr=" << std::hex << reinterpret_cast<intptr_t>(ptr); - break; + UNREACHABLE(); case kPageMapRun: case kPageMapRunPart: { // Find the beginning of the run. @@ -1340,10 +1340,9 @@ size_t RosAlloc::UsableSize(const void* ptr) { } default: { LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(page_map_[pm_idx]); - break; + UNREACHABLE(); } } - return 0; } bool RosAlloc::Trim() { @@ -1456,7 +1455,7 @@ void RosAlloc::InspectAll(void (*handler)(void* start, void* end, size_t used_by } case kPageMapLargeObjectPart: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm); - break; + UNREACHABLE(); case kPageMapRun: { // The start of a run. Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize); @@ -1476,10 +1475,10 @@ void RosAlloc::InspectAll(void (*handler)(void* start, void* end, size_t used_by } case kPageMapRunPart: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm); - break; + UNREACHABLE(); default: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm); - break; + UNREACHABLE(); } } } @@ -1809,7 +1808,7 @@ void RosAlloc::Verify() { } case kPageMapLargeObjectPart: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm) << std::endl << DumpPageMap(); - break; + UNREACHABLE(); case kPageMapRun: { // The start of a run. Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize); @@ -1837,7 +1836,7 @@ void RosAlloc::Verify() { // Fall-through. default: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm) << std::endl << DumpPageMap(); - break; + UNREACHABLE(); } } } @@ -2030,7 +2029,7 @@ size_t RosAlloc::ReleasePages() { break; // Skip. default: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm); - break; + UNREACHABLE(); } } return reclaimed_bytes; @@ -2138,7 +2137,7 @@ void RosAlloc::DumpStats(std::ostream& os) { case kPageMapLargeObjectPart: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm) << std::endl << DumpPageMap(); - break; + UNREACHABLE(); case kPageMapRun: { Run* run = reinterpret_cast<Run*>(base_ + i * kPageSize); size_t idx = run->size_bracket_idx_; @@ -2157,7 +2156,7 @@ void RosAlloc::DumpStats(std::ostream& os) { default: LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm) << std::endl << DumpPageMap(); - break; + UNREACHABLE(); } } os << "RosAlloc stats:\n"; diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index 4359bea421..f767360066 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -2169,7 +2169,7 @@ void Heap::TransitionCollector(CollectorType collector_type) { default: { LOG(FATAL) << "Attempted to transition to invalid collector type " << static_cast<size_t>(collector_type); - break; + UNREACHABLE(); } } ChangeCollector(collector_type); diff --git a/runtime/gc/space/space.cc b/runtime/gc/space/space.cc index a8bd7b816e..e7961eb256 100644 --- a/runtime/gc/space/space.cc +++ b/runtime/gc/space/space.cc @@ -63,7 +63,7 @@ BumpPointerSpace* Space::AsBumpPointerSpace() { RegionSpace* Space::AsRegionSpace() { LOG(FATAL) << "Unreachable"; - return nullptr; + UNREACHABLE(); } AllocSpace* Space::AsAllocSpace() { diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index 832bacbb3d..3abe4c529a 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -1051,7 +1051,7 @@ void Hprof::MarkRootObject(const mirror::Object* obj, jobject jni_obj, HprofHeap case HPROF_ROOT_REFERENCE_CLEANUP: case HPROF_UNREACHABLE: LOG(FATAL) << "obsolete tag " << static_cast<int>(heap_tag); - break; + UNREACHABLE(); } ++objects_in_segment_; diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index fe6154792c..e52a1c90d3 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -1876,7 +1876,7 @@ void RecordArrayElementsInTransaction(ObjPtr<mirror::Array> array, int32_t count default: LOG(FATAL) << "Unsupported primitive type " << primitive_component_type << " in fill-array-data"; - break; + UNREACHABLE(); } } diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc index 0353ea7462..7ce70cb3d4 100644 --- a/runtime/jdwp/jdwp_event.cc +++ b/runtime/jdwp/jdwp_event.cc @@ -554,7 +554,7 @@ static bool ModsMatch(JdwpEvent* pEvent, const ModBasket& basket) break; default: LOG(FATAL) << "unknown mod kind " << pMod->modKind; - break; + UNREACHABLE(); } } return true; diff --git a/runtime/jdwp/jdwp_request.cc b/runtime/jdwp/jdwp_request.cc index 6af267e674..a77962e2fa 100644 --- a/runtime/jdwp/jdwp_request.cc +++ b/runtime/jdwp/jdwp_request.cc @@ -70,7 +70,7 @@ uint64_t Request::ReadValue(size_t width) { case 2: value = Read2BE(); break; case 4: value = Read4BE(); break; case 8: value = Read8BE(); break; - default: LOG(FATAL) << width; break; + default: LOG(FATAL) << width; } return value; } diff --git a/runtime/jni/check_jni.cc b/runtime/jni/check_jni.cc index 48f99815fd..727929930b 100644 --- a/runtime/jni/check_jni.cc +++ b/runtime/jni/check_jni.cc @@ -880,7 +880,7 @@ class ScopedCheck { break; case kDirectByteBuffer: UNIMPLEMENTED(FATAL); - break; + UNREACHABLE(); case kString: okay = obj->GetClass()->IsStringClass(); break; @@ -2945,7 +2945,7 @@ class CheckJNI { break; case Primitive::kPrimVoid: LOG(FATAL) << "Unexpected type: " << type; - break; + UNREACHABLE(); } if (sc.Check(soa, false, result_check, &result)) { return result; @@ -3031,7 +3031,7 @@ class CheckJNI { break; case Primitive::kPrimVoid: LOG(FATAL) << "Unexpected type: " << type; - break; + UNREACHABLE(); } JniValueType result; result.V = nullptr; diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc index 9b38576fc5..f6adc800e4 100644 --- a/runtime/mirror/object.cc +++ b/runtime/mirror/object.cc @@ -225,11 +225,10 @@ int32_t Object::IdentityHashCode() { } default: { LOG(FATAL) << "Invalid state during hashcode " << lw.GetState(); - break; + UNREACHABLE(); } } } - UNREACHABLE(); } void Object::CheckFieldAssignmentImpl(MemberOffset field_offset, ObjPtr<Object> new_value) { diff --git a/runtime/monitor.cc b/runtime/monitor.cc index 647928391b..7240357979 100644 --- a/runtime/monitor.cc +++ b/runtime/monitor.cc @@ -168,11 +168,11 @@ bool Monitor::Install(Thread* self) { } case LockWord::kUnlocked: { LOG(FATAL) << "Inflating unlocked lock word"; - break; + UNREACHABLE(); } default: { LOG(FATAL) << "Invalid monitor state " << lw.GetState(); - return false; + UNREACHABLE(); } } LockWord fat(this, lw.GCState()); @@ -1236,7 +1236,7 @@ bool Monitor::MonitorExit(Thread* self, mirror::Object* obj) { } default: { LOG(FATAL) << "Invalid monitor state " << lock_word.GetState(); - return false; + UNREACHABLE(); } } } @@ -1280,7 +1280,7 @@ void Monitor::Wait(Thread* self, mirror::Object *obj, int64_t ms, int32_t ns, case LockWord::kFatLocked: // Unreachable given the loop condition above. Fall-through. default: { LOG(FATAL) << "Invalid monitor state " << lock_word.GetState(); - return; + UNREACHABLE(); } } } @@ -1320,7 +1320,7 @@ void Monitor::DoNotify(Thread* self, mirror::Object* obj, bool notify_all) { } default: { LOG(FATAL) << "Invalid monitor state " << lock_word.GetState(); - return; + UNREACHABLE(); } } } diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index c1ccd33774..5c5523d9c8 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -1920,7 +1920,7 @@ OatFile::OatClass::OatClass(const OatFile* oat_file, } case kOatClassMax: { LOG(FATAL) << "Invalid OatClassType " << type_; - break; + UNREACHABLE(); } } } diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 9cbbd4172d..ab79b9e1a0 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -1241,7 +1241,6 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) { } case JdwpProvider::kUnset: { LOG(FATAL) << "Illegal jdwp provider " << jdwp_provider_ << " was not filtered out!"; - break; } } callbacks_->AddThreadLifecycleCallback(Dbg::GetThreadLifecycleCallback()); @@ -1856,7 +1855,7 @@ int32_t Runtime::GetStat(int kind) { return 0; // backward compatibility default: LOG(FATAL) << "Unknown statistic " << kind; - return -1; // unreachable + UNREACHABLE(); } } diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index 23e57a2f21..4bbd81a70d 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -1561,7 +1561,7 @@ uint32_t ThreadList::AllocThreadId(Thread* self) { } } LOG(FATAL) << "Out of internal thread ids"; - return 0; + UNREACHABLE(); } void ThreadList::ReleaseThreadId(Thread* self, uint32_t id) { diff --git a/runtime/transaction.cc b/runtime/transaction.cc index e4bf447a6f..62482fd898 100644 --- a/runtime/transaction.cc +++ b/runtime/transaction.cc @@ -531,7 +531,7 @@ void Transaction::ObjectLog::UndoFieldWrite(mirror::Object* obj, break; default: LOG(FATAL) << "Unknown value kind " << static_cast<int>(field_value.kind); - break; + UNREACHABLE(); } } @@ -558,7 +558,7 @@ void Transaction::InternStringLog::Undo(InternTable* intern_table) const { break; default: LOG(FATAL) << "Unknown interned string kind"; - break; + UNREACHABLE(); } break; } @@ -572,13 +572,13 @@ void Transaction::InternStringLog::Undo(InternTable* intern_table) const { break; default: LOG(FATAL) << "Unknown interned string kind"; - break; + UNREACHABLE(); } break; } default: LOG(FATAL) << "Unknown interned string op"; - break; + UNREACHABLE(); } } @@ -669,9 +669,10 @@ void Transaction::ArrayLog::UndoArrayWrite(mirror::Array* array, break; case Primitive::kPrimNot: LOG(FATAL) << "ObjectArray should be treated as Object"; - break; + UNREACHABLE(); default: LOG(FATAL) << "Unsupported type " << array_type; + UNREACHABLE(); } } diff --git a/runtime/well_known_classes.cc b/runtime/well_known_classes.cc index 5300e2d389..cde885c288 100644 --- a/runtime/well_known_classes.cc +++ b/runtime/well_known_classes.cc @@ -276,7 +276,7 @@ ArtMethod* WellKnownClasses::StringInitToStringFactory(ArtMethod* string_init) { STRING_INIT_LIST(TO_STRING_FACTORY) #undef TO_STRING_FACTORY LOG(FATAL) << "Could not find StringFactory method for String.<init>"; - return nullptr; + UNREACHABLE(); } uint32_t WellKnownClasses::StringInitToEntryPoint(ArtMethod* string_init) { @@ -288,7 +288,7 @@ uint32_t WellKnownClasses::StringInitToEntryPoint(ArtMethod* string_init) { STRING_INIT_LIST(TO_ENTRY_POINT) #undef TO_ENTRY_POINT LOG(FATAL) << "Could not find StringFactory method for String.<init>"; - return 0; + UNREACHABLE(); } #undef STRING_INIT_LIST diff --git a/test/ti-agent/common_helper.cc b/test/ti-agent/common_helper.cc index f5e1e1bc07..3be48a3b80 100644 --- a/test/ti-agent/common_helper.cc +++ b/test/ti-agent/common_helper.cc @@ -24,6 +24,7 @@ #include "jvmti.h" #include "jvmti_helper.h" +#include "ti_macros.h" namespace art { @@ -87,7 +88,7 @@ jobject GetJavaValueByType(JNIEnv* env, char type, jvalue value) { break; default: LOG(FATAL) << "Unable to figure out type!"; - return nullptr; + UNREACHABLE(); } std::ostringstream oss; oss << "(" << type << ")L" << name << ";"; diff --git a/tools/timeout_dumper/timeout_dumper.cc b/tools/timeout_dumper/timeout_dumper.cc index 30e194ceda..96d165c5c7 100644 --- a/tools/timeout_dumper/timeout_dumper.cc +++ b/tools/timeout_dumper/timeout_dumper.cc @@ -432,7 +432,7 @@ void DumpThread(pid_t pid, LOG(ERROR) << prefix << "(failed to create Backtrace for thread " << tid << ")"; return; } - backtrace->SetSkipFrames(0); + backtrace->SetSkipFrames(false); if (!backtrace->Unwind(0, nullptr)) { LOG(ERROR) << prefix << "(backtrace::Unwind failed for thread " << tid << ": " << backtrace->GetErrorString(backtrace->GetError()) << ")"; diff --git a/tools/titrace/instruction_decoder.cc b/tools/titrace/instruction_decoder.cc index 89904b32cd..6f497b3c04 100644 --- a/tools/titrace/instruction_decoder.cc +++ b/tools/titrace/instruction_decoder.cc @@ -456,9 +456,10 @@ class ClassInstructionDecoder : public InstructionDecoder { case kBreakpoint: return "breakpoint"; case kImpdep1: return "impdep1"; case kImpdep2: return "impdep2"; - default: LOG(FATAL) << "Unknown opcode " << op; + default: + LOG(FATAL) << "Unknown opcode " << op; + __builtin_unreachable(); } - return ""; } }; }; @@ -500,7 +501,7 @@ DEX_INSTRUCTION_LIST(MAKE_ENUM_DEFINITION) #undef MAKE_ENUM_DEFINITION default: LOG(FATAL) << "Unknown opcode " << op; } - return ""; + __builtin_unreachable(); } }; }; |