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
This commit is contained in:
Igor Canadi 2014-04-17 10:49:58 -07:00
parent 5cef458a2c
commit 62551b1c4e
3 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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