Page MenuHomePhabricator

Add CSerializedNetMsg::Copy() helper
ClosedPublic

Authored by PiRK on Jan 29 2024, 17:31.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC48b8dc6c21a1: Add CSerializedNetMsg::Copy() helper
Summary

This makes code that uses the helper less verbose.

Moreover, this makes net_processing C++20 compliant. Otherwise, it would
lead to a compile error (see below). C++20 disables aggregate
initialization when any constructor is declared. See
http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1008r1.pdf

net_processing.cpp:1627:42: error: no matching constructor for initialization of 'CSerializedNetMsg'
            m_connman.PushMessage(pnode, CSerializedNetMsg{ser_cmpctblock.data, ser_cmpctblock.m_type});
                                         ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is a partial backport of core#24169
https://github.com/bitcoin/bitcoin/pull/24169/commits/fae679065e4ef0c6383bbdd1876aaed6c1e40104

Depends on D15316

Note that after this diff it is possible to set set(CMAKE_CXX_STANDARD 20)

Test Plan

ninja all check-all

And rerun the compilation and tests with set(CMAKE_CXX_STANDARD 20) in src/CMakeLists.txt

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jan 29 2024, 17:31

Tail of the build log:

[361/542] Linking C executable src/secp256k1/verify-bench
[362/542] Linking C executable src/secp256k1/sign-bench
[363/542] Building CXX object src/CMakeFiles/server.dir/txdb.cpp.o
[364/542] Building CXX object src/CMakeFiles/server.dir/validationinterface.cpp.o
[365/542] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[366/542] Linking C executable src/secp256k1/internal-bench
[367/542] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[368/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[369/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[370/542] Building CXX object src/CMakeFiles/server.dir/txorphanage.cpp.o
[371/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[372/542] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[373/542] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[374/542] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[375/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[376/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[377/542] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[378/542] Linking CXX executable src/bitcoin-cli
[379/542] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[380/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[381/542] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[382/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[383/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[384/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[385/542] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[386/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[387/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[388/542] Linking CXX executable src/bitcoin-tx
[389/542] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[390/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[391/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[392/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[393/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[394/542] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[395/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[396/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[397/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[398/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[399/542] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[400/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[401/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[402/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[403/542] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[404/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[405/542] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[406/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[407/542] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[408/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[409/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[410/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[411/542] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[412/542] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[413/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[414/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[415/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[416/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[417/542] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[418/542] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
Fabien requested changes to this revision.Jan 30 2024, 08:33
Fabien added a subscriber: Fabien.

Needs rebase

This revision now requires changes to proceed.Jan 30 2024, 08:33
This revision is now accepted and ready to land.Jan 30 2024, 15:27
This revision was automatically updated to reflect the committed changes.