build: Update msvc build to use ISO standard C++17 #19445

pull sipsorcery wants to merge 1 commits into bitcoin:master from sipsorcery:msvc_cpp17 changing 1 files +2 −2
  1. sipsorcery commented at 3:15 PM on July 4, 2020: member

    This PR adds a compiler option to the msvc build to specify ISO C++17 support as discussed in #16684.

    In order to allow Bitcoin Core to compile with the new option two pre-processor defines are also necessary to avoid an warning (treated as an error) for C++17 deprecated features:

    • _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
    • _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING

    For anyone interested a sample compiler message for each of the warnings is shown below:

    c:\Dev\github\sipsorcery_bitcoin\src\support\allocators\zeroafterfree.h(21,5): error C4996: 'std::allocator<_Ty>::const_pointer': warning STL4010: Various members of std::allocator are deprecated in C++17. Use std::allocator_traits instead of accessing these members directly. You can define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [c:\Dev\github\sipsorcery_bitcoin\build_msvc\libbitcoin_qt\libbitcoin_qt.vcxproj]
    
    c:\Dev\github\sipsorcery_bitcoin\src\fs.cpp(29,31): error C4996: 'std::codecvt_utf8_utf16<wchar_t,1114111,(std::codecvt_mode)0>': warning STL4017: std::wbuffer_convert, std::wstring_convert, and the <codecvt> header (containing std::codecvt_mode, std::codecvt_utf8, std::codecvt_utf16, and std::codecvt_utf8_utf16) are deprecated in C++17. (The std::codecvt class template is NOT deprecated.) The C++ Standard doesn't provide equivalent non-deprecated functionality; consider using MultiByteToWideChar() and WideCharToMultiByte() from <Windows.h> instead. You can define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. [c:\Dev\github\sipsorcery_bitcoin\build_msvc\libbitcoin_util\libbitcoin_util.vcxproj]
    
  2. Updates msvc build to use ISO standard C++17. 2894e94d17
  3. MarcoFalke renamed this:
    Updates msvc build to use ISO standard C++17
    build: Updates msvc build to use ISO standard C++17
    on Jul 4, 2020
  4. MarcoFalke renamed this:
    build: Updates msvc build to use ISO standard C++17
    build: Update msvc build to use ISO standard C++17
    on Jul 4, 2020
  5. DrahtBot added the label Build system on Jul 4, 2020
  6. MarcoFalke commented at 8:15 PM on July 4, 2020: member

    Approach ACK 2894e94d17e57dedad02ac34e217ab80bbd72ed6

  7. fanquake added the label Windows on Jul 5, 2020
  8. laanwj commented at 1:20 PM on July 9, 2020: member

    ACK 2894e94d17e57dedad02ac34e217ab80bbd72ed6

    I think it's fine to disable the deprecation warnings for now, and maybe address them in a future PR. FWIW, <codecvt> seems to be only used on Windows, so the suggested fix to use MultiByteToWideChar() and WideCharToMultiByte() would work. These functions are even already used in some places (fs.cpp and leveldb).

  9. laanwj merged this on Jul 9, 2020
  10. laanwj closed this on Jul 9, 2020

  11. sidhujag referenced this in commit ee38ec04be on Jul 9, 2020
  12. MarkLTZ referenced this in commit 3a06d9fc27 on Feb 16, 2021
  13. DrahtBot locked this on Feb 15, 2022

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-17 03:14 UTC

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