diff options
author | Andrew Morrow <acm@mongodb.com> | 2015-07-06 21:06:36 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2015-07-09 13:49:39 -0400 |
commit | 932e768dc264865d683c113e35985b78425f78d9 (patch) | |
tree | 3b0d01bb663745e9b366daef53633ca75fbf5e59 /src/mongo | |
parent | 7e6df189868bdb2e2b991f0733dc1486b41c69b1 (diff) | |
download | mongo-932e768dc264865d683c113e35985b78425f78d9.tar.gz |
SERVER-19313 Remove some obsoleted usages of boost
Diffstat (limited to 'src/mongo')
57 files changed, 160 insertions, 143 deletions
diff --git a/src/mongo/base/counter_test.cpp b/src/mongo/base/counter_test.cpp index e40cda206d9..ee7ffe3253f 100644 --- a/src/mongo/base/counter_test.cpp +++ b/src/mongo/base/counter_test.cpp @@ -28,7 +28,6 @@ #include "mongo/platform/basic.h" -#include <boost/static_assert.hpp> #include <climits> #include <iostream> diff --git a/src/mongo/base/encoded_value_storage_test.cpp b/src/mongo/base/encoded_value_storage_test.cpp index 682e11a5d35..465f416fda2 100644 --- a/src/mongo/base/encoded_value_storage_test.cpp +++ b/src/mongo/base/encoded_value_storage_test.cpp @@ -110,7 +110,7 @@ private: class Value : public EncodedValueStorage<Layout, ConstView, View> { public: Value() { - BOOST_STATIC_ASSERT(sizeof(Value) == sizeof(Layout)); + static_assert(sizeof(Value) == sizeof(Layout), "sizeof(Value) == sizeof(Layout)"); } Value(ZeroInitTag_t zit) : EncodedValueStorage<Layout, ConstView, View>(zit) {} diff --git a/src/mongo/base/generate_error_codes.py b/src/mongo/base/generate_error_codes.py index f8dd6ba4317..c68a5f13086 100644 --- a/src/mongo/base/generate_error_codes.py +++ b/src/mongo/base/generate_error_codes.py @@ -254,7 +254,6 @@ source_template = '''// AUTO-GENERATED FILE DO NOT EDIT #include "mongo/base/error_codes.h" -#include <boost/static_assert.hpp> #include "mongo/util/mongoutils/str.h" @@ -279,7 +278,7 @@ namespace mongo { %(error_code_class_predicate_definitions)s namespace { - BOOST_STATIC_ASSERT(sizeof(ErrorCodes::Error) == sizeof(int)); + static_assert(sizeof(ErrorCodes::Error) == sizeof(int), "sizeof(ErrorCodes::Error) == sizeof(int)"); } // namespace } // namespace mongo ''' diff --git a/src/mongo/bson/bsonobjbuilder.h b/src/mongo/bson/bsonobjbuilder.h index 87c9f3f876a..6017df7a4e4 100644 --- a/src/mongo/bson/bsonobjbuilder.h +++ b/src/mongo/bson/bsonobjbuilder.h @@ -34,7 +34,6 @@ #pragma once -#include <boost/static_assert.hpp> #include <map> #include <cmath> #include <limits> diff --git a/src/mongo/bson/mutable/document.cpp b/src/mongo/bson/mutable/document.cpp index c03b4d197f3..f07073ad5e0 100644 --- a/src/mongo/bson/mutable/document.cpp +++ b/src/mongo/bson/mutable/document.cpp @@ -29,7 +29,6 @@ #include "mongo/bson/mutable/document.h" -#include <boost/static_assert.hpp> #include <cstdlib> #include <cstring> #include <limits> @@ -467,7 +466,7 @@ struct ElementRep { }; #pragma pack(pop) -BOOST_STATIC_ASSERT(sizeof(ElementRep) == 32); +static_assert(sizeof(ElementRep) == 32, "sizeof(ElementRep) == 32"); // We want ElementRep to be a POD so Document::Impl can grow the std::vector with // memmove. diff --git a/src/mongo/bson/util/builder.h b/src/mongo/bson/util/builder.h index 5878a2ed386..89c726b38d4 100644 --- a/src/mongo/bson/util/builder.h +++ b/src/mongo/bson/util/builder.h @@ -35,7 +35,6 @@ #include <string> #include <string.h> -#include <boost/static_assert.hpp> #include "mongo/base/data_type_endian.h" #include "mongo/base/data_view.h" @@ -186,7 +185,7 @@ public: } void appendUChar(unsigned char j) { - BOOST_STATIC_ASSERT(CHAR_BIT == 8); + static_assert(CHAR_BIT == 8, "CHAR_BIT == 8"); appendNumImpl(j); } void appendChar(char j) { @@ -196,11 +195,11 @@ public: appendNumImpl(j); } void appendNum(short j) { - BOOST_STATIC_ASSERT(sizeof(short) == 2); + static_assert(sizeof(short) == 2, "sizeof(short) == 2"); appendNumImpl(j); } void appendNum(int j) { - BOOST_STATIC_ASSERT(sizeof(int) == 4); + static_assert(sizeof(int) == 4, "sizeof(int) == 4"); appendNumImpl(j); } void appendNum(unsigned j) { @@ -211,11 +210,11 @@ public: void appendNum(bool j) = delete; void appendNum(double j) { - BOOST_STATIC_ASSERT(sizeof(double) == 8); + static_assert(sizeof(double) == 8, "sizeof(double) == 8"); appendNumImpl(j); } void appendNum(long long j) { - BOOST_STATIC_ASSERT(sizeof(long long) == 8); + static_assert(sizeof(long long) == 8, "sizeof(long long) == 8"); appendNumImpl(j); } void appendNum(unsigned long long j) { diff --git a/src/mongo/db/auth/authorization_manager.cpp b/src/mongo/db/auth/authorization_manager.cpp index 30123e78177..4430c43a5ab 100644 --- a/src/mongo/db/auth/authorization_manager.cpp +++ b/src/mongo/db/auth/authorization_manager.cpp @@ -32,7 +32,6 @@ #include "mongo/db/auth/authorization_manager.h" -#include <boost/bind.hpp> #include <memory> #include <string> #include <vector> diff --git a/src/mongo/db/clientlistplugin.cpp b/src/mongo/db/clientlistplugin.cpp index 66e15df4393..6428381dc35 100644 --- a/src/mongo/db/clientlistplugin.cpp +++ b/src/mongo/db/clientlistplugin.cpp @@ -28,8 +28,6 @@ #include "mongo/platform/basic.h" -#include <boost/thread/locks.hpp> - #include "mongo/bson/bsonobjbuilder.h" #include "mongo/db/auth/action_type.h" #include "mongo/db/auth/authorization_session.h" diff --git a/src/mongo/db/commands/copydb_start_commands.h b/src/mongo/db/commands/copydb_start_commands.h index 61f3313f918..5bf8b32c444 100644 --- a/src/mongo/db/commands/copydb_start_commands.h +++ b/src/mongo/db/commands/copydb_start_commands.h @@ -26,8 +26,6 @@ * it in the license file. */ -#include <boost/thread/tss.hpp> - #include "mongo/client/dbclientinterface.h" namespace mongo { diff --git a/src/mongo/db/concurrency/fast_map_noalloc.h b/src/mongo/db/concurrency/fast_map_noalloc.h index cc2ccdb64ae..eef9f4ceebe 100644 --- a/src/mongo/db/concurrency/fast_map_noalloc.h +++ b/src/mongo/db/concurrency/fast_map_noalloc.h @@ -233,8 +233,8 @@ public: private: // Empty and very large maps do not make sense since there will be no performance gain, so // disallow them. - BOOST_STATIC_ASSERT(PreallocCount > 0); - BOOST_STATIC_ASSERT(PreallocCount < 32); + static_assert(PreallocCount > 0, "PreallocCount > 0"); + static_assert(PreallocCount < 32, "PreallocCount < 32"); // Iterator accesses the map directly friend class IteratorImpl<FastMapNoAlloc<KeyType, ValueType, PreallocCount>, ValueType>; diff --git a/src/mongo/db/concurrency/lock_manager.cpp b/src/mongo/db/concurrency/lock_manager.cpp index c82e2d0ee5c..f28c40d16cf 100644 --- a/src/mongo/db/concurrency/lock_manager.cpp +++ b/src/mongo/db/concurrency/lock_manager.cpp @@ -72,7 +72,8 @@ static const int LockConflictsTable[] = { const uint64_t intentModes = (1 << MODE_IS) | (1 << MODE_IX); // Ensure we do not add new modes without updating the conflicts table -BOOST_STATIC_ASSERT((sizeof(LockConflictsTable) / sizeof(LockConflictsTable[0])) == LockModesCount); +static_assert((sizeof(LockConflictsTable) / sizeof(LockConflictsTable[0])) == LockModesCount, + "(sizeof(LockConflictsTable) / sizeof(LockConflictsTable[0])) == LockModesCount"); /** @@ -83,10 +84,10 @@ static const char* LockModeNames[] = {"NONE", "IS", "IX", "S", "X"}; static const char* LegacyLockModeNames[] = {"", "r", "w", "R", "W"}; // Ensure we do not add new modes without updating the names array -BOOST_STATIC_ASSERT((sizeof(LockModeNames) / sizeof(LockModeNames[0])) == LockModesCount); -BOOST_STATIC_ASSERT((sizeof(LegacyLockModeNames) / sizeof(LegacyLockModeNames[0])) == - LockModesCount); - +static_assert((sizeof(LockModeNames) / sizeof(LockModeNames[0])) == LockModesCount, + "(sizeof(LockModeNames) / sizeof(LockModeNames[0])) == LockModesCount"); +static_assert((sizeof(LegacyLockModeNames) / sizeof(LegacyLockModeNames[0])) == LockModesCount, + "(sizeof(LegacyLockModeNames) / sizeof(LegacyLockModeNames[0])) == LockModesCount"); // Helper functions for the lock modes bool conflicts(LockMode newMode, uint32_t existingModesMask) { @@ -106,8 +107,8 @@ static const char* ResourceTypeNames[] = { }; // Ensure we do not add new types without updating the names array -BOOST_STATIC_ASSERT((sizeof(ResourceTypeNames) / sizeof(ResourceTypeNames[0])) == - ResourceTypesCount); +static_assert((sizeof(ResourceTypeNames) / sizeof(ResourceTypeNames[0])) == ResourceTypesCount, + "(sizeof(ResourceTypeNames) / sizeof(ResourceTypeNames[0])) == ResourceTypesCount"); /** @@ -118,8 +119,10 @@ static const char* LockRequestStatusNames[] = { }; // Ensure we do not add new status types without updating the names array -BOOST_STATIC_ASSERT((sizeof(LockRequestStatusNames) / sizeof(LockRequestStatusNames[0])) == - LockRequest::StatusCount); +static_assert((sizeof(LockRequestStatusNames) / sizeof(LockRequestStatusNames[0])) == + LockRequest::StatusCount, + "(sizeof(LockRequestStatusNames) / sizeof(LockRequestStatusNames[0])) == " + "LockRequest::StatusCount"); } // namespace diff --git a/src/mongo/db/concurrency/lock_manager_defs.h b/src/mongo/db/concurrency/lock_manager_defs.h index 86bce16a659..1ca3f70dbe2 100644 --- a/src/mongo/db/concurrency/lock_manager_defs.h +++ b/src/mongo/db/concurrency/lock_manager_defs.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/static_assert.hpp> #include <cstdint> #include <string> #include <limits> @@ -173,7 +172,8 @@ const char* resourceTypeName(ResourceType resourceType); class ResourceId { // We only use 3 bits for the resource type in the ResourceId hash enum { resourceTypeBits = 3 }; - BOOST_STATIC_ASSERT(ResourceTypesCount <= (1 << resourceTypeBits)); + static_assert(ResourceTypesCount <= (1 << resourceTypeBits), + "ResourceTypesCount <= (1 << resourceTypeBits)"); public: /** @@ -236,7 +236,7 @@ private: #ifndef MONGO_CONFIG_DEBUG_BUILD // Treat the resource ids as 64-bit integers in release mode in order to ensure we do // not spend too much time doing comparisons for hashing. -BOOST_STATIC_ASSERT(sizeof(ResourceId) == sizeof(uint64_t)); +static_assert(sizeof(ResourceId) == sizeof(uint64_t), "sizeof(ResourceId) == sizeof(uint64_t)"); #endif diff --git a/src/mongo/db/dbmessage.h b/src/mongo/db/dbmessage.h index 795bdf75b90..73c30f09bac 100644 --- a/src/mongo/db/dbmessage.h +++ b/src/mongo/db/dbmessage.h @@ -192,7 +192,7 @@ private: class Value : public EncodedValueStorage<Layout, ConstView, View> { public: Value() { - BOOST_STATIC_ASSERT(sizeof(Value) == sizeof(Layout)); + static_assert(sizeof(Value) == sizeof(Layout), "sizeof(Value) == sizeof(Layout)"); } Value(ZeroInitTag_t zit) : EncodedValueStorage<Layout, ConstView, View>(zit) {} @@ -207,7 +207,7 @@ public: */ class DbMessage { // Assume sizeof(int) == 4 bytes - BOOST_STATIC_ASSERT(sizeof(int) == 4); + static_assert(sizeof(int) == 4, "sizeof(int) == 4"); public: // Note: DbMessage constructor reads the first 4 bytes and stores it in reserved diff --git a/src/mongo/db/pipeline/accumulator.h b/src/mongo/db/pipeline/accumulator.h index fcb4fe922e1..125544c5ef4 100644 --- a/src/mongo/db/pipeline/accumulator.h +++ b/src/mongo/db/pipeline/accumulator.h @@ -31,7 +31,7 @@ #include "mongo/platform/basic.h" #include <boost/intrusive_ptr.hpp> -#include <boost/unordered_set.hpp> +#include <unordered_set> #include <vector> #include "mongo/bson/bsontypes.h" @@ -86,7 +86,7 @@ public: static boost::intrusive_ptr<Accumulator> create(); private: - typedef boost::unordered_set<Value, Value::Hash> SetType; + typedef std::unordered_set<Value, Value::Hash> SetType; SetType set; }; diff --git a/src/mongo/db/pipeline/document_internal.h b/src/mongo/db/pipeline/document_internal.h index fa5988611b5..4ccb61b8f9b 100644 --- a/src/mongo/db/pipeline/document_internal.h +++ b/src/mongo/db/pipeline/document_internal.h @@ -123,7 +123,8 @@ private: }; // Real size is sizeof(ValueElement) + nameLen #pragma pack() -BOOST_STATIC_ASSERT(sizeof(ValueElement) == (sizeof(Value) + sizeof(Position) + sizeof(int) + 1)); +static_assert(sizeof(ValueElement) == (sizeof(Value) + sizeof(Position) + sizeof(int) + 1), + "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/document_source.h b/src/mongo/db/pipeline/document_source.h index 5b94564a466..8095426a3c3 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -32,10 +32,10 @@ #include <boost/optional.hpp> #include <boost/intrusive_ptr.hpp> -#include <boost/unordered_map.hpp> #include <deque> #include <list> #include <string> +#include <unordered_map> #include <utility> #include <vector> @@ -561,7 +561,7 @@ private: typedef std::vector<boost::intrusive_ptr<Accumulator>> Accumulators; - typedef boost::unordered_map<Value, Accumulators, Value::Hash> GroupsMap; + typedef std::unordered_map<Value, Accumulators, Value::Hash> GroupsMap; GroupsMap groups; /* diff --git a/src/mongo/db/pipeline/document_source_project.cpp b/src/mongo/db/pipeline/document_source_project.cpp index a5522fd2cf4..a0a81df8610 100644 --- a/src/mongo/db/pipeline/document_source_project.cpp +++ b/src/mongo/db/pipeline/document_source_project.cpp @@ -28,7 +28,7 @@ #include "mongo/platform/basic.h" -#include <boost/smart_ptr.hpp> +#include <boost/smart_ptr/intrusive_ptr.hpp> #include "mongo/db/jsobj.h" #include "mongo/db/pipeline/document.h" diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp index 4afc5ccf684..3f5a9377dd4 100644 --- a/src/mongo/db/pipeline/value.cpp +++ b/src/mongo/db/pipeline/value.cpp @@ -176,7 +176,8 @@ Value::Value(const BSONElement& elem) : _storage(elem.type()) { } case jstOID: - BOOST_STATIC_ASSERT(sizeof(_storage.oid) == OID::kOIDSize); + static_assert(sizeof(_storage.oid) == OID::kOIDSize, + "sizeof(_storage.oid) == OID::kOIDSize"); memcpy(_storage.oid, elem.OID().view().view(), OID::kOIDSize); break; @@ -731,7 +732,8 @@ void Value::hash_combine(size_t& seed) const { case bsonTimestamp: case Date: - BOOST_STATIC_ASSERT(sizeof(_storage.dateValue) == sizeof(_storage.timestampValue)); + static_assert(sizeof(_storage.dateValue) == sizeof(_storage.timestampValue), + "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 0852407a84a..6c27c04078d 100644 --- a/src/mongo/db/pipeline/value.h +++ b/src/mongo/db/pipeline/value.h @@ -276,7 +276,7 @@ private: ValueStorage _storage; friend class MutableValue; // gets and sets _storage.genericRCPtr }; -BOOST_STATIC_ASSERT(sizeof(Value) == 16); +static_assert(sizeof(Value) == 16, "sizeof(Value) == 16"); typedef unordered_set<Value, Value::Hash> ValueSet; } diff --git a/src/mongo/db/pipeline/value_internal.h b/src/mongo/db/pipeline/value_internal.h index b5b9f5c77ea..142b94368b3 100644 --- a/src/mongo/db/pipeline/value_internal.h +++ b/src/mongo/db/pipeline/value_internal.h @@ -310,6 +310,6 @@ public: long long i64[2]; }; }; -BOOST_STATIC_ASSERT(sizeof(ValueStorage) == 16); +static_assert(sizeof(ValueStorage) == 16, "sizeof(ValueStorage) == 16"); #pragma pack() } diff --git a/src/mongo/db/query/lru_key_value.h b/src/mongo/db/query/lru_key_value.h index 7553ced9020..ddf17faaef8 100644 --- a/src/mongo/db/query/lru_key_value.h +++ b/src/mongo/db/query/lru_key_value.h @@ -28,9 +28,9 @@ #pragma once -#include <boost/unordered_map.hpp> #include <list> #include <memory> +#include <unordered_map> #include "mongo/base/status.h" #include "mongo/util/assert_util.h" @@ -72,7 +72,7 @@ public: typedef typename KVList::iterator KVListIt; typedef typename KVList::const_iterator KVListConstIt; - typedef boost::unordered_map<K, KVListIt> KVMap; + typedef std::unordered_map<K, KVListIt> KVMap; typedef typename KVMap::const_iterator KVMapConstIt; /** diff --git a/src/mongo/db/query/plan_cache.cpp b/src/mongo/db/query/plan_cache.cpp index f97a81c0f01..5134f54bc84 100644 --- a/src/mongo/db/query/plan_cache.cpp +++ b/src/mongo/db/query/plan_cache.cpp @@ -35,7 +35,6 @@ #include <algorithm> #include <math.h> #include <memory> -#include "boost/thread/locks.hpp" #include "mongo/base/owned_pointer_vector.h" #include "mongo/client/dbclientinterface.h" // For QueryOption_foobar #include "mongo/db/matcher/expression_array.h" diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 5ef11746228..b1c71b46bbf 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -34,7 +34,6 @@ #include "mongo/db/repl/sync_tail.h" #include <boost/functional/hash.hpp> -#include <boost/ref.hpp> #include <memory> #include "third_party/murmurhash3/MurmurHash3.h" @@ -286,7 +285,7 @@ void applyOps(const std::vector<std::vector<BSONObj>>& writerVectors, it != writerVectors.end(); ++it) { if (!it->empty()) { - writerPool->schedule(func, boost::cref(*it), sync); + writerPool->schedule(func, stdx::cref(*it), sync); } } writerPool->join(); diff --git a/src/mongo/db/repl/task_runner.cpp b/src/mongo/db/repl/task_runner.cpp index 385a76207cd..f518206d7a4 100644 --- a/src/mongo/db/repl/task_runner.cpp +++ b/src/mongo/db/repl/task_runner.cpp @@ -32,7 +32,6 @@ #include "mongo/db/repl/task_runner.h" -#include <boost/thread/locks.hpp> #include <memory> #include "mongo/db/operation_context.h" diff --git a/src/mongo/db/sorter/sorter_test.cpp b/src/mongo/db/sorter/sorter_test.cpp index cdf43448f0b..7c485c365a1 100644 --- a/src/mongo/db/sorter/sorter_test.cpp +++ b/src/mongo/db/sorter/sorter_test.cpp @@ -477,8 +477,10 @@ public: SortOptions adjustSortOptions(SortOptions opts) { // Make sure we use a reasonable number of files when we spill - BOOST_STATIC_ASSERT((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 50); - BOOST_STATIC_ASSERT((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500); + static_assert((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 50, + "(NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 50"); + static_assert((NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500, + "(NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500"); return opts.MaxMemoryUsageBytes(MEM_LIMIT).ExtSortAllowed(); } @@ -514,13 +516,17 @@ class LotsOfDataWithLimit : public LotsOfDataLittleMemory<Random> { typedef LotsOfDataLittleMemory<Random> Parent; SortOptions adjustSortOptions(SortOptions opts) { // Make sure our tests will spill or not as desired - BOOST_STATIC_ASSERT(MEM_LIMIT / 2 > (100 * sizeof(IWPair))); - BOOST_STATIC_ASSERT(MEM_LIMIT < (5000 * sizeof(IWPair))); - BOOST_STATIC_ASSERT(MEM_LIMIT * 2 > (5000 * sizeof(IWPair))); + static_assert(MEM_LIMIT / 2 > (100 * sizeof(IWPair)), + "MEM_LIMIT / 2 > (100 * sizeof(IWPair))"); + static_assert(MEM_LIMIT < (5000 * sizeof(IWPair)), "MEM_LIMIT < (5000 * sizeof(IWPair))"); + static_assert(MEM_LIMIT * 2 > (5000 * sizeof(IWPair)), + "MEM_LIMIT * 2 > (5000 * sizeof(IWPair))"); // Make sure we use a reasonable number of files when we spill - BOOST_STATIC_ASSERT((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 100); - BOOST_STATIC_ASSERT((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500); + static_assert((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 100, + "(Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT > 100"); + static_assert((Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500, + "(Parent::NUM_ITEMS * sizeof(IWPair)) / MEM_LIMIT < 500"); return opts.MaxMemoryUsageBytes(MEM_LIMIT).ExtSortAllowed().Limit(Limit); } diff --git a/src/mongo/db/stats/snapshots.cpp b/src/mongo/db/stats/snapshots.cpp index 81aa221e9a1..8acf20b7e7a 100644 --- a/src/mongo/db/stats/snapshots.cpp +++ b/src/mongo/db/stats/snapshots.cpp @@ -93,7 +93,7 @@ StatusWith<SnapshotDiff> Snapshots::computeDelta() { } // The following logic depends on there being exactly 2 stored snapshots - BOOST_STATIC_ASSERT(kNumSnapshots == 2); + static_assert(kNumSnapshots == 2, "kNumSnapshots == 2"); // Current and previous napshot alternates between indexes 0 and 1 int currIdx = _loc; diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp index 3d43d93e4f2..dbda051b01e 100644 --- a/src/mongo/db/storage/key_string.cpp +++ b/src/mongo/db/storage/key_string.cpp @@ -97,11 +97,12 @@ const uint8_t kNumericPositive6ByteInt = kNumeric + 18; const uint8_t kNumericPositive7ByteInt = kNumeric + 19; const uint8_t kNumericPositive8ByteInt = kNumeric + 20; const uint8_t kNumericPositiveLargeDouble = kNumeric + 21; // >= 2**63 including +Inf -BOOST_STATIC_ASSERT(kNumericPositiveLargeDouble < kStringLike); +static_assert(kNumericPositiveLargeDouble < kStringLike, + "kNumericPositiveLargeDouble < kStringLike"); const uint8_t kBoolFalse = kBool + 0; const uint8_t kBoolTrue = kBool + 1; -BOOST_STATIC_ASSERT(kBoolTrue < kDate); +static_assert(kBoolTrue < kDate, "kBoolTrue < kDate"); size_t numBytesForInt(uint8_t ctype) { if (ctype >= kNumericPositive1ByteInt) { diff --git a/src/mongo/db/storage/mmap_v1/aligned_builder.cpp b/src/mongo/db/storage/mmap_v1/aligned_builder.cpp index bee3fb4f86a..ce2ae8296b9 100644 --- a/src/mongo/db/storage/mmap_v1/aligned_builder.cpp +++ b/src/mongo/db/storage/mmap_v1/aligned_builder.cpp @@ -45,7 +45,7 @@ AlignedBuilder::AlignedBuilder(unsigned initSize) { uassert(13584, "out of memory AlignedBuilder", _p._allocationAddress); } -BOOST_STATIC_ASSERT(sizeof(void*) == sizeof(size_t)); +static_assert(sizeof(void*) == sizeof(size_t), "sizeof(void*) == sizeof(size_t)"); /** reset for a re-use. shrinks if > 128MB */ void AlignedBuilder::reset() { diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h b/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h index 3238ec64179..26c99cd50cb 100644 --- a/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h +++ b/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h @@ -181,8 +181,10 @@ struct BtreeBucketV0 { }; // BtreeBucketV0 is part of the on-disk format, so it should never be changed -BOOST_STATIC_ASSERT(sizeof(BtreeBucketV0) - sizeof(static_cast<BtreeBucketV0*>(NULL)->data) == - BtreeBucketV0::HeaderSize); +static_assert(sizeof(BtreeBucketV0) - sizeof(static_cast<BtreeBucketV0*>(NULL)->data) == + BtreeBucketV0::HeaderSize, + "sizeof(BtreeBucketV0) - sizeof(static_cast<BtreeBucketV0*>(NULL)->data) == " + "BtreeBucketV0::HeaderSize"); /** * A variant of DiskLoc Used by the V1 bucket type. @@ -322,8 +324,10 @@ struct BtreeBucketV1 { }; // BtreeBucketV1 is part of the on-disk format, so it should never be changed -BOOST_STATIC_ASSERT(sizeof(BtreeBucketV1) - sizeof(static_cast<BtreeBucketV1*>(NULL)->data) == - BtreeBucketV1::HeaderSize); +static_assert(sizeof(BtreeBucketV1) - sizeof(static_cast<BtreeBucketV1*>(NULL)->data) == + BtreeBucketV1::HeaderSize, + "sizeof(BtreeBucketV1) - sizeof(static_cast<BtreeBucketV1*>(NULL)->data) == " + "BtreeBucketV1::HeaderSize"); enum Flags { Packed = 1 }; diff --git a/src/mongo/db/storage/mmap_v1/catalog/hashtab.h b/src/mongo/db/storage/mmap_v1/catalog/hashtab.h index 286de349138..ff2e889a202 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/hashtab.h +++ b/src/mongo/db/storage/mmap_v1/catalog/hashtab.h @@ -116,7 +116,7 @@ private: }; #pragma pack() - BOOST_STATIC_ASSERT(sizeof(Node) == 628); + static_assert(sizeof(Node) == 628, "sizeof(Node) == 628"); int _find(const Namespace& k, bool& found) const; diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace.cpp index c9dec65d520..b1e1d261dd6 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace.cpp +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace.cpp @@ -32,17 +32,20 @@ #include "mongo/db/storage/mmap_v1/catalog/namespace.h" -#include <boost/static_assert.hpp> #include "mongo/db/namespace_string.h" namespace mongo { namespace { -BOOST_STATIC_ASSERT(sizeof(Namespace) == 128); -BOOST_STATIC_ASSERT(Namespace::MaxNsLenWithNUL == MaxDatabaseNameLen); -BOOST_STATIC_ASSERT((int)Namespace::MaxNsLenWithNUL == (int)NamespaceString::MaxNsLenWithNUL); -BOOST_STATIC_ASSERT((int)Namespace::MaxNsLen == (int)NamespaceString::MaxNsLen); +static_assert(sizeof(Namespace) == 128, "sizeof(Namespace) == 128"); +static_assert(Namespace::MaxNsLenWithNUL == MaxDatabaseNameLen, + "Namespace::MaxNsLenWithNUL == MaxDatabaseNameLen"); +static_assert((int)Namespace::MaxNsLenWithNUL == (int)NamespaceString::MaxNsLenWithNUL, + "(int)Namespace::MaxNsLenWithNUL == (int)NamespaceString::MaxNsLenWithNUL"); +static_assert((int)Namespace::MaxNsLen == (int)NamespaceString::MaxNsLen, + "(int)Namespace::MaxNsLen == (int)NamespaceString::MaxNsLen"); // Note the typo. -BOOST_STATIC_ASSERT((int)Namespace::MaxNsColletionLen == (int)NamespaceString::MaxNsCollectionLen); +static_assert((int)Namespace::MaxNsColletionLen == (int)NamespaceString::MaxNsCollectionLen, + "(int)Namespace::MaxNsColletionLen == (int)NamespaceString::MaxNsCollectionLen"); } } diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp index 538a4500906..915e3a7e44d 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp @@ -52,7 +52,8 @@ namespace mongo { NamespaceDetails::NamespaceDetails(const DiskLoc& loc, bool capped) { - BOOST_STATIC_ASSERT(sizeof(NamespaceDetails::Extra) <= sizeof(NamespaceDetails)); + static_assert(sizeof(NamespaceDetails::Extra) <= sizeof(NamespaceDetails), + "sizeof(NamespaceDetails::Extra) <= sizeof(NamespaceDetails)"); /* be sure to initialize new fields here -- doesn't default to zeroes the way we use it */ firstExtent = lastExtent = capExtent = loc; diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h index a6604e1fb04..1da82400088 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h @@ -240,11 +240,12 @@ private: /** Update cappedLastDelRecLastExtent() after capExtent changed in cappedTruncateAfter() */ void cappedTruncateLastDelUpdate(); - BOOST_STATIC_ASSERT(NIndexesMax <= NIndexesBase + NIndexesExtra * 2); - BOOST_STATIC_ASSERT(NIndexesMax <= 64); // multiKey bits - BOOST_STATIC_ASSERT(sizeof(NamespaceDetails::Extra) == 496); + static_assert(NIndexesMax <= NIndexesBase + NIndexesExtra * 2, + "NIndexesMax <= NIndexesBase + NIndexesExtra * 2"); + static_assert(NIndexesMax <= 64, "NIndexesMax <= 64"); // multiKey bits + static_assert(sizeof(NamespaceDetails::Extra) == 496, "sizeof(NamespaceDetails::Extra) == 496"); }; // NamespaceDetails -BOOST_STATIC_ASSERT(sizeof(NamespaceDetails) == 496); +static_assert(sizeof(NamespaceDetails) == 496, "sizeof(NamespaceDetails) == 496"); #pragma pack() } // namespace mongo diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp index 51fc1c1ed75..219f410283b 100644 --- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp +++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details_rsv1_metadata.cpp @@ -38,8 +38,10 @@ namespace mongo { using std::unique_ptr; using std::numeric_limits; -BOOST_STATIC_ASSERT(RecordStoreV1Base::Buckets == - NamespaceDetails::SmallBuckets + NamespaceDetails::LargeBuckets); +static_assert(RecordStoreV1Base::Buckets == + NamespaceDetails::SmallBuckets + NamespaceDetails::LargeBuckets, + "RecordStoreV1Base::Buckets == NamespaceDetails::SmallBuckets + " + "NamespaceDetails::LargeBuckets"); NamespaceDetailsRSV1MetaData::NamespaceDetailsRSV1MetaData(StringData ns, NamespaceDetails* details) : _ns(ns.toString()), _details(details) {} diff --git a/src/mongo/db/storage/mmap_v1/data_file.cpp b/src/mongo/db/storage/mmap_v1/data_file.cpp index 90f6b71b7c6..70a097f1f32 100644 --- a/src/mongo/db/storage/mmap_v1/data_file.cpp +++ b/src/mongo/db/storage/mmap_v1/data_file.cpp @@ -64,10 +64,13 @@ void data_file_check(void* _mb) { } // namespace -BOOST_STATIC_ASSERT(DataFileHeader::HeaderSize == 8192); -BOOST_STATIC_ASSERT(sizeof(static_cast<DataFileHeader*>(NULL)->data) == 4); -BOOST_STATIC_ASSERT(sizeof(DataFileHeader) - sizeof(static_cast<DataFileHeader*>(NULL)->data) == - DataFileHeader::HeaderSize); +static_assert(DataFileHeader::HeaderSize == 8192, "DataFileHeader::HeaderSize == 8192"); +static_assert(sizeof(static_cast<DataFileHeader*>(NULL)->data) == 4, + "sizeof(static_cast<DataFileHeader*>(NULL)->data) == 4"); +static_assert(sizeof(DataFileHeader) - sizeof(static_cast<DataFileHeader*>(NULL)->data) == + DataFileHeader::HeaderSize, + "sizeof(DataFileHeader) - sizeof(static_cast<DataFileHeader*>(NULL)->data) == " + "DataFileHeader::HeaderSize"); int DataFile::maxSize() { diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp index 359e231f1b3..4e849dfa3d1 100644 --- a/src/mongo/db/storage/mmap_v1/dur.cpp +++ b/src/mongo/db/storage/mmap_v1/dur.cpp @@ -148,8 +148,10 @@ unsigned remapFileToStartAt; enum { DurStatsResetIntervalMillis = 3 * 1000 }; // Size sanity checks -BOOST_STATIC_ASSERT(UncommittedBytesLimit > BSONObjMaxInternalSize * 3); -BOOST_STATIC_ASSERT(sizeof(void*) == 4 || UncommittedBytesLimit > BSONObjMaxInternalSize * 6); +static_assert(UncommittedBytesLimit > BSONObjMaxInternalSize * 3, + "UncommittedBytesLimit > BSONObjMaxInternalSize * 3"); +static_assert(sizeof(void*) == 4 || UncommittedBytesLimit > BSONObjMaxInternalSize * 6, + "sizeof(void*) == 4 || UncommittedBytesLimit > BSONObjMaxInternalSize * 6"); /** diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp index 66c88e3e156..683bf2b190e 100644 --- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp @@ -34,7 +34,6 @@ #include "mongo/db/storage/mmap_v1/dur_journal.h" -#include <boost/static_assert.hpp> #include <boost/filesystem.hpp> #include <boost/filesystem/operations.hpp> @@ -97,12 +96,12 @@ MONGO_INITIALIZER(InitializeJournalingParams)(InitializerContext* context) { return Status::OK(); } -BOOST_STATIC_ASSERT(sizeof(Checksum) == 16); -BOOST_STATIC_ASSERT(sizeof(JHeader) == 8192); -BOOST_STATIC_ASSERT(sizeof(JSectHeader) == 20); -BOOST_STATIC_ASSERT(sizeof(JSectFooter) == 32); -BOOST_STATIC_ASSERT(sizeof(JEntry) == 12); -BOOST_STATIC_ASSERT(sizeof(LSNFile) == 88); +static_assert(sizeof(Checksum) == 16, "sizeof(Checksum) == 16"); +static_assert(sizeof(JHeader) == 8192, "sizeof(JHeader) == 8192"); +static_assert(sizeof(JSectHeader) == 20, "sizeof(JSectHeader) == 20"); +static_assert(sizeof(JSectFooter) == 32, "sizeof(JSectFooter) == 32"); +static_assert(sizeof(JEntry) == 12, "sizeof(JEntry) == 12"); +static_assert(sizeof(LSNFile) == 88, "sizeof(LSNFile) == 88"); bool usingPreallocate = false; diff --git a/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp b/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp index 971f2aa0e60..78b40e25313 100644 --- a/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp +++ b/src/mongo/db/storage/mmap_v1/dur_journal_writer.cpp @@ -32,8 +32,6 @@ #include "mongo/db/storage/mmap_v1/dur_journal_writer.h" -#include <boost/bind.hpp> - #include "mongo/db/client.h" #include "mongo/db/storage/mmap_v1/dur_journal.h" #include "mongo/db/storage/mmap_v1/dur_recover.h" diff --git a/src/mongo/db/storage/mmap_v1/extent.cpp b/src/mongo/db/storage/mmap_v1/extent.cpp index 7f6d41cde80..7b92551fa8a 100644 --- a/src/mongo/db/storage/mmap_v1/extent.cpp +++ b/src/mongo/db/storage/mmap_v1/extent.cpp @@ -40,7 +40,7 @@ using std::iostream; using std::string; using std::vector; -BOOST_STATIC_ASSERT(sizeof(Extent) - 4 == 48 + 128); +static_assert(sizeof(Extent) - 4 == 48 + 128, "sizeof(Extent) - 4 == 48 + 128"); BSONObj Extent::dump() const { return BSON("loc" << myLoc.toString() << "xnext" << xnext.toString() << "xprev" diff --git a/src/mongo/db/storage/mmap_v1/logfile.cpp b/src/mongo/db/storage/mmap_v1/logfile.cpp index 62c3b61bc73..a39041d2a6a 100644 --- a/src/mongo/db/storage/mmap_v1/logfile.cpp +++ b/src/mongo/db/storage/mmap_v1/logfile.cpp @@ -197,8 +197,8 @@ LogFile::~LogFile() { void LogFile::truncate() { verify(_fd >= 0); - BOOST_STATIC_ASSERT(sizeof(off_t) == 8); // we don't want overflow here - const off_t pos = lseek(_fd, 0, SEEK_CUR); // doesn't actually seek + static_assert(sizeof(off_t) == 8, "sizeof(off_t) == 8"); // we don't want overflow here + const off_t pos = lseek(_fd, 0, SEEK_CUR); // doesn't actually seek if (ftruncate(_fd, pos) != 0) { msgasserted(15873, "Couldn't truncate file: " + errnoWithDescription()); } diff --git a/src/mongo/db/storage/mmap_v1/record.h b/src/mongo/db/storage/mmap_v1/record.h index a37d49101b1..a8b63b13390 100644 --- a/src/mongo/db/storage/mmap_v1/record.h +++ b/src/mongo/db/storage/mmap_v1/record.h @@ -175,6 +175,6 @@ private: DiskLoc _nextDeleted; }; -BOOST_STATIC_ASSERT(16 == sizeof(DeletedRecord)); +static_assert(16 == sizeof(DeletedRecord), "16 == sizeof(DeletedRecord)"); } // namespace mongo diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp index 0e7d667f84f..69abb4c872a 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp @@ -86,9 +86,10 @@ const int RecordStoreV1Base::bucketSizes[] = { }; // If this fails, it means that bucketSizes doesn't have the correct number of entries. -BOOST_STATIC_ASSERT(sizeof(RecordStoreV1Base::bucketSizes) / - sizeof(RecordStoreV1Base::bucketSizes[0]) == - RecordStoreV1Base::Buckets); +static_assert(sizeof(RecordStoreV1Base::bucketSizes) / sizeof(RecordStoreV1Base::bucketSizes[0]) == + RecordStoreV1Base::Buckets, + "sizeof(RecordStoreV1Base::bucketSizes) / sizeof(RecordStoreV1Base::bucketSizes[0]) " + "== RecordStoreV1Base::Buckets"); SavedCursorRegistry::~SavedCursorRegistry() { for (SavedCursorSet::iterator it = _cursors.begin(); it != _cursors.end(); it++) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp index a5abbf61137..d6b1d02f5ac 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_index.cpp @@ -82,8 +82,10 @@ static const WiredTigerItem emptyItem(NULL, 0); static const int kMinimumIndexVersion = 6; static const int kCurrentIndexVersion = 6; // New indexes use this by default. static const int kMaximumIndexVersion = 6; -BOOST_STATIC_ASSERT(kCurrentIndexVersion >= kMinimumIndexVersion); -BOOST_STATIC_ASSERT(kCurrentIndexVersion <= kMaximumIndexVersion); +static_assert(kCurrentIndexVersion >= kMinimumIndexVersion, + "kCurrentIndexVersion >= kMinimumIndexVersion"); +static_assert(kCurrentIndexVersion <= kMaximumIndexVersion, + "kCurrentIndexVersion <= kMaximumIndexVersion"); bool hasFieldNames(const BSONObj& obj) { BSONForEach(e, obj) { diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp index b063803630e..63cd7dd65ac 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp @@ -71,8 +71,10 @@ namespace { static const int kMinimumRecordStoreVersion = 1; static const int kCurrentRecordStoreVersion = 1; // New record stores use this by default. static const int kMaximumRecordStoreVersion = 1; -BOOST_STATIC_ASSERT(kCurrentRecordStoreVersion >= kMinimumRecordStoreVersion); -BOOST_STATIC_ASSERT(kCurrentRecordStoreVersion <= kMaximumRecordStoreVersion); +static_assert(kCurrentRecordStoreVersion >= kMinimumRecordStoreVersion, + "kCurrentRecordStoreVersion >= kMinimumRecordStoreVersion"); +static_assert(kCurrentRecordStoreVersion <= kMaximumRecordStoreVersion, + "kCurrentRecordStoreVersion <= kMaximumRecordStoreVersion"); bool shouldUseOplogHack(OperationContext* opCtx, const std::string& uri) { StatusWith<BSONObj> appMetadata = WiredTigerUtil::getApplicationMetadata(opCtx, uri); diff --git a/src/mongo/dbtests/perftests.cpp b/src/mongo/dbtests/perftests.cpp index 5021eff0558..1db307c39c9 100644 --- a/src/mongo/dbtests/perftests.cpp +++ b/src/mongo/dbtests/perftests.cpp @@ -1452,7 +1452,7 @@ public: template <bool fpInjected, bool fpEnabled> class FailPointTest : public B { public: - BOOST_STATIC_ASSERT(fpInjected || !fpEnabled); + static_assert(fpInjected || !fpEnabled, "fpInjected || !fpEnabled"); FailPointTest() : B(), _value(0) { if (fpEnabled) { diff --git a/src/mongo/logger/log_component.cpp b/src/mongo/logger/log_component.cpp index bde9b3da9d5..b33d449642c 100644 --- a/src/mongo/logger/log_component.cpp +++ b/src/mongo/logger/log_component.cpp @@ -29,7 +29,6 @@ #include "mongo/logger/log_component.h" -#include <boost/static_assert.hpp> #include "mongo/base/init.h" #include "mongo/util/assert_util.h" @@ -70,11 +69,11 @@ MONGO_INITIALIZER_WITH_PREREQUISITES(SetupDottedNames, // Children always come after parent component. // This makes it unnecessary to compute children of each component // when setting/clearing log severities in LogComponentSettings. -#define DECLARE_LOG_COMPONENT_PARENT(CHILD, PARENT) \ - case (CHILD): \ - do { \ - BOOST_STATIC_ASSERT(int(CHILD) > int(PARENT)); \ - return (PARENT); \ +#define DECLARE_LOG_COMPONENT_PARENT(CHILD, PARENT) \ + case (CHILD): \ + do { \ + static_assert(int(CHILD) > int(PARENT), "int(CHILD) > int(PARENT)"); \ + return (PARENT); \ } while (0) LogComponent LogComponent::parent() const { diff --git a/src/mongo/platform/atomic_word.h b/src/mongo/platform/atomic_word.h index cd5395c45ba..86a5b5ea323 100644 --- a/src/mongo/platform/atomic_word.h +++ b/src/mongo/platform/atomic_word.h @@ -30,7 +30,6 @@ #include <atomic> #include <type_traits> -#include <boost/static_assert.hpp> namespace mongo { @@ -150,11 +149,11 @@ private: std::atomic<WordType> _value; }; -#define _ATOMIC_WORD_DECLARE(NAME, WTYPE) \ - typedef class AtomicWord<WTYPE> NAME; \ - namespace { \ - BOOST_STATIC_ASSERT(sizeof(NAME) == sizeof(WTYPE)); \ - BOOST_STATIC_ASSERT(std::is_standard_layout<WTYPE>::value); \ +#define _ATOMIC_WORD_DECLARE(NAME, WTYPE) \ + typedef class AtomicWord<WTYPE> NAME; \ + namespace { \ + static_assert(sizeof(NAME) == sizeof(WTYPE), "sizeof(NAME) == sizeof(WTYPE)"); \ + static_assert(std::is_standard_layout<WTYPE>::value, "std::is_standard_layout<WTYPE>::value"); \ } // namespace _ATOMIC_WORD_DECLARE(AtomicUInt32, unsigned); diff --git a/src/mongo/platform/atomic_word_test.cpp b/src/mongo/platform/atomic_word_test.cpp index 76af3b67eba..8adb13722c5 100644 --- a/src/mongo/platform/atomic_word_test.cpp +++ b/src/mongo/platform/atomic_word_test.cpp @@ -29,7 +29,6 @@ #include <iostream> -#include <boost/static_assert.hpp> #include "mongo/platform/atomic_word.h" #include "mongo/unittest/unittest.h" diff --git a/src/mongo/platform/endian.h b/src/mongo/platform/endian.h index cb8e997d125..1d075642a4d 100644 --- a/src/mongo/platform/endian.h +++ b/src/mongo/platform/endian.h @@ -27,12 +27,10 @@ #pragma once -#include <boost/static_assert.hpp> -#include <boost/mpl/if.hpp> -#include <boost/type_traits/is_signed.hpp> #include <climits> #include <cstdint> #include <cstring> +#include <type_traits> #include "mongo/config.h" @@ -345,7 +343,7 @@ struct ByteOrderConverter<float> { typedef float T; inline static T nativeToBig(T t) { - BOOST_STATIC_ASSERT(sizeof(T) == sizeof(uint32_t)); + static_assert(sizeof(T) == sizeof(uint32_t), "sizeof(T) == sizeof(uint32_t)"); uint32_t temp; std::memcpy(&temp, &t, sizeof(t)); @@ -384,7 +382,7 @@ struct ByteOrderConverter<double> { typedef double T; inline static T nativeToBig(T t) { - BOOST_STATIC_ASSERT(sizeof(T) == sizeof(uint64_t)); + static_assert(sizeof(T) == sizeof(uint64_t), "sizeof(T) == sizeof(uint64_t)"); uint64_t temp; std::memcpy(&temp, &t, sizeof(t)); @@ -428,31 +426,32 @@ struct IntegralTypeMap { template <> struct IntegralTypeMap<signed char> { - BOOST_STATIC_ASSERT(CHAR_BIT == 8); + static_assert(CHAR_BIT == 8, "CHAR_BIT == 8"); typedef int8_t type; }; template <> struct IntegralTypeMap<unsigned char> { - BOOST_STATIC_ASSERT(CHAR_BIT == 8); + static_assert(CHAR_BIT == 8, "CHAR_BIT == 8"); typedef uint8_t type; }; template <> struct IntegralTypeMap<char> { - BOOST_STATIC_ASSERT(CHAR_BIT == 8); - typedef boost::mpl::if_c<boost::is_signed<char>::value, int8_t, uint8_t>::type type; + static_assert(CHAR_BIT == 8, "CHAR_BIT == 8"); + typedef std::conditional<std::is_signed<char>::value, int8_t, uint8_t>::type type; }; template <> struct IntegralTypeMap<long long> { - BOOST_STATIC_ASSERT(sizeof(long long) == sizeof(int64_t)); + static_assert(sizeof(long long) == sizeof(int64_t), "sizeof(long long) == sizeof(int64_t)"); typedef int64_t type; }; template <> struct IntegralTypeMap<unsigned long long> { - BOOST_STATIC_ASSERT(sizeof(unsigned long long) == sizeof(uint64_t)); + static_assert(sizeof(unsigned long long) == sizeof(uint64_t), + "sizeof(unsigned long long) == sizeof(uint64_t)"); typedef uint64_t type; }; diff --git a/src/mongo/platform/process_id.cpp b/src/mongo/platform/process_id.cpp index 20576c7b93c..e485c9e0878 100644 --- a/src/mongo/platform/process_id.cpp +++ b/src/mongo/platform/process_id.cpp @@ -29,14 +29,14 @@ #include "mongo/platform/process_id.h" -#include <boost/static_assert.hpp> #include <iostream> #include <sstream> #include <limits> namespace mongo { -BOOST_STATIC_ASSERT(sizeof(NativeProcessId) == sizeof(uint32_t)); +static_assert(sizeof(NativeProcessId) == sizeof(uint32_t), + "sizeof(NativeProcessId) == sizeof(uint32_t)"); namespace { #ifdef _WIN32 diff --git a/src/mongo/s/distlock_test.cpp b/src/mongo/s/distlock_test.cpp index a7542c511b3..495d804b940 100644 --- a/src/mongo/s/distlock_test.cpp +++ b/src/mongo/s/distlock_test.cpp @@ -322,8 +322,8 @@ public: (unsigned)i, seed + i, &pinger, - boost::ref(cmdObj), - boost::ref(*(results[i].get())))))); + stdx::ref(cmdObj), + stdx::ref(*(results[i].get())))))); } sleepsecs(wait / 1000); diff --git a/src/mongo/scripting/bson_template_evaluator.cpp b/src/mongo/scripting/bson_template_evaluator.cpp index 0b0a243bd00..73efc05891c 100644 --- a/src/mongo/scripting/bson_template_evaluator.cpp +++ b/src/mongo/scripting/bson_template_evaluator.cpp @@ -266,7 +266,7 @@ BsonTemplateEvaluator::Status BsonTemplateEvaluator::evalRandString(BsonTemplate "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; static const size_t alphaNumLength = sizeof(alphanum) - 1; - BOOST_STATIC_ASSERT(alphaNumLength == 64); + static_assert(alphaNumLength == 64, "alphaNumLength == 64"); int32_t currentRand = 0; std::string str; for (int i = 0; i < length; ++i, currentRand >>= 6) { diff --git a/src/mongo/stdx/functional.h b/src/mongo/stdx/functional.h index c20f6e21310..b0c6b922f99 100644 --- a/src/mongo/stdx/functional.h +++ b/src/mongo/stdx/functional.h @@ -43,7 +43,9 @@ namespace mongo { namespace stdx { using ::std::bind; // NOLINT +using ::std::cref; // NOLINT using ::std::function; // NOLINT +using ::std::ref; // NOLINT namespace placeholders = ::std::placeholders; // NOLINT } // namespace stdx @@ -53,12 +55,15 @@ namespace placeholders = ::std::placeholders; // NOLINT #include <boost/bind.hpp> #include <boost/function.hpp> +#include <boost/ref.hpp> namespace mongo { namespace stdx { using boost::bind; // NOLINT +using boost::cref; // NOLINT using boost::function; // NOLINT +using boost::ref; // NOLINT namespace placeholders { static boost::arg<1> _1; diff --git a/src/mongo/util/net/message.h b/src/mongo/util/net/message.h index e42295c5b6a..9aa548ff07b 100644 --- a/src/mongo/util/net/message.h +++ b/src/mongo/util/net/message.h @@ -208,7 +208,7 @@ private: class Value : public EncodedValueStorage<Layout, ConstView, View> { public: Value() { - BOOST_STATIC_ASSERT(sizeof(Value) == sizeof(Layout)); + static_assert(sizeof(Value) == sizeof(Layout), "sizeof(Value) == sizeof(Layout)"); } Value(ZeroInitTag_t zit) : EncodedValueStorage<Layout, ConstView, View>(zit) {} @@ -324,7 +324,7 @@ private: class Value : public EncodedValueStorage<Layout, ConstView, View> { public: Value() { - BOOST_STATIC_ASSERT(sizeof(Value) == sizeof(Layout)); + static_assert(sizeof(Value) == sizeof(Layout), "sizeof(Value) == sizeof(Layout)"); } Value(ZeroInitTag_t zit) : EncodedValueStorage<Layout, ConstView, View>(zit) {} diff --git a/src/mongo/util/net/sock_test.cpp b/src/mongo/util/net/sock_test.cpp index e294bb1b738..998fba6a3af 100644 --- a/src/mongo/util/net/sock_test.cpp +++ b/src/mongo/util/net/sock_test.cpp @@ -146,12 +146,12 @@ SocketPair socketPair(const int type, const int protocol) { Notification accepted; SOCKET acceptSock = INVALID_SOCKET; stdx::thread acceptor( - stdx::bind(&detail::awaitAccept, &acceptSock, listenSock, boost::ref(accepted))); + stdx::bind(&detail::awaitAccept, &acceptSock, listenSock, stdx::ref(accepted))); Notification connected; SOCKET connectSock = INVALID_SOCKET; stdx::thread connector( - stdx::bind(&detail::awaitConnect, &connectSock, *connectRes, boost::ref(connected))); + stdx::bind(&detail::awaitConnect, &connectSock, *connectRes, stdx::ref(connected))); connected.waitToBeNotified(); connector.join(); diff --git a/src/mongo/util/safe_num.cpp b/src/mongo/util/safe_num.cpp index c29422cf81b..8976f27a251 100644 --- a/src/mongo/util/safe_num.cpp +++ b/src/mongo/util/safe_num.cpp @@ -26,7 +26,6 @@ */ #include <sstream> -#include <boost/static_assert.hpp> #include "mongo/platform/basic.h" #undef MONGO_PCH_WHITELISTED // for malloc/realloc/INFINITY pulled from bson @@ -182,7 +181,7 @@ SafeNum addInt32Int32(int lInt32, int rInt32) { // otherwise, we retain the 64-bit result. // This algorithm is only correct if sizeof(long long) > sizeof(int) - BOOST_STATIC_ASSERT(sizeof(long long) > sizeof(int)); + static_assert(sizeof(long long) > sizeof(int), "sizeof(long long) > sizeof(int)"); const long long int result = static_cast<long long int>(lInt32) + static_cast<long long int>(rInt32); @@ -226,7 +225,7 @@ SafeNum mulInt32Int32(int lInt32, int rInt32) { // otherwise, we retain the 64-bit result. // This algorithm is only correct if sizeof(long long) >= (2 * sizeof(int)) - BOOST_STATIC_ASSERT(sizeof(long long) >= (2 * sizeof(int))); + static_assert(sizeof(long long) >= (2 * sizeof(int)), "sizeof(long long) >= (2 * sizeof(int))"); const long long int result = static_cast<long long int>(lInt32) * static_cast<long long int>(rInt32); diff --git a/src/mongo/util/unowned_ptr.h b/src/mongo/util/unowned_ptr.h index 445e577fded..fd7ef04157b 100644 --- a/src/mongo/util/unowned_ptr.h +++ b/src/mongo/util/unowned_ptr.h @@ -28,7 +28,6 @@ #pragma once -#include <boost/static_assert.hpp> #include <memory> #include <type_traits> |