diff --git a/fdbclient/DatabaseConfiguration.cpp b/fdbclient/DatabaseConfiguration.cpp index b6fe21a106..0bc0fd6d22 100644 --- a/fdbclient/DatabaseConfiguration.cpp +++ b/fdbclient/DatabaseConfiguration.cpp @@ -63,7 +63,7 @@ void parse( std::vector* regions, ValueRef const& v ) { RegionInfo info; json_spirit::mArray datacenters; dc.get("datacenters", datacenters); - bool nonSatelliteDatacenters = 0; + int nonSatelliteDatacenters = 0; for (StatusObjectReader s : datacenters) { std::string idStr; if (s.has("satellite") && s.last().get_int() == 1) { diff --git a/fdbserver/OldTLogServer.actor.cpp b/fdbserver/OldTLogServer.actor.cpp index b0d92885b7..2ac0e7d83c 100644 --- a/fdbserver/OldTLogServer.actor.cpp +++ b/fdbserver/OldTLogServer.actor.cpp @@ -1014,7 +1014,7 @@ namespace oldTLog { state Reference logData; loop { - bool foundCount = 0; + int foundCount = 0; for(auto it : self->id_data) { if(!it.second->stopped) { logData = it.second; @@ -1023,7 +1023,7 @@ namespace oldTLog { } ASSERT(foundCount < 2); - if(!foundCount) { + if(foundCount == 0) { wait( self->newLogData.onTrigger() ); continue; } diff --git a/fdbserver/PrefixTree.h b/fdbserver/PrefixTree.h index 3c261d1029..2f67c20ccd 100644 --- a/fdbserver/PrefixTree.h +++ b/fdbserver/PrefixTree.h @@ -32,8 +32,8 @@ static inline int commonPrefixLength(uint8_t const* ap, uint8_t const* bp, int c const int wordEnd = cl - sizeof(Word) + 1; for(; i < wordEnd; i += sizeof(Word)) { - register Word a = *(Word *)ap; - register Word b = *(Word *)bp; + Word a = *(Word *)ap; + Word b = *(Word *)bp; if(a != b) { return i + ctzll(a ^ b) / 8; } @@ -238,14 +238,14 @@ struct PrefixTree { void init(const Node *n) { node = n; - register union { + union { const uint8_t *p8; const uint16_t *p16; }; p8 = (const uint8_t *)&n->flags + 1; - register int flags = n->flags; - register bool large = flags & USE_LARGE_LENGTHS; + int flags = n->flags; + bool large = flags & USE_LARGE_LENGTHS; prefixLen = large ? *p16++ : *p8++; @@ -265,7 +265,7 @@ struct PrefixTree { if(flags & HAS_VALUE) rightPos += (large ? *p16++ : *p8++); - register int header = 2; // flags byte, first prefix len byte + int header = 2; // flags byte, first prefix len byte if(large) ++header; // second prefix len byte if(flags & HAS_SPLIT) diff --git a/fdbserver/tester.actor.cpp b/fdbserver/tester.actor.cpp index 9fbbbd49d2..49eae1b034 100644 --- a/fdbserver/tester.actor.cpp +++ b/fdbserver/tester.actor.cpp @@ -394,7 +394,7 @@ void sendResult( ReplyPromise& reply, Optional> const& result ) { } ACTOR Future runWorkloadAsync( Database cx, WorkloadInterface workIface, TestWorkload *workload, double databasePingDelay ) { - state auto_ptr delw(workload); + state unique_ptr delw(workload); state Optional> setupResult; state Optional> startResult; state Optional> checkResult; diff --git a/fdbservice/ThreadPool.h b/fdbservice/ThreadPool.h index f5fb3282b6..1064232cdf 100644 --- a/fdbservice/ThreadPool.h +++ b/fdbservice/ThreadPool.h @@ -52,7 +52,7 @@ public: T *object, ULONG flags = WT_EXECUTELONGFUNCTION) { typedef std::pair CallbackType; - std::auto_ptr p(new CallbackType(function, object)); + std::unique_ptr p(new CallbackType(function, object)); if (::QueueUserWorkItem(ThreadProc, p.get(), flags)) { @@ -72,9 +72,9 @@ private: { typedef std::pair CallbackType; - std::auto_ptr p(static_cast(context)); + std::unique_ptr p(static_cast(context)); (p->second->*p->first)(); return 0; } -}; \ No newline at end of file +}; diff --git a/flow/Deque.h b/flow/Deque.h index 7b224397ab..9a10e3fadb 100644 --- a/flow/Deque.h +++ b/flow/Deque.h @@ -103,11 +103,13 @@ public: end++; } - template - void emplace_back(U && val) { + template + reference emplace_back(U&&... val) { if (full()) grow(); - new (&arr[end&mask]) T(std::forward(val)); + new (&arr[end&mask]) T(std::forward(val)...); + reference result = arr[end & mask]; end++; + return result; } void pop_back() { @@ -181,4 +183,4 @@ private: } }; -#endif \ No newline at end of file +#endif diff --git a/flow/IndexedSet.cpp b/flow/IndexedSet.cpp index 60b70be0a5..905ad2cf83 100644 --- a/flow/IndexedSet.cpp +++ b/flow/IndexedSet.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include "flow/UnitTest.h" template @@ -383,11 +384,12 @@ TEST_CASE("/flow/IndexedSet/comparison to std::set") { TEST_CASE("/flow/IndexedSet/all numbers") { IndexedSet is; + std::mt19937_64 urng(g_random->randomUInt32()); std::vector allNumbers; for (int i = 0; i<1000000; i++) allNumbers.push_back(i); - std::random_shuffle(allNumbers.begin(), allNumbers.end()); + std::shuffle(allNumbers.begin(), allNumbers.end(), urng); for (int i = 0; i