From 62551b1c4ed617d9ceaac845832b1e51026f86d1 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Thu, 17 Apr 2014 10:49:58 -0700 Subject: [PATCH] Don't compile sync_point if NDEBUG Summary: We don't really need sync_point.o if we're compiling with NDEBUG. This diff depends on D17823 Test Plan: compiles Reviewers: haobo, ljin, sdong Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D17829 --- Makefile | 2 ++ util/sync_point.cc | 2 ++ util/sync_point.h | 9 +++++---- 3 files changed, 9 insertions(+), 4 deletions(-) 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