Skip to content

Compilation warnings with g++ 9.1.1 #16992

@laanwj

Description

@laanwj

I just compiled with a new g++ version for the first time, and noticed some warnings. I don't know how serious these are. I don't think they're very bad (concerning deprecations mostly):

  • "specified bound 12 equals destination size"
In file included from /usr/include/string.h:494,
                 from ./serialize.h:20,
                 from ./netaddress.h:13,
                 from ./protocol.h:13,
                 from protocol.cpp:6:
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘CMessageHeader::CMessageHeader(const unsigned char (&)[4], const char*, unsigned int)’ at protocol.cpp:91:12:
/usr/include/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 12 equals destination size [-Wstringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • implicitly-declared ‘PartiallySignedTransaction& PartiallySignedTransaction::operator=(const PartiallySignedTransaction&)’ is deprecated [-Wdeprecated-copy]
psbt.cpp: In function ‘TransactionError CombinePSBTs(PartiallySignedTransaction&, const std::vector<PartiallySignedTransaction>&)’:
psbt.cpp:335:19: warning: implicitly-declared ‘PartiallySignedTransaction& PartiallySignedTransaction::operator=(const PartiallySignedTransaction&)’ is deprecated [-Wdeprecated-copy]
  335 |     out = psbtxs[0]; // Copy the first one
      |                   ^
In file included from psbt.cpp:5:
./psbt.h:398:5: note: because ‘PartiallySignedTransaction’ has user-provided ‘PartiallySignedTransaction::PartiallySignedTransaction(const PartiallySignedTransaction&)’
  398 |     PartiallySignedTransaction(const PartiallySignedTransaction& psbt_in) : tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs), unknown(psbt_in.unknown) {}
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  • warning: redundant move in return statement
interfaces/chain.cpp: In member function ‘virtual std::unique_ptr<interfaces::Chain::Lock> interfaces::{anonymous}::ChainImpl::lock(bool)’:
interfaces/chain.cpp:249:25: warning: redundant move in return statement [-Wredundant-move]
  249 |         return std::move(result);  
      |                ~~~~~~~~~^~~~~~~~                   
interfaces/chain.cpp:249:25: note: remove ‘std::move’ call

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions