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
main
Igor Canadi 11 years ago
parent 5cef458a2c
commit 62551b1c4e
  1. 2
      Makefile
  2. 2
      util/sync_point.cc
  3. 9
      util/sync_point.h

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

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

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

Loading…
Cancel
Save