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:
0$ uname -srv
1SunOS 5.11 illumos-325e0fc8bb
2$ clang --version
3clang version 21.1.7 (https://github.com/OpenIndiana/oi-userland.git 36a81bf5e5d307d4e85893422600678d46328010)
4Target: x86_64-pc-solaris2.11
5Thread model: posix
6InstalledDir: /usr/clang/21/bin
7$ cmake -B build -DCMAKE_GENERATOR=Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DENABLE_IPC=OFF -DAPPEND_CXXFLAGS='-Wno-unused-command-line-argument'
8$ cmake --build build
9[284/573] Building CXX object src/CMakeFiles/bitcoin_node.dir/net.cpp.o
10/export/home/hebasto/dev/bitcoin/src/net.cpp:3309:42: warning: suggest braces around initialization of subobject [-Wmissing-braces]
11 3309 | const CService ipv6_any{in6_addr(IN6ADDR_ANY_INIT), GetListenPort()}; // ::
12 | ^~~~~~~~~~~~~~~~
13/usr/include/netinet/in.h:479:32: note: expanded from macro 'IN6ADDR_ANY_INIT'
14 479 | #define IN6ADDR_ANY_INIT { 0, 0, 0, 0, \
15 | ^~~~~~~~~~~~~~~~~
16 480 | 0, 0, 0, 0, \
17 | ~~~~~~~~~~~~~~~~~
18 481 | 0, 0, 0, 0, \
19 | ~~~~~~~~~~~~~~~~~
20 482 | 0, 0, 0, 0 }
21 | ~~~~~~~~~~
221 warning generated.
23[467/573] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/i2p_tests.cpp.o
24/export/home/hebasto/dev/bitcoin/src/test/i2p_tests.cpp:116:34: warning: suggest braces around initialization of subobject [-Wmissing-braces]
25 116 | const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), /*port=*/7656};
26 | ^~~~~~~~~~~~~~~~~~~~~
27/usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT'
28 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \
29 | ^~~~~~~~~~~~~~~~~
30 485 | 0, 0, 0, 0, \
31 | ~~~~~~~~~~~~~~~~~
32 486 | 0, 0, 0, 0, \
33 | ~~~~~~~~~~~~~~~~~
34 487 | 0, 0, 0, 0x1U }
35 | ~~~~~~~~~~~~~
36/export/home/hebasto/dev/bitcoin/src/test/i2p_tests.cpp:159:38: warning: suggest braces around initialization of subobject [-Wmissing-braces]
37 159 | const CService addr{in6_addr(IN6ADDR_LOOPBACK_INIT), /*port=*/7656};
38 | ^~~~~~~~~~~~~~~~~~~~~
39/usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT'
40 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \
41 | ^~~~~~~~~~~~~~~~~
42 485 | 0, 0, 0, 0, \
43 | ~~~~~~~~~~~~~~~~~
44 486 | 0, 0, 0, 0, \
45 | ~~~~~~~~~~~~~~~~~
46 487 | 0, 0, 0, 0x1U }
47 | ~~~~~~~~~~~~~
482 warnings generated.
49[483/573] Building CXX object src/test/CMakeFiles/test_bitcoin.dir/netbase_tests.cpp.o
50/export/home/hebasto/dev/bitcoin/src/test/netbase_tests.cpp:505:36: warning: suggest braces around initialization of subobject [-Wmissing-braces]
51 505 | CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0 /* port */),
52 | ^~~~~~~~~~~~~~~~~~~~~
53/usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT'
54 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \
55 | ^~~~~~~~~~~~~~~~~
56 485 | 0, 0, 0, 0, \
57 | ~~~~~~~~~~~~~~~~~
58 486 | 0, 0, 0, 0, \
59 | ~~~~~~~~~~~~~~~~~
60 487 | 0, 0, 0, 0x1U }
61 | ~~~~~~~~~~~~~
62/export/home/hebasto/dev/bitcoin/src/test/netbase_tests.cpp:510:36: warning: suggest braces around initialization of subobject [-Wmissing-braces]
63 510 | CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0x00f1 /* port */),
64 | ^~~~~~~~~~~~~~~~~~~~~
65/usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT'
66 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \
67 | ^~~~~~~~~~~~~~~~~
68 485 | 0, 0, 0, 0, \
69 | ~~~~~~~~~~~~~~~~~
70 486 | 0, 0, 0, 0, \
71 | ~~~~~~~~~~~~~~~~~
72 487 | 0, 0, 0, 0x1U }
73 | ~~~~~~~~~~~~~
74/export/home/hebasto/dev/bitcoin/src/test/netbase_tests.cpp:515:36: warning: suggest braces around initialization of subobject [-Wmissing-braces]
75 515 | CService(CNetAddr(in6_addr(IN6ADDR_LOOPBACK_INIT)), 0xf1f2 /* port */),
76 | ^~~~~~~~~~~~~~~~~~~~~
77/usr/include/netinet/in.h:484:37: note: expanded from macro 'IN6ADDR_LOOPBACK_INIT'
78 484 | #define IN6ADDR_LOOPBACK_INIT { 0, 0, 0, 0, \
79 | ^~~~~~~~~~~~~~~~~
80 485 | 0, 0, 0, 0, \
81 | ~~~~~~~~~~~~~~~~~
82 486 | 0, 0, 0, 0, \
83 | ~~~~~~~~~~~~~~~~~
84 487 | 0, 0, 0, 0x1U }
85 | ~~~~~~~~~~~~~
863 warnings generated.
87[573/573] Linking CXX executable bin/test_bitcoin
The same issue is observed on Windows. For further details, see #31507.