summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/Android.bp36
-rw-r--r--runtime/base/mutex-inl.h4
-rw-r--r--runtime/base/mutex.h5
-rw-r--r--runtime/thread.cc2
4 files changed, 25 insertions, 22 deletions
diff --git a/build/Android.bp b/build/Android.bp
index 3a1d5839f5..b7d2cbc070 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -17,6 +17,27 @@ bootstrap_go_package {
pluginFor: ["soong_build"],
}
+art_clang_tidy_errors = [
+ // Protect scoped things like MutexLock.
+ "bugprone-unused-raii",
+]
+// Should be: strings.Join(art_clang_tidy_errors, ",").
+art_clang_tidy_errors_str = "bugprone-unused-raii"
+
+art_clang_tidy_disabled = [
+ "-google-default-arguments",
+ // We have local stores that are only used for debug checks.
+ "-clang-analyzer-deadcode.DeadStores",
+ // We are OK with some static globals and that they can, in theory, throw.
+ "-cert-err58-cpp",
+ // We have lots of C-style variadic functions, and are OK with them. JNI ensures
+ // that working around this warning would be extra-painful.
+ "-cert-dcl50-cpp",
+ // No exceptions.
+ "-misc-noexcept-move-constructor",
+ "-performance-noexcept-move-constructor",
+]
+
art_global_defaults {
// Additional flags are computed by art.go
@@ -130,18 +151,7 @@ art_global_defaults {
"external/vixl/src",
],
- tidy_checks: [
- "-google-default-arguments",
- // We have local stores that are only used for debug checks.
- "-clang-analyzer-deadcode.DeadStores",
- // We are OK with some static globals and that they can, in theory, throw.
- "-cert-err58-cpp",
- // We have lots of C-style variadic functions, and are OK with them. JNI ensures
- // that working around this warning would be extra-painful.
- "-cert-dcl50-cpp",
- // No exceptions.
- "-misc-noexcept-move-constructor",
- ],
+ tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled,
tidy_flags: [
// The static analyzer treats DCHECK as always enabled; we sometimes get
@@ -151,6 +161,8 @@ art_global_defaults {
// void foo() { CHECK(kIsFooEnabled); /* do foo... */ }
// not being marked noreturn if kIsFooEnabled is false.
"-extra-arg=-Wno-missing-noreturn",
+ // Use art_clang_tidy_errors for build errors.
+ "-warnings-as-errors=" + art_clang_tidy_errors_str,
],
}
diff --git a/runtime/base/mutex-inl.h b/runtime/base/mutex-inl.h
index dfa14b91f0..51ca274cbb 100644
--- a/runtime/base/mutex-inl.h
+++ b/runtime/base/mutex-inl.h
@@ -290,10 +290,6 @@ inline ReaderMutexLock::~ReaderMutexLock() {
mu_.SharedUnlock(self_);
}
-// Catch bug where variable name is omitted. "ReaderMutexLock (lock);" instead of
-// "ReaderMutexLock mu(lock)".
-#define ReaderMutexLock(x) static_assert(0, "ReaderMutexLock declaration missing variable name")
-
} // namespace art
#endif // ART_RUNTIME_BASE_MUTEX_INL_H_
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index 602d183bbb..ee47e7ce56 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -525,8 +525,6 @@ class SCOPED_CAPABILITY MutexLock {
Mutex& mu_;
DISALLOW_COPY_AND_ASSIGN(MutexLock);
};
-// Catch bug where variable name is omitted. "MutexLock (lock);" instead of "MutexLock mu(lock)".
-#define MutexLock(x) static_assert(0, "MutexLock declaration missing variable name")
// Scoped locker/unlocker for a ReaderWriterMutex that acquires read access to mu upon
// construction and releases it upon destruction.
@@ -560,9 +558,6 @@ class SCOPED_CAPABILITY WriterMutexLock {
ReaderWriterMutex& mu_;
DISALLOW_COPY_AND_ASSIGN(WriterMutexLock);
};
-// Catch bug where variable name is omitted. "WriterMutexLock (lock);" instead of
-// "WriterMutexLock mu(lock)".
-#define WriterMutexLock(x) static_assert(0, "WriterMutexLock declaration missing variable name")
// For StartNoThreadSuspension and EndNoThreadSuspension.
class CAPABILITY("role") Role {
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 3c5569fe05..1a078d5fe6 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1579,7 +1579,7 @@ void Thread::FullSuspendCheck() {
VLOG(threads) << this << " self-suspending";
// Make thread appear suspended to other threads, release mutator_lock_.
// Transition to suspended and back to runnable, re-acquire share on mutator_lock_.
- ScopedThreadSuspension(this, kSuspended);
+ ScopedThreadSuspension(this, kSuspended); // NOLINT
VLOG(threads) << this << " self-reviving";
}