ART: Fix or disable some tidy warnings.
Add a strlcpy shim for the host, so we can use strlcpy instead of
strcpy everywhere.
Fixed warnings include unused-decls, (some) unreachable code, use
after std::move, string char append, leaks, (some) excessive padding.
Disable some warnings we cannot or do not want to avoid.
Bug: 32619234
Test: m
Test: m test-art-host
Change-Id: Ie191985eebb160d94b988b41735d4f0a1fa1b54e
diff --git a/compiler/dex/verification_results.cc b/compiler/dex/verification_results.cc
index b87cb61..04ceca0 100644
--- a/compiler/dex/verification_results.cc
+++ b/compiler/dex/verification_results.cc
@@ -110,12 +110,12 @@
// This method should only be called for classes verified at compile time,
// which have no verifier error, nor has methods that we know will throw
// at runtime.
- atomic_verified_methods_.Insert(
- ref,
- /*expected*/ nullptr,
- new VerifiedMethod(/* encountered_error_types */ 0, /* has_runtime_throw */ false));
- // We don't check the result of `Insert` as we could insert twice for the same
- // MethodReference in the presence of duplicate methods.
+ std::unique_ptr<VerifiedMethod> verified_method = std::make_unique<VerifiedMethod>(
+ /* encountered_error_types */ 0, /* has_runtime_throw */ false);
+ if (atomic_verified_methods_.Insert(ref, /*expected*/ nullptr, verified_method.get()) ==
+ AtomicMap::InsertResult::kInsertResultSuccess) {
+ verified_method.release();
+ }
}
void VerificationResults::AddRejectedClass(ClassReference ref) {
diff --git a/compiler/optimizing/induction_var_analysis.cc b/compiler/optimizing/induction_var_analysis.cc
index 88473f02..84b20f6 100644
--- a/compiler/optimizing/induction_var_analysis.cc
+++ b/compiler/optimizing/induction_var_analysis.cc
@@ -695,8 +695,8 @@
/*fetch*/ nullptr,
type_);
default:
- CHECK(false) << op;
- break;
+ LOG(FATAL) << op;
+ UNREACHABLE();
}
}
}
diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc
index c3aa976..68ee272 100644
--- a/compiler/optimizing/loop_optimization.cc
+++ b/compiler/optimizing/loop_optimization.cc
@@ -499,6 +499,7 @@
body = it.Current();
}
}
+ CHECK(body != nullptr);
// Ensure there is only a single exit point.
if (header->GetSuccessors().size() != 2) {
return;