summaryrefslogtreecommitdiff
path: root/src/mongo/db/client.cpp
diff options
context:
space:
mode:
authorAndrew Morrow <acm@10gen.com>2013-08-14 11:11:58 -0400
committerAndrew Morrow <acm@10gen.com>2013-08-15 10:13:10 -0400
commitc841975ca8752c27a4bb1484876f23d5360afef9 (patch)
tree4dbce2363f3854cbef86689e93b34db0fc0f8272 /src/mongo/db/client.cpp
parent23b676781c096cbc3acc83cfaf188cb219d6a06d (diff)
downloadmongo-c841975ca8752c27a4bb1484876f23d5360afef9.tar.gz
Disable stack checker when using clang sanitizers
Diffstat (limited to 'src/mongo/db/client.cpp')
-rw-r--r--src/mongo/db/client.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index 0ae0155bae1..309564df8bf 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -53,6 +53,15 @@
#include "mongo/util/mongoutils/checksum.h"
#include "mongo/util/mongoutils/str.h"
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+
+#define ASAN_ENABLED __has_feature(address_sanitizer)
+#define MSAN_ENABLED __has_feature(memory_sanitizer)
+#define TSAN_ENABLED __has_feature(thread_sanitizer)
+#define XSAN_ENABLED (ASAN_ENABLED || MSAN_ENABLED || TSAN_ENABLED)
+
namespace mongo {
mongo::mutex& Client::clientsMutex = *(new mutex("clientsMutex"));
@@ -60,7 +69,7 @@ namespace mongo {
TSP_DEFINE(Client, currentClient)
-#if defined(_DEBUG)
+#if defined(_DEBUG) && !XSAN_ENABLED
struct StackChecker;
ThreadLocalValue<StackChecker *> checker;
@@ -113,7 +122,7 @@ namespace mongo {
call this when your thread starts.
*/
Client& Client::initThread(const char *desc, AbstractMessagingPort *mp) {
-#if defined(_DEBUG)
+#if defined(_DEBUG) && !XSAN_ENABLED
{
if( sizeof(void*) == 8 ) {
StackChecker sc;
@@ -209,7 +218,7 @@ namespace mongo {
}
bool Client::shutdown() {
-#if defined(_DEBUG)
+#if defined(_DEBUG) && !XSAN_ENABLED
{
if( sizeof(void*) == 8 ) {
StackChecker::check( desc() );