diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2019-10-01 14:00:46 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-02-06 13:43:15 +0100 |
commit | ff9c671b11d40e5d0623eff3dd12e48cbaafb34e (patch) | |
tree | 1c33de1b0b1c8420df5046e56cb3a631b7b0396b /src/interfaces | |
parent | b837b334db5dd6232725fd2350928ff4fbd3feee (diff) | |
download | bitcoin-ff9c671b11d40e5d0623eff3dd12e48cbaafb34e.tar.xz |
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.
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/chain.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
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<Chain::Lock> lock(bool try_lock) override { - auto result = MakeUnique<LockImpl>(::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<LockImpl>(::cs_main, "cs_main", __FILE__, __LINE__, try_lock); + if (try_lock && lock && !*lock) return {}; + std::unique_ptr<Chain::Lock> 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 { |