diff --git a/Makefile b/Makefile index f0f94026a..4307773dc 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,9 @@ ifeq ($(MAKECMDGOALS),shared_lib) PLATFORM_SHARED_LDFLAGS=-fPIC OPT += -DNDEBUG endif + ifeq ($(MAKECMDGOALS),static_lib) +PLATFORM_SHARED_LDFLAGS=-fPIC OPT += -DNDEBUG endif diff --git a/util/sync_point.cc b/util/sync_point.cc index 5d0ac2dd6..4e4c46a1f 100644 --- a/util/sync_point.cc +++ b/util/sync_point.cc @@ -5,6 +5,7 @@ #include "util/sync_point.h" +#ifndef NDEBUG namespace rocksdb { SyncPoint* SyncPoint::GetInstance() { @@ -60,3 +61,4 @@ void SyncPoint::Process(const std::string& point) { } } // namespace rocksdb +#endif // NDEBUG diff --git a/util/sync_point.h b/util/sync_point.h index 3cc892370..3e880213e 100644 --- a/util/sync_point.h +++ b/util/sync_point.h @@ -13,6 +13,10 @@ namespace rocksdb { +#ifdef NDEBUG +#define TEST_SYNC_POINT(x) +#else + // This class provides facility to reproduce race conditions deterministically // in unit tests. // Developer could specify sync points in the codebase via TEST_SYNC_POINT. @@ -72,8 +76,5 @@ class SyncPoint { // utilized to re-produce race conditions between threads. // See TransactionLogIteratorRace in db_test.cc for an example use case. // TEST_SYNC_POINT is no op in release build. -#ifdef NDEBUG -#define TEST_SYNC_POINT(x) -#else #define TEST_SYNC_POINT(x) rocksdb::SyncPoint::GetInstance()->Process(x) -#endif +#endif // NDEBUG