diff options
author | Matt Cotter <matt.cotter@mongodb.com> | 2016-09-08 17:24:07 -0400 |
---|---|---|
committer | Matt Cotter <matt.cotter@mongodb.com> | 2016-09-09 13:22:25 -0400 |
commit | 2bd286acef2fdb035f1d45253f6e6e4c24a2dc04 (patch) | |
tree | 13943305b07a3e368ca48d5b1520cfee02ce0b3f /src/mongo/db/pipeline | |
parent | ae280145c3c3dc770884a68885e80a282e8d50fd (diff) | |
download | mongo-2bd286acef2fdb035f1d45253f6e6e4c24a2dc04.tar.gz |
SERVER-22973 use mongo macros for static assert
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/document_internal.h | 4 | ||||
-rw-r--r-- | src/mongo/db/pipeline/value.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/pipeline/value.h | 3 | ||||
-rw-r--r-- | src/mongo/db/pipeline/value_internal.h | 3 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/db/pipeline/document_internal.h b/src/mongo/db/pipeline/document_internal.h index 3ad0d1ee577..2fd3c78cf34 100644 --- a/src/mongo/db/pipeline/document_internal.h +++ b/src/mongo/db/pipeline/document_internal.h @@ -33,6 +33,7 @@ #include <bitset> #include <boost/intrusive_ptr.hpp> +#include "mongo/base/static_assert.h" #include "mongo/db/pipeline/value.h" #include "mongo/util/intrusive_counter.h" @@ -123,8 +124,7 @@ private: }; // Real size is sizeof(ValueElement) + nameLen #pragma pack() -static_assert(sizeof(ValueElement) == (sizeof(Value) + sizeof(Position) + sizeof(int) + 1), - "sizeof(ValueElement) == (sizeof(Value) + sizeof(Position) + sizeof(int) + 1)"); +MONGO_STATIC_ASSERT(sizeof(ValueElement) == (sizeof(Value) + sizeof(Position) + sizeof(int) + 1)); // This is an internal class for Document. See FieldIterator for the public version. class DocumentStorageIterator { diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp index 291cc205053..5eea4d314d1 100644 --- a/src/mongo/db/pipeline/value.cpp +++ b/src/mongo/db/pipeline/value.cpp @@ -181,8 +181,7 @@ Value::Value(const BSONElement& elem) : _storage(elem.type()) { } case jstOID: - static_assert(sizeof(_storage.oid) == OID::kOIDSize, - "sizeof(_storage.oid) == OID::kOIDSize"); + MONGO_STATIC_ASSERT(sizeof(_storage.oid) == OID::kOIDSize); memcpy(_storage.oid, elem.OID().view().view(), OID::kOIDSize); break; @@ -836,8 +835,7 @@ void Value::hash_combine(size_t& seed, case bsonTimestamp: case Date: - static_assert(sizeof(_storage.dateValue) == sizeof(_storage.timestampValue), - "sizeof(_storage.dateValue) == sizeof(_storage.timestampValue)"); + MONGO_STATIC_ASSERT(sizeof(_storage.dateValue) == sizeof(_storage.timestampValue)); boost::hash_combine(seed, _storage.dateValue); break; diff --git a/src/mongo/db/pipeline/value.h b/src/mongo/db/pipeline/value.h index b4dfc6a4943..544cce0d604 100644 --- a/src/mongo/db/pipeline/value.h +++ b/src/mongo/db/pipeline/value.h @@ -28,6 +28,7 @@ #pragma once +#include "mongo/base/static_assert.h" #include "mongo/base/string_data.h" #include "mongo/db/pipeline/value_internal.h" #include "mongo/platform/unordered_set.h" @@ -334,7 +335,7 @@ private: ValueStorage _storage; friend class MutableValue; // gets and sets _storage.genericRCPtr }; -static_assert(sizeof(Value) == 16, "sizeof(Value) == 16"); +MONGO_STATIC_ASSERT(sizeof(Value) == 16); inline void swap(mongo::Value& lhs, mongo::Value& rhs) { lhs.swap(rhs); diff --git a/src/mongo/db/pipeline/value_internal.h b/src/mongo/db/pipeline/value_internal.h index fe34b97e0a7..51d76e6cf73 100644 --- a/src/mongo/db/pipeline/value_internal.h +++ b/src/mongo/db/pipeline/value_internal.h @@ -32,6 +32,7 @@ #include <boost/config.hpp> #include <boost/intrusive_ptr.hpp> +#include "mongo/base/static_assert.h" #include "mongo/bson/bsonmisc.h" #include "mongo/bson/bsonobj.h" #include "mongo/bson/bsontypes.h" @@ -358,6 +359,6 @@ public: long long i64[2]; }; }; -static_assert(sizeof(ValueStorage) == 16, "sizeof(ValueStorage) == 16"); +MONGO_STATIC_ASSERT(sizeof(ValueStorage) == 16); #pragma pack() } |