diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-03-27 19:54:49 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-03-27 20:04:46 +0100 |
commit | f2c416bcf5f898dd996106871dbbd7051851ccac (patch) | |
tree | 08a5302915dddef956f6fe35809a35a96947565d /src/interfaces/chain.cpp | |
parent | 210b533a114462473024c92a20a0765001abd45d (diff) | |
parent | ff9c671b11d40e5d0623eff3dd12e48cbaafb34e (diff) |
Merge #16995: Fix gcc 9 warnings
ff9c671b11d40e5d0623eff3dd12e48cbaafb34e refactor: Work around GCC 9 `-Wredundant-move` warning (Russell Yanofsky)
b837b334db5dd6232725fd2350928ff4fbd3feee net: Fail instead of truncate command name in CMessageHeader (Wladimir J. van der Laan)
Pull request description:
Fixes all 3 from #16992 (see commits)
- net: Fail instead of truncate command name in CMessageHeader
- refactor: Use std::move workaround for unique_ptr upcast only when necessary
ACKs for top commit:
practicalswift:
ACK ff9c671b11d40e5d0623eff3dd12e48cbaafb34e -- patch looks correct
sipa:
utACK ff9c671b11d40e5d0623eff3dd12e48cbaafb34e
ryanofsky:
Code review ACK ff9c671b11d40e5d0623eff3dd12e48cbaafb34e. Looks good and seems to pass travis, modulo a timeout on one build
hebasto:
ACK ff9c671b11d40e5d0623eff3dd12e48cbaafb34e, tested on Fedora 31:
Tree-SHA512: 52d8c13aaf0d56f9bc546a98d7f853eae21f7e325b202fdeb2286b19a9a0ee308634c644b039f60ad8043421e382381cbf1bce58d9f807547f928621c7d245d0
Diffstat (limited to 'src/interfaces/chain.cpp')
-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 9dc0d37cd9..775a89f4cf 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -234,11 +234,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 { |