Skip to content

Code quality nit: Fix a G++ 12 warning in blockstorage.cpp

Summary

Extant code was doing a "redundant move" (C++ semantics always try to move when returning, so std::move was unnecessary). G++ 12 warns about this:

[284/430] Building CXX object src/CMakeFiles/server.dir/node/blockstorage.cpp.o
/home/blahxx/git/bitcoin-cash-node/src/node/blockstorage.cpp: In function 'std::optional<CAutoFile> ReadBlockSizeCommon(uint64_t&, const CBlockIndex*, const CChainParams&, FlatFilePos*)':
/home/blahxx/git/bitcoin-cash-node/src/node/blockstorage.cpp:453:21: warning: redundant move in return statement [-Wredundant-move]
  453 |     return std::move(filein);
      |            ~~~~~~~~~^~~~~~~~

Test Plan

  • ninja all check-all
  • (Optional) Build master with GCC 12, see warning. Build this branch with GCC 12, see no warning.

Merge request reports