diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-07-09 15:20:30 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-07-09 15:22:00 +0200 |
commit | fc8da23fbe582b4705d1e04c200e42f294719759 (patch) | |
tree | 17e464fe73d8c59e3eff2baef3636c78dd5b50b0 | |
parent | 21028ce9ffb8ebbd00f46f281a28d0f8e54b5aa5 (diff) | |
parent | 2894e94d17e57dedad02ac34e217ab80bbd72ed6 (diff) | |
download | bitcoin-fc8da23fbe582b4705d1e04c200e42f294719759.tar.xz |
Merge #19445: build: Update msvc build to use ISO standard C++17
2894e94d17e57dedad02ac34e217ab80bbd72ed6 Updates msvc build to use ISO standard C++17. (Aaron Clauson)
Pull request description:
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]
````
ACKs for top commit:
MarcoFalke:
Approach ACK 2894e94d17e57dedad02ac34e217ab80bbd72ed6
laanwj:
ACK 2894e94d17e57dedad02ac34e217ab80bbd72ed6
Tree-SHA512: aff14726e05cb52f81dee32eafbd5b9ec829d3ed032ed4a03345458d6a22875a307ee8543952298a95d30d80720158586d33dbc8bf1970a99c403c3f1510d7fd
-rw-r--r-- | build_msvc/common.init.vcxproj | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/build_msvc/common.init.vcxproj b/build_msvc/common.init.vcxproj index c09997d39d..4fd516fff5 100644 --- a/build_msvc/common.init.vcxproj +++ b/build_msvc/common.init.vcxproj @@ -107,10 +107,10 @@ <ClCompile> <WarningLevel>Level3</WarningLevel> <PrecompiledHeader>NotUsing</PrecompiledHeader> - <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> + <AdditionalOptions>/utf-8 /std:c++17 %(AdditionalOptions)</AdditionalOptions> <DisableSpecificWarnings>4018;4221;4244;4267;4334;4715;4805;4834</DisableSpecificWarnings> <TreatWarningAsError>true</TreatWarningAsError> - <PreprocessorDefinitions>ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING;ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>..\..\src;..\..\src\univalue\include;..\..\src\secp256k1\include;..\..\src\leveldb\include;..\..\src\leveldb\helpers\memenv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> |