From 5bd3bab012ee5b5771f95a9ecfea47b6e75e0802 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Mon, 15 May 2017 18:23:54 -0700 Subject: [PATCH] Switch implicit references of folly::make_unique to std::make_unique Summary: It's *almost* dead. This switches things to explicitly reference `std::make_unique` so that `folly::make_unique` can be marked as deprecated until mobile catches up and it can be killed completely. Reviewed By: yfeldblum Differential Revision: D5026584 fbshipit-source-id: aefc8cb3de84583fd3722fdb9dfea620884590c5 --- folly/experimental/EnvUtil.h | 2 +- folly/experimental/JSONSchema.cpp | 63 ++++---- .../observer/detail/ObserverManager.cpp | 4 +- folly/experimental/symbolizer/Symbolizer.cpp | 2 +- folly/experimental/test/EnvUtilTest.cpp | 6 +- folly/fibers/FiberManagerMap.cpp | 5 +- folly/futures/test/FutureSplitterTest.cpp | 2 +- folly/gen/test/ParallelMapTest.cpp | 48 +++--- folly/io/Compression.cpp | 18 +-- folly/io/Cursor.h | 2 +- folly/io/IOBuf.cpp | 16 +- folly/io/async/EventBaseThread.cpp | 2 +- folly/io/async/test/EventBaseTest.cpp | 2 +- folly/io/test/CompressionTest.cpp | 2 +- folly/test/MPMCQueueTest.cpp | 141 +++++++----------- 15 files changed, 148 insertions(+), 167 deletions(-) diff --git a/folly/experimental/EnvUtil.h b/folly/experimental/EnvUtil.h index 3ab3b16a..2d22f298 100644 --- a/folly/experimental/EnvUtil.h +++ b/folly/experimental/EnvUtil.h @@ -98,7 +98,7 @@ namespace test { // of its destruction. struct EnvVarSaver { EnvVarSaver() - : state_(make_unique( + : state_(std::make_unique( experimental::EnvironmentState::fromCurrentEnvironment())) {} EnvVarSaver(EnvVarSaver&& other) noexcept : state_(std::move(other.state_)) {} diff --git a/folly/experimental/JSONSchema.cpp b/folly/experimental/JSONSchema.cpp index f559a545..863f4107 100644 --- a/folly/experimental/JSONSchema.cpp +++ b/folly/experimental/JSONSchema.cpp @@ -117,7 +117,7 @@ struct SchemaValidator final : IValidator, public Validator { // We break apart the constructor and actually loading the schema so that // we can handle the case where a schema refers to itself, e.g. via // "$ref": "#". - auto v = make_unique(); + auto v = std::make_unique(); v->loadSchema(context, schema); return v; } @@ -667,7 +667,7 @@ void SchemaValidator::loadSchema(SchemaValidatorContext& context, if (p->isString() && p->stringPiece()[0] == '#') { auto it = context.refs.find(p->getString()); if (it != context.refs.end()) { - validators_.emplace_back(make_unique(it->second)); + validators_.emplace_back(std::make_unique(it->second)); return; } @@ -704,7 +704,7 @@ void SchemaValidator::loadSchema(SchemaValidatorContext& context, // future references to it will just see that pointer and won't try to // keep parsing further. if (s) { - auto v = make_unique(); + auto v = std::make_unique(); context.refs[p->getString()] = v.get(); v->loadSchema(context, *s); validators_.emplace_back(std::move(v)); @@ -715,34 +715,34 @@ void SchemaValidator::loadSchema(SchemaValidatorContext& context, // Numeric validators if (const auto* p = schema.get_ptr("multipleOf")) { - validators_.emplace_back(make_unique(*p)); + validators_.emplace_back(std::make_unique(*p)); } if (const auto* p = schema.get_ptr("maximum")) { - validators_.emplace_back( - make_unique(*p, - schema.get_ptr("exclusiveMaximum"), - ComparisonValidator::Type::MAX)); + validators_.emplace_back(std::make_unique( + *p, + schema.get_ptr("exclusiveMaximum"), + ComparisonValidator::Type::MAX)); } if (const auto* p = schema.get_ptr("minimum")) { - validators_.emplace_back( - make_unique(*p, - schema.get_ptr("exclusiveMinimum"), - ComparisonValidator::Type::MIN)); + validators_.emplace_back(std::make_unique( + *p, + schema.get_ptr("exclusiveMinimum"), + ComparisonValidator::Type::MIN)); } // String validators if (const auto* p = schema.get_ptr("maxLength")) { validators_.emplace_back( - make_unique>>( + std::make_unique>>( *p, dynamic::Type::STRING)); } if (const auto* p = schema.get_ptr("minLength")) { validators_.emplace_back( - make_unique>>( + std::make_unique>>( *p, dynamic::Type::STRING)); } if (const auto* p = schema.get_ptr("pattern")) { - validators_.emplace_back(make_unique(*p)); + validators_.emplace_back(std::make_unique(*p)); } // Array validators @@ -750,20 +750,20 @@ void SchemaValidator::loadSchema(SchemaValidatorContext& context, const auto* additionalItems = schema.get_ptr("additionalItems"); if (items || additionalItems) { validators_.emplace_back( - make_unique(context, items, additionalItems)); + std::make_unique(context, items, additionalItems)); } if (const auto* p = schema.get_ptr("maxItems")) { validators_.emplace_back( - make_unique>>( + std::make_unique>>( *p, dynamic::Type::ARRAY)); } if (const auto* p = schema.get_ptr("minItems")) { validators_.emplace_back( - make_unique>>( + std::make_unique>>( *p, dynamic::Type::ARRAY)); } if (const auto* p = schema.get_ptr("uniqueItems")) { - validators_.emplace_back(make_unique(*p)); + validators_.emplace_back(std::make_unique(*p)); } // Object validators @@ -771,46 +771,47 @@ void SchemaValidator::loadSchema(SchemaValidatorContext& context, const auto* patternProperties = schema.get_ptr("patternProperties"); const auto* additionalProperties = schema.get_ptr("additionalProperties"); if (properties || patternProperties || additionalProperties) { - validators_.emplace_back(make_unique( + validators_.emplace_back(std::make_unique( context, properties, patternProperties, additionalProperties)); } if (const auto* p = schema.get_ptr("maxProperties")) { validators_.emplace_back( - make_unique>>( + std::make_unique>>( *p, dynamic::Type::OBJECT)); } if (const auto* p = schema.get_ptr("minProperties")) { validators_.emplace_back( - make_unique>>( + std::make_unique>>( *p, dynamic::Type::OBJECT)); } if (const auto* p = schema.get_ptr("required")) { - validators_.emplace_back(make_unique(*p)); + validators_.emplace_back(std::make_unique(*p)); } // Misc validators if (const auto* p = schema.get_ptr("dependencies")) { - validators_.emplace_back(make_unique(context, *p)); + validators_.emplace_back( + std::make_unique(context, *p)); } if (const auto* p = schema.get_ptr("enum")) { - validators_.emplace_back(make_unique(*p)); + validators_.emplace_back(std::make_unique(*p)); } if (const auto* p = schema.get_ptr("type")) { - validators_.emplace_back(make_unique(*p)); + validators_.emplace_back(std::make_unique(*p)); } if (const auto* p = schema.get_ptr("allOf")) { - validators_.emplace_back(make_unique(context, *p)); + validators_.emplace_back(std::make_unique(context, *p)); } if (const auto* p = schema.get_ptr("anyOf")) { - validators_.emplace_back(make_unique( + validators_.emplace_back(std::make_unique( context, *p, AnyOfValidator::Type::ONE_OR_MORE)); } if (const auto* p = schema.get_ptr("oneOf")) { - validators_.emplace_back(make_unique( + validators_.emplace_back(std::make_unique( context, *p, AnyOfValidator::Type::EXACTLY_ONE)); } if (const auto* p = schema.get_ptr("not")) { - validators_.emplace_back(make_unique(context, *p)); + validators_.emplace_back(std::make_unique(context, *p)); } } @@ -1014,7 +1015,7 @@ folly::Singleton schemaValidator([]() { Validator::~Validator() = default; std::unique_ptr makeValidator(const dynamic& schema) { - auto v = make_unique(); + auto v = std::make_unique(); SchemaValidatorContext context(schema); context.refs["#"] = v.get(); v->loadSchema(context, schema); diff --git a/folly/experimental/observer/detail/ObserverManager.cpp b/folly/experimental/observer/detail/ObserverManager.cpp index f909ef57..88372ad6 100644 --- a/folly/experimental/observer/detail/ObserverManager.cpp +++ b/folly/experimental/observer/detail/ObserverManager.cpp @@ -166,8 +166,8 @@ class ObserverManager::NextQueue { }; ObserverManager::ObserverManager() { - currentQueue_ = make_unique(); - nextQueue_ = make_unique(*this); + currentQueue_ = std::make_unique(); + nextQueue_ = std::make_unique(*this); } ObserverManager::~ObserverManager() { diff --git a/folly/experimental/symbolizer/Symbolizer.cpp b/folly/experimental/symbolizer/Symbolizer.cpp index f199594a..25d367c6 100644 --- a/folly/experimental/symbolizer/Symbolizer.cpp +++ b/folly/experimental/symbolizer/Symbolizer.cpp @@ -385,7 +385,7 @@ StackTracePrinter::StackTracePrinter(size_t minSignalSafeElfCacheSize, int fd) fd, SymbolizePrinter::COLOR_IF_TTY, size_t(64) << 10), // 64KiB - addresses_(make_unique>()) {} + addresses_(std::make_unique>()) {} void StackTracePrinter::flush() { printer_.flush(); diff --git a/folly/experimental/test/EnvUtilTest.cpp b/folly/experimental/test/EnvUtilTest.cpp index bcac455d..d622e19d 100644 --- a/folly/experimental/test/EnvUtilTest.cpp +++ b/folly/experimental/test/EnvUtilTest.cpp @@ -45,7 +45,7 @@ TEST(EnvVarSaverTest, ExampleNew) { PCHECK(0 == unsetenv(key)); EXPECT_EQ(nullptr, getenv(key)); - auto saver = make_unique(); + auto saver = std::make_unique(); PCHECK(0 == setenv(key, "blah", true)); EXPECT_STREQ("blah", getenv(key)); saver = nullptr; @@ -57,7 +57,7 @@ TEST(EnvVarSaverTest, ExampleExisting) { EXPECT_NE(nullptr, getenv(key)); auto value = std::string{getenv(key)}; - auto saver = make_unique(); + auto saver = std::make_unique(); PCHECK(0 == setenv(key, "blah", true)); EXPECT_STREQ("blah", getenv(key)); saver = nullptr; @@ -180,7 +180,7 @@ TEST(EnvVarSaverTest, ExampleDeleting) { EXPECT_NE(nullptr, getenv(key)); auto value = std::string{getenv(key)}; - auto saver = make_unique(); + auto saver = std::make_unique(); PCHECK(0 == unsetenv(key)); EXPECT_EQ(nullptr, getenv(key)); saver = nullptr; diff --git a/folly/fibers/FiberManagerMap.cpp b/folly/fibers/FiberManagerMap.cpp index 5e2eebca..a4d75bf8 100644 --- a/folly/fibers/FiberManagerMap.cpp +++ b/folly/fibers/FiberManagerMap.cpp @@ -63,11 +63,12 @@ class GlobalCache { auto& fmPtrRef = map_[&evb]; if (!fmPtrRef) { - auto loopController = make_unique(); + auto loopController = std::make_unique(); loopController->attachEventBase(evb); evb.runOnDestruction(new EventBaseOnDestructionCallback(evb)); - fmPtrRef = make_unique(std::move(loopController), opts); + fmPtrRef = + std::make_unique(std::move(loopController), opts); } return *fmPtrRef; diff --git a/folly/futures/test/FutureSplitterTest.cpp b/folly/futures/test/FutureSplitterTest.cpp index 927a2d40..53c2879a 100644 --- a/folly/futures/test/FutureSplitterTest.cpp +++ b/folly/futures/test/FutureSplitterTest.cpp @@ -108,7 +108,7 @@ TEST(FutureSplitter, splitFutureMoveAssignable) { TEST(FutureSplitter, splitFutureScope) { Promise p; - auto pSP = make_unique>(p.getFuture()); + auto pSP = std::make_unique>(p.getFuture()); auto f1 = pSP->getFuture(); EXPECT_FALSE(f1.isReady()); pSP.reset(); diff --git a/folly/gen/test/ParallelMapTest.cpp b/folly/gen/test/ParallelMapTest.cpp index dcfc7e1f..435a348e 100644 --- a/folly/gen/test/ParallelMapTest.cpp +++ b/folly/gen/test/ParallelMapTest.cpp @@ -100,20 +100,22 @@ TEST(Pmap, Rvalues) { // apply { auto mapResult - = seq(1) - | map([](int x) { return make_unique(x); }) - | map([](std::unique_ptr x) { return make_unique(*x * *x); }) - | map([](std::unique_ptr x) { return *x; }) - | take(1000) - | sum; + = seq(1) + | map([](int x) { return std::make_unique(x); }) + | map([](std::unique_ptr x) { + return std::make_unique(*x * *x); }) + | map([](std::unique_ptr x) { return *x; }) + | take(1000) + | sum; auto pmapResult - = seq(1) - | pmap([](int x) { return make_unique(x); }) - | pmap([](std::unique_ptr x) { return make_unique(*x * *x); }) - | pmap([](std::unique_ptr x) { return *x; }) - | take(1000) - | sum; + = seq(1) + | pmap([](int x) { return std::make_unique(x); }) + | pmap([](std::unique_ptr x) { + return std::make_unique(*x * *x); }) + | pmap([](std::unique_ptr x) { return *x; }) + | take(1000) + | sum; EXPECT_EQ(pmapResult, mapResult); } @@ -121,18 +123,20 @@ TEST(Pmap, Rvalues) { // foreach { auto mapResult - = seq(1, 1000) - | map([](int x) { return make_unique(x); }) - | map([](std::unique_ptr x) { return make_unique(*x * *x); }) - | map([](std::unique_ptr x) { return *x; }) - | sum; + = seq(1, 1000) + | map([](int x) { return std::make_unique(x); }) + | map([](std::unique_ptr x) { + return std::make_unique(*x * *x); }) + | map([](std::unique_ptr x) { return *x; }) + | sum; auto pmapResult - = seq(1, 1000) - | pmap([](int x) { return make_unique(x); }) - | pmap([](std::unique_ptr x) { return make_unique(*x * *x); }) - | pmap([](std::unique_ptr x) { return *x; }) - | sum; + = seq(1, 1000) + | pmap([](int x) { return std::make_unique(x); }) + | pmap([](std::unique_ptr x) { + return std::make_unique(*x * *x); }) + | pmap([](std::unique_ptr x) { return *x; }) + | sum; EXPECT_EQ(pmapResult, mapResult); } diff --git a/folly/io/Compression.cpp b/folly/io/Compression.cpp index 985c18db..ba941032 100644 --- a/folly/io/Compression.cpp +++ b/folly/io/Compression.cpp @@ -194,7 +194,7 @@ class NoCompressionCodec final : public Codec { }; std::unique_ptr NoCompressionCodec::create(int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } NoCompressionCodec::NoCompressionCodec(int level, CodecType type) @@ -323,7 +323,7 @@ class LZ4Codec final : public Codec { }; std::unique_ptr LZ4Codec::create(int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } LZ4Codec::LZ4Codec(int level, CodecType type) : Codec(type) { @@ -468,7 +468,7 @@ class LZ4FrameCodec final : public Codec { /* static */ std::unique_ptr LZ4FrameCodec::create( int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } static constexpr uint32_t kLZ4FrameMagicLE = 0x184D2204; @@ -666,7 +666,7 @@ class SnappyCodec final : public Codec { }; std::unique_ptr SnappyCodec::create(int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } SnappyCodec::SnappyCodec(int level, CodecType type) : Codec(type) { @@ -820,7 +820,7 @@ bool ZlibCodec::canUncompress(const IOBuf* data, Optional) const { } std::unique_ptr ZlibCodec::create(int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } ZlibCodec::ZlibCodec(int level, CodecType type) : Codec(type) { @@ -1109,7 +1109,7 @@ bool LZMA2Codec::canUncompress(const IOBuf* data, Optional) const { } std::unique_ptr LZMA2Codec::create(int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } LZMA2Codec::LZMA2Codec(int level, CodecType type) : Codec(type) { @@ -1353,7 +1353,7 @@ bool ZSTDCodec::canUncompress(const IOBuf* data, Optional) const { } std::unique_ptr ZSTDCodec::create(int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } ZSTDCodec::ZSTDCodec(int level, CodecType type) : Codec(type) { @@ -1568,7 +1568,7 @@ class Bzip2Codec final : public Codec { /* static */ std::unique_ptr Bzip2Codec::create( int level, CodecType type) { - return make_unique(level, type); + return std::make_unique(level, type); } Bzip2Codec::Bzip2Codec(int level, CodecType type) : Codec(type) { @@ -1817,7 +1817,7 @@ void AutomaticCodec::addCodecIfSupported(CodecType type) { /* static */ std::unique_ptr AutomaticCodec::create( std::vector> customCodecs) { - return make_unique(std::move(customCodecs)); + return std::make_unique(std::move(customCodecs)); } AutomaticCodec::AutomaticCodec(std::vector> customCodecs) diff --git a/folly/io/Cursor.h b/folly/io/Cursor.h index 5a8a32a6..ff9082b0 100644 --- a/folly/io/Cursor.h +++ b/folly/io/Cursor.h @@ -439,7 +439,7 @@ class CursorBase { size_t cloneAtMost(std::unique_ptr& buf, size_t len) { if (!buf) { - buf = make_unique(); + buf = std::make_unique(); } return cloneAtMost(*buf, len); } diff --git a/folly/io/IOBuf.cpp b/folly/io/IOBuf.cpp index 571e772d..c34b5f41 100644 --- a/folly/io/IOBuf.cpp +++ b/folly/io/IOBuf.cpp @@ -258,7 +258,7 @@ unique_ptr IOBuf::createCombined(uint64_t capacity) { } unique_ptr IOBuf::createSeparate(uint64_t capacity) { - return make_unique(CREATE, capacity); + return std::make_unique(CREATE, capacity); } unique_ptr IOBuf::createChain( @@ -309,9 +309,9 @@ unique_ptr IOBuf::takeOwnership(void* buf, uint64_t capacity, // // Note that we always pass freeOnError as false to the constructor. // If the constructor throws we'll handle it below. (We have to handle - // allocation failures from make_unique too.) - return make_unique(TAKE_OWNERSHIP, buf, capacity, length, - freeFn, userData, false); + // allocation failures from std::make_unique too.) + return std::make_unique( + TAKE_OWNERSHIP, buf, capacity, length, freeFn, userData, false); } catch (...) { takeOwnershipError(freeOnError, buf, freeFn, userData); throw; @@ -332,7 +332,7 @@ IOBuf::IOBuf(WrapBufferOp op, ByteRange br) } unique_ptr IOBuf::wrapBuffer(const void* buf, uint64_t capacity) { - return make_unique(WRAP_BUFFER, buf, capacity); + return std::make_unique(WRAP_BUFFER, buf, capacity); } IOBuf IOBuf::wrapBufferAsValue(const void* buf, uint64_t capacity) { @@ -506,15 +506,15 @@ void IOBuf::prependChain(unique_ptr&& iobuf) { } unique_ptr IOBuf::clone() const { - return make_unique(cloneAsValue()); + return std::make_unique(cloneAsValue()); } unique_ptr IOBuf::cloneOne() const { - return make_unique(cloneOneAsValue()); + return std::make_unique(cloneOneAsValue()); } unique_ptr IOBuf::cloneCoalesced() const { - return make_unique(cloneCoalescedAsValue()); + return std::make_unique(cloneCoalescedAsValue()); } IOBuf IOBuf::cloneAsValue() const { diff --git a/folly/io/async/EventBaseThread.cpp b/folly/io/async/EventBaseThread.cpp index 5adfe52a..4b74ed03 100644 --- a/folly/io/async/EventBaseThread.cpp +++ b/folly/io/async/EventBaseThread.cpp @@ -51,7 +51,7 @@ void EventBaseThread::start() { if (th_) { return; } - th_ = make_unique(ebm_); + th_ = std::make_unique(ebm_); } void EventBaseThread::stop() { diff --git a/folly/io/async/test/EventBaseTest.cpp b/folly/io/async/test/EventBaseTest.cpp index ce1c6c77..8a7f86c0 100644 --- a/folly/io/async/test/EventBaseTest.cpp +++ b/folly/io/async/test/EventBaseTest.cpp @@ -1189,7 +1189,7 @@ TEST(EventBaseTest, RunInEventBaseThreadAndWait) { vector>> atoms(c); for (size_t i = 0; i < c; ++i) { auto& atom = atoms.at(i); - atom = make_unique>(0); + atom = std::make_unique>(0); } vector threads; for (size_t i = 0; i < c; ++i) { diff --git a/folly/io/test/CompressionTest.cpp b/folly/io/test/CompressionTest.cpp index 6d12f57c..42296974 100644 --- a/folly/io/test/CompressionTest.cpp +++ b/folly/io/test/CompressionTest.cpp @@ -488,7 +488,7 @@ namespace { class CustomCodec : public Codec { public: static std::unique_ptr create(std::string prefix, CodecType type) { - return make_unique(std::move(prefix), type); + return std::make_unique(std::move(prefix), type); } explicit CustomCodec(std::string prefix, CodecType type) : Codec(CodecType::USER_DEFINED), diff --git a/folly/test/MPMCQueueTest.cpp b/folly/test/MPMCQueueTest.cpp index f556ebbf..f2467eda 100644 --- a/folly/test/MPMCQueueTest.cpp +++ b/folly/test/MPMCQueueTest.cpp @@ -482,18 +482,16 @@ void runMtProdConsDeterministic(long seed) { // we use the Bench method, but perf results are meaningless under DSched DSched sched(DSched::uniform(seed)); - vector>>> callers; - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>(milliseconds(1))); - callers.emplace_back(make_unique>>(seconds(2))); + using QueueType = MPMCQueue; + + vector>> callers; + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back( + std::make_unique>(milliseconds(1))); + callers.emplace_back( + std::make_unique>(seconds(2))); size_t cap; for (const auto& caller : callers) { @@ -562,18 +560,16 @@ void runMtProdConsDeterministicDynamic( // we use the Bench method, but perf results are meaningless under DSched DSched sched(DSched::uniform(seed)); - vector>>> callers; - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>(milliseconds(1))); - callers.emplace_back(make_unique>>(seconds(2))); + using QueueType = MPMCQueue; + + vector>> callers; + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back( + std::make_unique>(milliseconds(1))); + callers.emplace_back( + std::make_unique>(seconds(2))); for (const auto& caller : callers) { LOG(INFO) << @@ -628,39 +624,29 @@ TEST(MPMCQueue, mt_prod_cons_deterministic_dynamic_with_arguments) { template void runMtProdCons() { + using QueueType = MPMCQueue; + int n = 100000; setFromEnv(n, "NUM_OPS"); - vector>>> + vector>> callers; - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>(milliseconds(1))); - callers.emplace_back(make_unique>>(seconds(2))); + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back( + std::make_unique>(milliseconds(1))); + callers.emplace_back( + std::make_unique>(seconds(2))); for (const auto& caller : callers) { - LOG(INFO) << PC_BENCH((MPMCQueue(10)), - 1, 1, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(10)), - 10, 1, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(10)), - 1, 10, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(10)), - 10, 10, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(10000)), - 1, 1, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(10000)), - 10, 1, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(10000)), - 1, 10, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(10000)), - 10, 10, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue(100000)), - 32, 100, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 1, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 10, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 1, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 10, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(100000)), 32, 100, n, *caller); } } @@ -674,38 +660,27 @@ TEST(MPMCQueue, mt_prod_cons_dynamic) { template void runMtProdConsEmulatedFutex() { + using QueueType = MPMCQueue; + int n = 100000; - vector>>> callers; - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>()); - callers.emplace_back(make_unique>>(milliseconds(1))); - callers.emplace_back(make_unique>>(seconds(2))); + vector>> callers; + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back(std::make_unique>()); + callers.emplace_back( + std::make_unique>(milliseconds(1))); + callers.emplace_back( + std::make_unique>(seconds(2))); for (const auto& caller : callers) { - LOG(INFO) << PC_BENCH( - (MPMCQueue(10)), 1, 1, n, *caller); - LOG(INFO) << PC_BENCH( - (MPMCQueue(10)), 10, 1, n, *caller); - LOG(INFO) << PC_BENCH( - (MPMCQueue(10)), 1, 10, n, *caller); - LOG(INFO) << PC_BENCH( - (MPMCQueue(10)), 10, 10, n, *caller); - LOG(INFO) << PC_BENCH( - (MPMCQueue(10000)), 1, 1, n, *caller); - LOG(INFO) << PC_BENCH( - (MPMCQueue(10000)), 10, 1, n, *caller); - LOG(INFO) << PC_BENCH( - (MPMCQueue(10000)), 1, 10, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue - (10000)), 10, 10, n, *caller); - LOG(INFO) << PC_BENCH((MPMCQueue - (100000)), 32, 100, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 1, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 10, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 1, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10)), 10, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 1, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 10, n, *caller); + LOG(INFO) << PC_BENCH((QueueType(100000)), 32, 100, n, *caller); } } -- 2.34.1