mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 20:32:35 -03:00
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.
This commit is contained in:
parent
b837b334db
commit
ff9c671b11
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue