-Wmissing-braces
f46e3ec0f9567a19ad9c111f264d395341327e4a net: Fix `-Wmissing-braces` (Hennadii Stepanov) Pull request description: On some non-POSIX platforms, Clang emits `-Wmissing-braces` warnings for the `IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` macros. For example, on OpenIndiana / illumos: ``` $ uname -srv SunOS 5.11 illumos-325e0fc8bb $ clang --version clang version 21.1.7 (https://github.com/OpenIndiana/oi-userland.git 36a81bf5e5d307d4e85893422600678d46328010) Target: x86_64-pc-solaris2.11 Thread model: posix InstalledDir: /usr/clang/21/bin $ cmake -B build -DCMAKE_GENERATOR=Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_IPC=OFF -DAPPEND_CXXFLAGS='-Wno-unused-command-line-argument' $ cmake --build build [284/573] Building CXX object src/CMakeFiles/bitcoin_node.dir/net.cpp.o /export/home/hebasto/dev/bitcoin/src/net.cpp:3309:42: warning: suggest braces around initialization of subobject [-Wmissing-braces] 3309 | const CService ipv6_any{in6_addr(IN6ADDR_ANY_INIT), GetListenPort()}; // :: | ^~~~~~~~~~~~~~~~ /usr/include/netinet/in.h:479:32: note: expanded from macro 'IN6ADDR_ANY_INIT' 479 | #define IN6ADDR_ANY_INIT { 0, 0, 0, 0, \ | ^~~~~~~~~~~~~~~~~ 480 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 481 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 482 | 0, 0, 0, 0 } | ~~~~~~~~~~ 1 warning generated. [467/573] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/i2p_tests.cpp.o /export/home/hebasto/dev/bitcoin/src/test/i2p_tests.cpp:116:34: warning: suggest braces around initialization of subobject [-Wmissing-braces] 116 | const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), /*port=*/7656}; | ^~~~~~~~~~~~~~~~~~~~~ /usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT' 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \ | ^~~~~~~~~~~~~~~~~ 485 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 486 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 487 | 0, 0, 0, 0x1U } | ~~~~~~~~~~~~~ /export/home/hebasto/dev/bitcoin/src/test/i2p_tests.cpp:159:38: warning: suggest braces around initialization of subobject [-Wmissing-braces] 159 | const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), /*port=*/7656}; | ^~~~~~~~~~~~~~~~~~~~~ /usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT' 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \ | ^~~~~~~~~~~~~~~~~ 485 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 486 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 487 | 0, 0, 0, 0x1U } | ~~~~~~~~~~~~~ 2 warnings generated. [483/573] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/netbase_tests.cpp.o /export/home/hebasto/dev/bitcoin/src/test/netbase_tests.cpp:505:36: warning: suggest braces around initialization of subobject [-Wmissing-braces] 505 | CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0 /* port */), | ^~~~~~~~~~~~~~~~~~~~~ /usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT' 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \ | ^~~~~~~~~~~~~~~~~ 485 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 486 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 487 | 0, 0, 0, 0x1U } | ~~~~~~~~~~~~~ /export/home/hebasto/dev/bitcoin/src/test/netbase_tests.cpp:510:36: warning: suggest braces around initialization of subobject [-Wmissing-braces] 510 | CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0x00f1 /* port */), | ^~~~~~~~~~~~~~~~~~~~~ /usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT' 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \ | ^~~~~~~~~~~~~~~~~ 485 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 486 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 487 | 0, 0, 0, 0x1U } | ~~~~~~~~~~~~~ /export/home/hebasto/dev/bitcoin/src/test/netbase_tests.cpp:515:36: warning: suggest braces around initialization of subobject [-Wmissing-braces] 515 | CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0xf1f2 /* port */), | ^~~~~~~~~~~~~~~~~~~~~ /usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT' 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \ | ^~~~~~~~~~~~~~~~~ 485 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 486 | 0, 0, 0, 0, \ | ~~~~~~~~~~~~~~~~~ 487 | 0, 0, 0, 0x1U } | ~~~~~~~~~~~~~ 3 warnings generated. [573/573] Linking CXX executable bin/test_bitcoin ``` The same issue is observed on Windows. For further details, see https://github.com/bitcoin/bitcoin/pull/31507. ACKs for top commit: bensig: ACK f46e3ec0f9567a19ad9c111f264d395341327e4a maflcko: review ACK f46e3ec0f9567a19ad9c111f264d395341327e4a 👭 vasild: ACK f46e3ec0f9567a19ad9c111f264d395341327e4a sedited: utACK f46e3ec0f9567a19ad9c111f264d395341327e4a Tree-SHA512: 9ad597d393ba04537b3aa728070ea7bbe1fc8796f6d8f3d90eb511242e5a61b0ab18123a6be3cca89aaa20ba7fb4dbe682c4d1c6bd3f6d883c459133e0c2861f
Bitcoin Core integration/staging tree
For an immediately usable, binary version of the Bitcoin Core software, see https://bitcoincore.org/en/download/.
What is Bitcoin Core?
Bitcoin Core connects to the Bitcoin peer-to-peer network to download and fully validate blocks and transactions. It also includes a wallet and graphical user interface, which can be optionally built.
Further information about Bitcoin Core is available in the doc folder.
License
Bitcoin Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/license/MIT.
Development Process
The master branch is regularly built (see doc/build-*.md for instructions) and tested, but it is not guaranteed to be
completely stable. Tags are created
regularly from release branches to indicate new official, stable release versions of Bitcoin Core.
The https://github.com/bitcoin-core/gui repository is used exclusively for the development of the GUI. Its master branch is identical in all monotree repositories. Release branches and tags do not exist, so please do not fork that repository unless it is for development reasons.
The contribution workflow is described in CONTRIBUTING.md and useful hints for developers can be found in doc/developer-notes.md.
Testing
Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.
Automated Testing
Developers are strongly encouraged to write unit tests for new code, and to
submit new unit tests for old code. Unit tests can be compiled and run
(assuming they weren't disabled during the generation of the build system) with: ctest. Further details on running
and extending unit tests can be found in /src/test/README.md.
There are also regression and integration tests, written
in Python.
These tests can be run (if the test dependencies are installed) with: build/test/functional/test_runner.py
(assuming build is your build directory).
The CI (Continuous Integration) systems make sure that every pull request is tested on Windows, Linux, and macOS. The CI must pass on all commits before merge to avoid unrelated CI failures on new pull requests.
Manual Quality Assurance (QA) Testing
Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.
Translations
Changes to translations as well as new translations can be submitted to Bitcoin Core's Transifex page.
Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.
Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.