From ff9c671b11d40e5d0623eff3dd12e48cbaafb34e Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 1 Oct 2019 14:00:46 +0200 Subject: refactor: Work around GCC 9 `-Wredundant-move` warning Use std::move workaround for unique_ptr, for when the C++ compiler lacks a fix for this issue: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1579 Do this in a way that avoids a GCC 9 `-Wredundant-move` warning. --- src/interfaces/chain.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/interfaces') diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index 643bb58d56..5a3420349f 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -236,11 +236,10 @@ public: explicit ChainImpl(NodeContext& node) : m_node(node) {} std::unique_ptr lock(bool try_lock) override { - auto result = MakeUnique(::cs_main, "cs_main", __FILE__, __LINE__, try_lock); - if (try_lock && result && !*result) return {}; - // std::move necessary on some compilers due to conversion from - // LockImpl to Lock pointer - return std::move(result); + auto lock = MakeUnique(::cs_main, "cs_main", __FILE__, __LINE__, try_lock); + if (try_lock && lock && !*lock) return {}; + std::unique_ptr result = std::move(lock); // Temporary to avoid CWG 1579 + return result; } bool findBlock(const uint256& hash, CBlock* block, int64_t* time, int64_t* time_max) override { -- cgit v1.2.3