C++17 compatibility: make WITH_TIDY=1 happy again.
Bug: http://b/111067277
Test: builds
Change-Id: I8b69ea3815e14bb6eb27f40c0dd01a85b340a355
diff --git a/compiler/compiled_method.cc b/compiler/compiled_method.cc
index ef9d919..58f7e4f 100644
--- a/compiler/compiled_method.cc
+++ b/compiler/compiled_method.cc
@@ -73,7 +73,7 @@
}
default:
LOG(FATAL) << "Unknown InstructionSet: " << instruction_set;
- return 0;
+ UNREACHABLE();
}
}
@@ -94,7 +94,7 @@
}
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 54f193b..8b4bab7 100644
--- a/compiler/jni/quick/arm/calling_convention_arm.cc
+++ b/compiler/jni/quick/arm/calling_convention_arm.cc
@@ -173,7 +173,7 @@
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 328ecbb..4e6221e 100644
--- a/compiler/jni/quick/arm64/calling_convention_arm64.cc
+++ b/compiler/jni/quick/arm64/calling_convention_arm64.cc
@@ -181,7 +181,7 @@
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 5ec1add..d3d489e 100644
--- a/compiler/jni/quick/mips/calling_convention_mips.cc
+++ b/compiler/jni/quick/mips/calling_convention_mips.cc
@@ -124,7 +124,7 @@
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 a7012ae..3c7cee6 100644
--- a/compiler/jni/quick/mips64/calling_convention_mips64.cc
+++ b/compiler/jni/quick/mips64/calling_convention_mips64.cc
@@ -109,7 +109,7 @@
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 ad58e38..71e6019 100644
--- a/compiler/jni/quick/x86/calling_convention_x86.cc
+++ b/compiler/jni/quick/x86/calling_convention_x86.cc
@@ -257,7 +257,7 @@
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 c2e83cd..2184f99 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -1662,7 +1662,7 @@
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 48b50ea..bbf167d 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -3046,7 +3046,7 @@
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 d5b734d..dad1813 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -1037,26 +1037,26 @@
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 @@
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 c6d0f3f..c536dd3 100644
--- a/compiler/optimizing/code_generator_mips.cc
+++ b/compiler/optimizing/code_generator_mips.cc
@@ -147,7 +147,7 @@
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 039b3ca..016aac7 100644
--- a/compiler/optimizing/code_generator_mips64.cc
+++ b/compiler/optimizing/code_generator_mips64.cc
@@ -3642,7 +3642,7 @@
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 fba4da6..1b74d22 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -1228,7 +1228,7 @@
case DataType::Type::kUint64:
case DataType::Type::kVoid:
LOG(FATAL) << "Unexpected parameter type " << type;
- break;
+ UNREACHABLE();
}
return Location::NoLocation();
}
@@ -2989,7 +2989,7 @@
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 e7212cd..781f272 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -2425,7 +2425,7 @@
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 a4d638f..3a10d58 100644
--- a/compiler/optimizing/induction_var_analysis.cc
+++ b/compiler/optimizing/induction_var_analysis.cc
@@ -1074,8 +1074,8 @@
&& 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 @@
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 2b6ae20..4c6d6ba 100644
--- a/compiler/optimizing/instruction_simplifier.cc
+++ b/compiler/optimizing/instruction_simplifier.cc
@@ -749,8 +749,8 @@
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 3f225f3..d1fba31 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -1231,7 +1231,7 @@
}
}
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 @@
} 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 75b3555..20606fc 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -895,7 +895,7 @@
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 aee690e..0662334 100644
--- a/disassembler/disassembler.cc
+++ b/disassembler/disassembler.cc
@@ -75,7 +75,7 @@
#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 1d106b2..f8d6016 100644
--- a/libartbase/base/file_utils.cc
+++ b/libartbase/base/file_utils.cc
@@ -157,7 +157,7 @@
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 8378211..83663c5 100644
--- a/libdexfile/dex/dex_instruction.cc
+++ b/libdexfile/dex/dex_instruction.cc
@@ -85,7 +85,7 @@
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 8d0200c..7a388c9 100644
--- a/openjdkjvm/OpenjdkJvm.cc
+++ b/openjdkjvm/OpenjdkJvm.cc
@@ -434,36 +434,37 @@
}
}
-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 a96436e..7fb6a15 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -960,7 +960,7 @@
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 fcf6bb2..7388c2e 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -139,7 +139,7 @@
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 0dc0723..62788b1 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -717,7 +717,7 @@
<< instr.DumpString(dex_file)
<< " in "
<< method->PrettyMethod();
- break;
+ UNREACHABLE();
}
}
}
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 4af97f0..80140b3 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -1228,7 +1228,7 @@
return 8;
default:
LOG(FATAL) << "Unknown tag " << tag;
- return -1;
+ UNREACHABLE();
}
}
@@ -2266,7 +2266,7 @@
// 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 @@
break;
default:
LOG(FATAL) << "Unsupported deoptimization request kind " << request.GetKind();
- break;
+ UNREACHABLE();
}
}
@@ -3233,7 +3233,7 @@
}
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 6434828..9127a27 100644
--- a/runtime/dex/dex_file_annotations.cc
+++ b/runtime/dex/dex_file_annotations.cc
@@ -240,7 +240,7 @@
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 3c41a8c..5c86bbb 100644
--- a/runtime/entrypoints/quick/quick_jni_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_jni_entrypoints.cc
@@ -252,7 +252,7 @@
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 8737f3f..6deb509 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -297,7 +297,7 @@
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 b90a95d..d4b9fab 100644
--- a/runtime/gc/allocator/rosalloc.cc
+++ b/runtime/gc/allocator/rosalloc.cc
@@ -286,7 +286,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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 @@
// Fall-through.
default:
LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm) << std::endl << DumpPageMap();
- break;
+ UNREACHABLE();
}
}
}
@@ -2030,7 +2029,7 @@
break; // Skip.
default:
LOG(FATAL) << "Unreachable - page map type: " << static_cast<int>(pm);
- break;
+ UNREACHABLE();
}
}
return reclaimed_bytes;
@@ -2138,7 +2137,7 @@
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 @@
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 4359bea..f767360 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -2169,7 +2169,7 @@
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 a8bd7b8..e7961eb 100644
--- a/runtime/gc/space/space.cc
+++ b/runtime/gc/space/space.cc
@@ -63,7 +63,7 @@
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 832bacb..3abe4c5 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -1051,7 +1051,7 @@
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 fe61547..e52a1c9 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -1876,7 +1876,7 @@
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 0353ea7..7ce70cb 100644
--- a/runtime/jdwp/jdwp_event.cc
+++ b/runtime/jdwp/jdwp_event.cc
@@ -554,7 +554,7 @@
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 6af267e..a77962e 100644
--- a/runtime/jdwp/jdwp_request.cc
+++ b/runtime/jdwp/jdwp_request.cc
@@ -70,7 +70,7 @@
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 48f9981..7279299 100644
--- a/runtime/jni/check_jni.cc
+++ b/runtime/jni/check_jni.cc
@@ -880,7 +880,7 @@
break;
case kDirectByteBuffer:
UNIMPLEMENTED(FATAL);
- break;
+ UNREACHABLE();
case kString:
okay = obj->GetClass()->IsStringClass();
break;
@@ -2945,7 +2945,7 @@
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 @@
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 9b38576..f6adc80 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -225,11 +225,10 @@
}
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 6479283..7240357 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -168,11 +168,11 @@
}
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 @@
}
default: {
LOG(FATAL) << "Invalid monitor state " << lock_word.GetState();
- return false;
+ UNREACHABLE();
}
}
}
@@ -1280,7 +1280,7 @@
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 @@
}
default: {
LOG(FATAL) << "Invalid monitor state " << lock_word.GetState();
- return;
+ UNREACHABLE();
}
}
}
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index c1ccd33..5c5523d 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -1920,7 +1920,7 @@
}
case kOatClassMax: {
LOG(FATAL) << "Invalid OatClassType " << type_;
- break;
+ UNREACHABLE();
}
}
}
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 9cbbd41..ab79b9e 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1241,7 +1241,6 @@
}
case JdwpProvider::kUnset: {
LOG(FATAL) << "Illegal jdwp provider " << jdwp_provider_ << " was not filtered out!";
- break;
}
}
callbacks_->AddThreadLifecycleCallback(Dbg::GetThreadLifecycleCallback());
@@ -1856,7 +1855,7 @@
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 23e57a2..4bbd81a 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -1561,7 +1561,7 @@
}
}
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 e4bf447..62482fd 100644
--- a/runtime/transaction.cc
+++ b/runtime/transaction.cc
@@ -531,7 +531,7 @@
break;
default:
LOG(FATAL) << "Unknown value kind " << static_cast<int>(field_value.kind);
- break;
+ UNREACHABLE();
}
}
@@ -558,7 +558,7 @@
break;
default:
LOG(FATAL) << "Unknown interned string kind";
- break;
+ UNREACHABLE();
}
break;
}
@@ -572,13 +572,13 @@
break;
default:
LOG(FATAL) << "Unknown interned string kind";
- break;
+ UNREACHABLE();
}
break;
}
default:
LOG(FATAL) << "Unknown interned string op";
- break;
+ UNREACHABLE();
}
}
@@ -669,9 +669,10 @@
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 5300e2d..cde885c 100644
--- a/runtime/well_known_classes.cc
+++ b/runtime/well_known_classes.cc
@@ -276,7 +276,7 @@
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 @@
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 f5e1e1b..3be48a3 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 @@
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 30e194c..96d165c 100644
--- a/tools/timeout_dumper/timeout_dumper.cc
+++ b/tools/timeout_dumper/timeout_dumper.cc
@@ -432,7 +432,7 @@
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 89904b3..6f497b3 100644
--- a/tools/titrace/instruction_decoder.cc
+++ b/tools/titrace/instruction_decoder.cc
@@ -456,9 +456,10 @@
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 @@
#undef MAKE_ENUM_DEFINITION
default: LOG(FATAL) << "Unknown opcode " << op;
}
- return "";
+ __builtin_unreachable();
}
};
};