C++17 compatibility: make WITH_TIDY=1 happy again.
Bug: http://b/111067277
Test: builds
Change-Id: I8b69ea3815e14bb6eb27f40c0dd01a85b340a355
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