Fix to allow net.cpp to compile with MSVC. Without this fix the (in6_addr)IN6ADDR_ANY_INIT implicit cast generates a compilation error.
Modified in_addr6 cast in CConman class to work with msvc #13672
pull sipsorcery wants to merge 1 commits into bitcoin:master from sipsorcery:ip6castfix changing 1 files +2 −1-
sipsorcery commented at 11:55 PM on July 15, 2018: member
- fanquake added the label P2P on Jul 15, 2018
-
fanquake commented at 12:53 AM on July 16, 2018: member
Looks like this breaks everything but the Windows builds. Linux:
net.cpp: In member function 'bool CConnman::InitBinds(const std::vector<CService>&, const std::vector<CService>&)': net.cpp:2257:25: error: variable 'CConnman::InitBinds(const std::vector<CService>&, const std::vector<CService>&)::in_addr6 inaddr6_any' has initializer but incomplete type struct in_addr6 inaddr6_any = IN6ADDR_ANY_INIT; ^~~~~~~~~~~ make[2]: *** [libbitcoin_server_a-net.o] Error 1 Makefile:5954: recipe for target 'libbitcoin_server_a-net.o' failedmacOS:
libbitcoin_server_a-net.o `test -f 'net.cpp' || echo './'`net.cpp net.cpp:2257:25: error: variable has incomplete type 'struct in_addr6' struct in_addr6 inaddr6_any = IN6ADDR_ANY_INIT; ^ net.cpp:2257:16: note: forward declaration of 'in_addr6' struct in_addr6 inaddr6_any = IN6ADDR_ANY_INIT; ^ 1 error generated. make[2]: *** [libbitcoin_server_a-net.o] Error 1 Makefile:5954: recipe for target 'libbitcoin_server_a-net.o' failed -
sipsorcery commented at 4:24 AM on July 16, 2018: member
Back to the drawing board then. I'll try and find an approach that works on Linux as well as Windows.
-
Empact commented at 4:39 AM on July 16, 2018: member
@sipsorcery
#ifndef WIN32? -
sipa commented at 4:42 AM on July 16, 2018: member
Looks like just a missing include for in6_addr?
-
sipsorcery commented at 5:02 AM on July 16, 2018: member
@sipa the includes are good. The compilation error is:
Error C4576 a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax libbitcoin_server c:\dev\github\bitcoin-msvc\src\net.cpp 2258
The define on Windows (ws2ipdef.h) is:
#define IN6ADDR_ANY_INIT {{{ 0 }}} -
sipa commented at 5:07 AM on July 16, 2018: member
@sipsorcery I mean the build error in this PR looks like in6_addr is not defined.
Alternatively, maybe "inaddr6_any" is a macro on some platforms? Try another variable name.
-
ken2812221 commented at 5:44 AM on July 16, 2018: contributor
So looks like
in_addr6for MSVC,in6_addrfor gcc -
sipsorcery commented at 5:52 AM on July 16, 2018: member
MSVC also uses in6_addr (there is an extra in_addr6 alias that I inadvertently used). I'll adjust the PR.
- sipsorcery force-pushed on Jul 16, 2018
-
Modified in_addr6 cast in CConman class to work with msvc. 822a2a33a7
- sipsorcery force-pushed on Jul 16, 2018
-
Empact commented at 2:14 AM on July 17, 2018: member
utACK 822a2a3
-
sipa commented at 7:41 AM on July 17, 2018: member
utACK 822a2a33a74c3f997e7982d629c8f6158b80c093
-
ken2812221 commented at 7:54 AM on July 17, 2018: contributor
utACK 822a2a3
- laanwj merged this on Jul 18, 2018
- laanwj closed this on Jul 18, 2018
- laanwj referenced this in commit 0d8d6be791 on Jul 18, 2018
- sipsorcery deleted the branch on Jun 19, 2019
- PastaPastaPasta referenced this in commit 88f448f232 on Apr 16, 2020
- PastaPastaPasta referenced this in commit 478cefca97 on Apr 16, 2020
- PastaPastaPasta referenced this in commit 32b6bfdd60 on Apr 19, 2020
- PastaPastaPasta referenced this in commit 8acefc83b8 on Apr 20, 2020
- PastaPastaPasta referenced this in commit 252d27e419 on May 10, 2020
- PastaPastaPasta referenced this in commit c1fcb20836 on May 12, 2020
- PastaPastaPasta referenced this in commit 02ed3cb8ca on Jun 9, 2020
- PastaPastaPasta referenced this in commit ace1fa5144 on Jun 9, 2020
- PastaPastaPasta referenced this in commit f39b168fce on Jun 10, 2020
- PastaPastaPasta referenced this in commit 8863a8eb8a on Jun 11, 2020
- DrahtBot locked this on Dec 16, 2021