diff --git a/SConstruct b/SConstruct index 65987dd24f9..b3cbfe5ce3b 100644 --- a/SConstruct +++ b/SConstruct @@ -475,6 +475,8 @@ if "sunos5" == os.sys.platform: # http://four.pairlist.net/pipermail/scons-users/2013-June/001486.html env.Tool('gnulink') +if optBuild: + env.Append( CPPDEFINES=["MONGO_OPTIMIZED_BUILD"] ) if has_option("propagate-shell-environment"): env['ENV'] = dict(os.environ); diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp index fc6c49e98c6..773cbc25bea 100644 --- a/src/mongo/db/client.cpp +++ b/src/mongo/db/client.cpp @@ -81,7 +81,7 @@ namespace mongo { TSP_DEFINE(Client, currentClient) -#if defined(_DEBUG) && !XSAN_ENABLED +#if defined(_DEBUG) && !defined(MONGO_OPTIMIZED_BUILD) && !XSAN_ENABLED struct StackChecker; ThreadLocalValue checker; @@ -134,7 +134,7 @@ namespace mongo { call this when your thread starts. */ Client& Client::initThread(const char *desc, AbstractMessagingPort *mp) { -#if defined(_DEBUG) && !XSAN_ENABLED +#if defined(_DEBUG) && !defined(MONGO_OPTIMIZED_BUILD) && !XSAN_ENABLED { if( sizeof(void*) == 8 ) { StackChecker sc; @@ -230,7 +230,7 @@ namespace mongo { } bool Client::shutdown() { -#if defined(_DEBUG) && !XSAN_ENABLED +#if defined(_DEBUG) && !defined(MONGO_OPTIMIZED_BUILD) && !XSAN_ENABLED { if( sizeof(void*) == 8 ) { StackChecker::check( desc() ); diff --git a/src/mongo/dbtests/stacktests.cpp b/src/mongo/dbtests/stacktests.cpp index 5e325d436e6..0c922af64c0 100644 --- a/src/mongo/dbtests/stacktests.cpp +++ b/src/mongo/dbtests/stacktests.cpp @@ -104,7 +104,9 @@ namespace StackTests { void setupTests() { if ( inConstructorChainSupported() ) { +#if defined(_DEBUG) && !defined(MONGO_OPTIMIZED_BUILD) DEV add< InCons >(); +#endif } } diff --git a/src/mongo/util/stack_introspect.cpp b/src/mongo/util/stack_introspect.cpp index f79d42e4f62..7d6c45e34b3 100644 --- a/src/mongo/util/stack_introspect.cpp +++ b/src/mongo/util/stack_introspect.cpp @@ -30,7 +30,7 @@ #include "mongo/util/stack_introspect.h" -#if !defined(_WIN32) +#if !defined(_WIN32) && !defined(MONGO_OPTIMIZED_BUILD) #include #include @@ -205,4 +205,4 @@ namespace mongo { bool inConstructorChainSupported() { return false; } } -#endif // #if !defined(_WIN32) +#endif // #if !defined(_WIN32) && !defined(MONGO_OPTIMIZED_BUILD)