mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 18:52:29 +02:00
Merge bitcoin/bitcoin#34090: net: Fix -Wmissing-braces
f46e3ec0f9net: 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: ACKf46e3ec0f9maflcko: review ACKf46e3ec0f9👭 vasild: ACKf46e3ec0f9sedited: utACKf46e3ec0f9Tree-SHA512: 9ad597d393ba04537b3aa728070ea7bbe1fc8796f6d8f3d90eb511242e5a61b0ab18123a6be3cca89aaa20ba7fb4dbe682c4d1c6bd3f6d883c459133e0c2861f
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <common/args.h>
|
||||
#include <compat/compat.h>
|
||||
#include <i2p.h>
|
||||
#include <netaddress.h>
|
||||
#include <netbase.h>
|
||||
@@ -34,7 +35,7 @@ FUZZ_TARGET(i2p, .init = initialize_i2p)
|
||||
};
|
||||
|
||||
const fs::path private_key_path = gArgs.GetDataDirNet() / "fuzzed_i2p_private_key";
|
||||
const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), 7656};
|
||||
const CService addr{in6_addr(COMPAT_IN6ADDR_LOOPBACK_INIT), 7656};
|
||||
const Proxy sam_proxy{addr, /*tor_stream_isolation=*/false};
|
||||
auto interrupt{ConsumeThreadInterrupt(fuzzed_data_provider)};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user