Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file.

This commit is contained in:
practicalswift 2018-09-05 15:08:58 +02:00
parent 9c71998771
commit b9dafe7d9f
5 changed files with 10 additions and 7 deletions

View file

@ -33,7 +33,7 @@ before_build:
- ps: Start-Process clcache-server - ps: Start-Process clcache-server
- ps: fsutil behavior set disablelastaccess 0 # Enable Access time feature on Windows (for clcache) - ps: fsutil behavior set disablelastaccess 0 # Enable Access time feature on Windows (for clcache)
build_script: build_script:
- cmd: msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715 /nologo - cmd: msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nologo
after_build: after_build:
- ps: fsutil behavior set disablelastaccess 1 # Disable Access time feature on Windows (better performance) - ps: fsutil behavior set disablelastaccess 1 # Disable Access time feature on Windows (better performance)
- ps: clcache -z - ps: clcache -z

View file

@ -15,6 +15,8 @@
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4018;4244;4267;4715;4805;</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
</Project> </Project>

View file

@ -144,7 +144,7 @@ public:
*lockingSuccess = true; *lockingSuccess = true;
} }
return reinterpret_cast<void*>(0x08000000 + (count<<24)); // Fake address, do not actually use this memory return reinterpret_cast<void*>(uint64_t{static_cast<uint64_t>(0x08000000) + (count << 24)}); // Fake address, do not actually use this memory
} }
return 0; return 0;
} }

View file

@ -532,7 +532,7 @@ BOOST_AUTO_TEST_CASE(countbits_tests)
// Check handling of zero. // Check handling of zero.
BOOST_CHECK_EQUAL(CountBits(0), 0U); BOOST_CHECK_EQUAL(CountBits(0), 0U);
} else if (i < 10) { } else if (i < 10) {
for (uint64_t j = 1 << (i - 1); (j >> i) == 0; ++j) { for (uint64_t j = (uint64_t)1 << (i - 1); (j >> i) == 0; ++j) {
// Exhaustively test up to 10 bits // Exhaustively test up to 10 bits
BOOST_CHECK_EQUAL(CountBits(j), i); BOOST_CHECK_EQUAL(CountBits(j), i);
} }

View file

@ -184,11 +184,12 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScript
stream << tx2; stream << tx2;
int libconsensus_flags = flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL; int libconsensus_flags = flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL;
if (libconsensus_flags == flags) { if (libconsensus_flags == flags) {
int expectedSuccessCode = expect ? 1 : 0;
if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) { if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), txCredit.vout[0].nValue, (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expect, message); BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), txCredit.vout[0].nValue, (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
} else { } else {
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), 0, (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expect, message); BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), 0, (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expect,message); BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
} }
} }
#endif #endif