diff options
author | Ian Rogers <irogers@google.com> | 2014-09-30 23:10:02 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-09-30 23:10:03 +0000 |
commit | 8283e079a209e81caafd123a12a525922368fd34 (patch) | |
tree | 4f344df6ec2612d8ddbf0a00e2b49a39a7501249 /runtime | |
parent | f9098ea6d7326b4d8de2860d18adf74046b80855 (diff) | |
parent | 07140838a3ee44a6056cacdc78f2930e019107da (diff) | |
download | art-8283e079a209e81caafd123a12a525922368fd34.zip art-8283e079a209e81caafd123a12a525922368fd34.tar.gz art-8283e079a209e81caafd123a12a525922368fd34.tar.bz2 |
Merge "Enable -Wunreachable-code"
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/base/macros.h | 1 | ||||
-rw-r--r-- | runtime/class_linker.cc | 6 | ||||
-rw-r--r-- | runtime/mirror/object.cc | 3 | ||||
-rw-r--r-- | runtime/parsed_options.cc | 2 | ||||
-rw-r--r-- | runtime/quick_exception_handler.cc | 8 |
5 files changed, 9 insertions, 11 deletions
diff --git a/runtime/base/macros.h b/runtime/base/macros.h index fae9271..b66d528 100644 --- a/runtime/base/macros.h +++ b/runtime/base/macros.h @@ -179,6 +179,7 @@ char (&ArraySizeHelper(T (&array)[N]))[N]; #define WARN_UNUSED __attribute__((warn_unused_result)) template<typename T> void UNUSED(const T&) {} +#define UNREACHABLE __builtin_unreachable // Annotalysis thread-safety analysis support. #if defined(__SUPPORT_TS_ANNOTATION__) || defined(__clang__) diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index cc77c50..2cf3820 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2269,9 +2269,7 @@ mirror::Class* ClassLinker::FindClass(Thread* self, const char* descriptor, return soa.Decode<mirror::Class*>(result.get()); } } - - ThrowNoClassDefFoundError("Class %s not found", PrintableString(descriptor).c_str()); - return nullptr; + UNREACHABLE(); } mirror::Class* ClassLinker::DefineClass(Thread* self, const char* descriptor, @@ -4340,7 +4338,7 @@ bool ClassLinker::WaitForInitializeClass(Handle<mirror::Class> klass, Thread* se LOG(FATAL) << "Unexpected class status. " << PrettyClass(klass.Get()) << " is " << klass->GetStatus(); } - LOG(FATAL) << "Not Reached" << PrettyClass(klass.Get()); + UNREACHABLE(); } bool ClassLinker::ValidateSuperClassDescriptors(Handle<mirror::Class> klass) { diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc index a1177d6..57069ab 100644 --- a/runtime/mirror/object.cc +++ b/runtime/mirror/object.cc @@ -187,8 +187,7 @@ int32_t Object::IdentityHashCode() const { } } } - LOG(FATAL) << "Unreachable"; - return 0; + UNREACHABLE(); } void Object::CheckFieldAssignmentImpl(MemberOffset field_offset, Object* new_value) { diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index 2bd994d..d820026 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -932,7 +932,7 @@ bool ParsedOptions::ParseDouble(const std::string& option, char after_char, } bool sane_val = true; double value; - if (false) { + if ((false)) { // TODO: this doesn't seem to work on the emulator. b/15114595 std::stringstream iss(substring); iss >> value; diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc index 43d21de..2c158ba 100644 --- a/runtime/quick_exception_handler.cc +++ b/runtime/quick_exception_handler.cc @@ -230,7 +230,7 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { reinterpret_cast<mirror::Object*>(GetVReg(m, reg, kind))); break; case kLongLoVReg: - if (GetVRegKind(reg + 1, kinds), kLongHiVReg) { + if (GetVRegKind(reg + 1, kinds) == kLongHiVReg) { // Treat it as a "long" register pair. new_frame->SetVRegLong(reg, GetVRegPair(m, reg, kLongLoVReg, kLongHiVReg)); } else { @@ -238,14 +238,14 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { } break; case kLongHiVReg: - if (GetVRegKind(reg - 1, kinds), kLongLoVReg) { + if (GetVRegKind(reg - 1, kinds) == kLongLoVReg) { // Nothing to do: we treated it as a "long" register pair. } else { new_frame->SetVReg(reg, GetVReg(m, reg, kind)); } break; case kDoubleLoVReg: - if (GetVRegKind(reg + 1, kinds), kDoubleHiVReg) { + if (GetVRegKind(reg + 1, kinds) == kDoubleHiVReg) { // Treat it as a "double" register pair. new_frame->SetVRegLong(reg, GetVRegPair(m, reg, kDoubleLoVReg, kDoubleHiVReg)); } else { @@ -253,7 +253,7 @@ class DeoptimizeStackVisitor FINAL : public StackVisitor { } break; case kDoubleHiVReg: - if (GetVRegKind(reg - 1, kinds), kDoubleLoVReg) { + if (GetVRegKind(reg - 1, kinds) == kDoubleLoVReg) { // Nothing to do: we treated it as a "double" register pair. } else { new_frame->SetVReg(reg, GetVReg(m, reg, kind)); |