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
  1. sipsorcery commented at 11:55 PM on July 15, 2018: member

    Fix to allow net.cpp to compile with MSVC. Without this fix the (in6_addr)IN6ADDR_ANY_INIT implicit cast generates a compilation error.

  2. fanquake added the label P2P on Jul 15, 2018
  3. 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' failed
    

    macOS:

    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
    
  4. 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.

  5. Empact commented at 4:39 AM on July 16, 2018: member

    @sipsorcery #ifndef WIN32?

  6. sipa commented at 4:42 AM on July 16, 2018: member

    Looks like just a missing include for in6_addr?

  7. 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 }}}

  8. 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.

  9. ken2812221 commented at 5:44 AM on July 16, 2018: contributor

    So looks like in_addr6 for MSVC, in6_addr for gcc

  10. 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.

  11. sipsorcery force-pushed on Jul 16, 2018
  12. Modified in_addr6 cast in CConman class to work with msvc. 822a2a33a7
  13. sipsorcery force-pushed on Jul 16, 2018
  14. Empact commented at 2:14 AM on July 17, 2018: member

    utACK 822a2a3

  15. sipa commented at 7:41 AM on July 17, 2018: member

    utACK 822a2a33a74c3f997e7982d629c8f6158b80c093

  16. ken2812221 commented at 7:54 AM on July 17, 2018: contributor

    utACK 822a2a3

  17. laanwj merged this on Jul 18, 2018
  18. laanwj closed this on Jul 18, 2018

  19. laanwj referenced this in commit 0d8d6be791 on Jul 18, 2018
  20. sipsorcery deleted the branch on Jun 19, 2019
  21. PastaPastaPasta referenced this in commit 88f448f232 on Apr 16, 2020
  22. PastaPastaPasta referenced this in commit 478cefca97 on Apr 16, 2020
  23. PastaPastaPasta referenced this in commit 32b6bfdd60 on Apr 19, 2020
  24. PastaPastaPasta referenced this in commit 8acefc83b8 on Apr 20, 2020
  25. PastaPastaPasta referenced this in commit 252d27e419 on May 10, 2020
  26. PastaPastaPasta referenced this in commit c1fcb20836 on May 12, 2020
  27. PastaPastaPasta referenced this in commit 02ed3cb8ca on Jun 9, 2020
  28. PastaPastaPasta referenced this in commit ace1fa5144 on Jun 9, 2020
  29. PastaPastaPasta referenced this in commit f39b168fce on Jun 10, 2020
  30. PastaPastaPasta referenced this in commit 8863a8eb8a on Jun 11, 2020
  31. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 09:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me