Add a compile-time constant bool equivalent to !defined(NDEBUG).
This makes some code slightly less awkward.
Change-Id: Iafd359dd0baa65510ed9510a7d93ee01605f51e4
diff --git a/src/mutex.cc b/src/mutex.cc
index b3cf946..5a9df17 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -27,8 +27,10 @@
namespace art {
-#if !defined(NDBEUG)
static inline void CheckSafeToLockOrUnlock(MutexRank rank, bool is_locking) {
+ if (!kIsDebugBuild) {
+ return;
+ }
if (rank == -1) {
return;
}
@@ -37,20 +39,16 @@
self->CheckSafeToLockOrUnlock(rank, is_locking);
}
}
-#else
-static inline void CheckSafeToLockOrUnlock(MutexRank, bool) {}
-#endif
-#if !defined(NDEBUG)
static inline void CheckSafeToWait(MutexRank rank) {
+ if (!kIsDebugBuild) {
+ return;
+ }
Thread* self = Thread::Current();
if (self != NULL) {
self->CheckSafeToWait(rank);
}
}
-#else
-static inline void CheckSafeToWait(MutexRank) {}
-#endif
Mutex::Mutex(const char* name, MutexRank rank) : name_(name), rank_(rank) {
// Like Java, we use recursive mutexes.