windows: Fix remaining compiler warnings (MSVC)#14151
Conversation
383b749 to
699d458
Compare
699d458 to
e99684c
Compare
|
tACK e99684c Prior to this PR: Subsequently: |
abf1b0e to
94ce7c9
Compare
|
@sipsorcery @MarcoFalke Please re-review :-) |
|
@ken2812221 Squashed. Please re-review :-) |
94ce7c9 to
224cc41
Compare
4094687 to
224cc41
Compare
|
Adding |
|
For test, I tried running a dry compile with "C:\Sources\bitcoin\build_msvc\bitcoin.sln" (default target) (1) ->
"C:\Sources\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj" (default target) (2) ->
(ClCompile target) ->
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.14.26428\include\xutility(3182): error C4996: 'std::equal::_Unchecked_iterators::_Deprecate': Call to 'st
d::equal' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See docu
mentation on how to use Visual C++ 'Checked Iterators' [C:\Sources\bitcoin\build_msvc\libbitcoinconsensus\libbitcoinconsensus.vcxproj]
"C:\Sources\bitcoin\build_msvc\bitcoin.sln" (default target) (1) ->
"C:\Sources\bitcoin\build_msvc\testconsensus\testconsensus.vcxproj" (default target) (3) ->
"C:\Sources\bitcoin\build_msvc\libbitcoin_util\libbitcoin_util.vcxproj" (default target) (4) ->
(Lib target) ->
sync.obj : error LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library [C:\Sources\b
itcoin\build_msvc\libbitcoin_util\libbitcoin_util.vcxproj]That said, I don't think this is very important, tACK 224cc41bb9fd2906d9a61abd0cad9bd77365569b |
|
@NicolasDorier Personally I'm all for |
|
The whole purpose of |
|
@NicolasDorier Yes, I know but I thought the project was configured to block merge in case of Travis build failure but not in case of AppVeyor build failure. But I'm probably mistaken :-) |
|
ah yes I think you are right. Well, I think we can ignore |
|
For a C++ build to exclude specific warnings and set the "treat warnings as error" flag the following node can be added to the common.vcxproj file: When warnings as error is set the script\interpreter.cpp code fails to compile on line 264 and specifically this check:
A quick Google found a blog post about Visual C++ range checking safety. To ignore this warning add |
|
tACK f14f4a6. |
|
re-utACK for me |
|
ACK bc7aff79fc0cfb10d25a7dd5928a1cb8c36a063b |
|
re-utACK bc7aff7 |
|
@laanwj Added a commit. Please re-review :-) |
|
LGTM, please squash before merge though! |
514da96 to
ed7e26b
Compare
|
@laanwj Fixed! Sorry for the tag. Please re-review :-) @NicolasDorier @sipsorcery @ken2812221 @Empact Would you mind re-reviewing? |
…rnings from /nowarn to project file.
ed7e26b to
b9dafe7
Compare
|
re-utACK b9dafe7. Personally I would use an integer-suffix instead of the static cast, e.g. |
|
@sipsorcery I don't think there exists an integer-suffix in C++11 guaranteeing a width of exactly 64 bits on all supported platforms? :-) |
The C++17 specification states that I've no argument either way. |
Yeah, indeed, if only C++ had Rust's |
|
utACK b9dafe7 |
b9dafe7 Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file. (practicalswift) Pull request description: Fix remaining compiler warnings (MSVC). Before: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715 /nologo …\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch …\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size …\boost\test\tools\old\impl.hpp(107): warning C4805: '==': unsafe mix of type 'const Left' and type 'const Right' in operation …\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) …\test\script_tests.cpp(188): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(190): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(191): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation $ ``` After: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715;C4805 /nologo $ ``` Tree-SHA512: 5b30334d3804e869779e77dad75a799e8e5e7eb2e08634cd40035cce140edd623cbb6c8b5806d2158c3df97888d3ea9ff4b8b6a5a83de3fe2cb361e29588c115
…se of uninitialized memory 870f0cd build: Add MemorySanitizer (MSan) in Travis to detect use of uninitialized memory (practicalswift) Pull request description: Add MemorySanitizer (MSan) in Travis to detect use of uninitialized memory. First UBSan, then ASan followed by TSan... and now: yes, the wait is over -- **MSan is finally here!** :) Some historical context: * 2017: Continuous compilation with Clang Thread Safety analysis enabled (#10866, #10923) * 2018: Continuous testing with trapping on signed integer overflows (`-ftrapv`) (#12686) * 2018: Continuous testing of use of locale dependent functions (#13041) * 2018: Continuous testing of format strings (#13705) * 2018: Continuous compilation with MSVC `TreatWarningAsError` (#14151) * 2018: Continuous testing under UndefinedBehaviorSanitizer – UBSan (#14252, #14673, #17006) * 2018: Continuous testing under AddressSanitizer – ASan (#14794, #17205, #17674) * 2018: Continuous testing under ThreadSanitizer – TSan (#14829) * 2019: Continuous testing in an unsigned char environment (`-funsigned-char`) (#15134) * 2019: Continuous compile-time testing of assumptions we're making (#15391) * 2019: Continuous testing of fuzz test cases under Valgrind (#17633, #18159, #18166) * 2020: Finally... MemorySanitizer – MSAN! :) What is the next step? What tools should we add to CI to keep bugs from entering `master`? :) ACKs for top commit: MarcoFalke: ACK 870f0cd Tree-SHA512: 38327c8b75679d97d469fe42e704cacd1217447a5a603701dd8a58ee50b3be2c10248f8d68a479ed081c0c4b254589d3081c9183f991640b06ef689061f75578
b9dafe7 Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file. (practicalswift) Pull request description: Fix remaining compiler warnings (MSVC). Before: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715 /nologo …\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch …\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size …\boost\test\tools\old\impl.hpp(107): warning C4805: '==': unsafe mix of type 'const Left' and type 'const Right' in operation …\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) …\test\script_tests.cpp(188): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(190): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(191): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation $ ``` After: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715;C4805 /nologo $ ``` Tree-SHA512: 5b30334d3804e869779e77dad75a799e8e5e7eb2e08634cd40035cce140edd623cbb6c8b5806d2158c3df97888d3ea9ff4b8b6a5a83de3fe2cb361e29588c115
b9dafe7 Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file. (practicalswift) Pull request description: Fix remaining compiler warnings (MSVC). Before: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715 /nologo …\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch …\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size …\boost\test\tools\old\impl.hpp(107): warning C4805: '==': unsafe mix of type 'const Left' and type 'const Right' in operation …\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) …\test\script_tests.cpp(188): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(190): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(191): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation $ ``` After: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715;C4805 /nologo $ ``` Tree-SHA512: 5b30334d3804e869779e77dad75a799e8e5e7eb2e08634cd40035cce140edd623cbb6c8b5806d2158c3df97888d3ea9ff4b8b6a5a83de3fe2cb361e29588c115 # Conflicts: # .appveyor.yml # build_msvc/common.vcxproj # src/test/script_tests.cpp
b9dafe7 Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file. (practicalswift) Pull request description: Fix remaining compiler warnings (MSVC). Before: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715 /nologo …\script\script.cpp(272): warning C4018: '>': signed/unsigned mismatch …\test\allocator_tests.cpp(147): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size …\boost\test\tools\old\impl.hpp(107): warning C4805: '==': unsafe mix of type 'const Left' and type 'const Right' in operation …\test\crypto_tests.cpp(535): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) …\test\script_tests.cpp(188): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(190): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation …\test\script_tests.cpp(191): warning C4805: '==': unsafe mix of type 'int' and type 'bool' in operation $ ``` After: ``` $ msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715;C4805 /nologo $ ``` Tree-SHA512: 5b30334d3804e869779e77dad75a799e8e5e7eb2e08634cd40035cce140edd623cbb6c8b5806d2158c3df97888d3ea9ff4b8b6a5a83de3fe2cb361e29588c115 # Conflicts: # .appveyor.yml # build_msvc/common.vcxproj # src/test/script_tests.cpp
Fix remaining compiler warnings (MSVC).
Before:
After: