diff --git a/db/btree.cpp b/db/btree.cpp index 66fda24fbe0..8288a3aaeca 100644 --- a/db/btree.cpp +++ b/db/btree.cpp @@ -20,7 +20,6 @@ #include "db.h" #include "btree.h" #include "pdfile.h" -#include "../util/unittest.h" #include "json.h" #include "clientcursor.h" #include "client.h" @@ -38,8 +37,8 @@ namespace mongo { const int KeyMax = BucketSize / 10; extern int otherTraceLevel; - int split_debug = 0; - int insert_debug = 0; + const int split_debug = 0; + const int insert_debug = 0; /* BucketBasics --------------------------------------------------- */ @@ -79,6 +78,12 @@ namespace mongo { } int BucketBasics::fullValidate(const DiskLoc& thisLoc, const BSONObj &order) { + { + bool f = false; + assert( f = true ); + massert("assert is misdefined", f); + } + checkForInterrupt(); assertValid(order, true); // if( bt_fv==0 ) diff --git a/db/btree.h b/db/btree.h index b58484e9d89..228970fdc38 100644 --- a/db/btree.h +++ b/db/btree.h @@ -108,9 +108,9 @@ namespace mongo { */ bool _pushBack(const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order, DiskLoc prevChild); void pushBack(const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order, DiskLoc prevChild){ - assert( _pushBack( recordLoc , key , order , prevChild ) ); + bool ok = _pushBack( recordLoc , key , order , prevChild ); + assert(ok); } - //void pushBack(const DiskLoc& recordLoc, BSONObj& key, const BSONObj &order, DiskLoc prevChild, DiskLoc nextChild); void popBack(DiskLoc& recLoc, BSONObj& key); void _delKeyAtPos(int keypos); // low level version that doesn't deal with child ptrs. diff --git a/db/dbwebserver.cpp b/db/dbwebserver.cpp index 6cb5cd61b5a..be0d2145df2 100644 --- a/db/dbwebserver.cpp +++ b/db/dbwebserver.cpp @@ -30,6 +30,8 @@ #include #include +#undef assert +#define assert xassert namespace mongo { diff --git a/db/jsobj.cpp b/db/jsobj.cpp index a6b8781fd21..7bea9bd8a70 100644 --- a/db/jsobj.cpp +++ b/db/jsobj.cpp @@ -30,6 +30,8 @@ #include "jsobjmanipulator.h" #include "../util/optime.h" #include +#undef assert +#define assert xassert // make sure our assumptions are valid BOOST_STATIC_ASSERT( sizeof(int) == 4 ); diff --git a/db/security.h b/db/security.h index fef81808296..63cb84d5baf 100644 --- a/db/security.h +++ b/db/security.h @@ -21,6 +21,7 @@ #include #undef assert #define assert xassert + #include "db.h" #include "dbhelpers.h" #include "nonce.h" diff --git a/dbtests/btreetests.cpp b/dbtests/btreetests.cpp index 7f851b9c656..eca89bfdf77 100644 --- a/dbtests/btreetests.cpp +++ b/dbtests/btreetests.cpp @@ -18,9 +18,9 @@ */ #include "stdafx.h" -#include "../db/btree.h" #include "../db/db.h" +#include "../db/btree.h" #include "dbtests.h" @@ -29,6 +29,12 @@ namespace BtreeTests { class Base { public: Base() { + { + bool f = false; + assert( f = true ); + massert("assert is misdefined", f); + } + setClient( ns() ); BSONObjBuilder builder; builder.append( "ns", ns() ); diff --git a/dbtests/framework.cpp b/dbtests/framework.cpp index 46b5e88a11f..639937864f1 100644 --- a/dbtests/framework.cpp +++ b/dbtests/framework.cpp @@ -18,6 +18,10 @@ #include "stdafx.h" #include + +#undef assert +#define assert xassert + #include "framework.h" #include "../util/file_allocator.h" diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index 2017f5bb1d4..44f5067c9a2 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -7,6 +7,8 @@ #ifndef _WIN32 #include +#undef assert +#define assert xassert #endif namespace mongo { diff --git a/util/top.h b/util/top.h index b115388d5f3..12ef85f4b70 100644 --- a/util/top.h +++ b/util/top.h @@ -20,6 +20,8 @@ #pragma once #include +#undef assert +#define assert xassert namespace mongo {