Skip to content

Commit b9dafe7

Browse files
Fix remaining compiler warnings (MSVC). Move disabling of specific warnings from /nowarn to project file.
1 parent 9c71998 commit b9dafe7

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ before_build:
3333
- ps: Start-Process clcache-server
3434
- ps: fsutil behavior set disablelastaccess 0 # Enable Access time feature on Windows (for clcache)
3535
build_script:
36-
- cmd: msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nowarn:C4244;C4267;C4715 /nologo
36+
- cmd: msbuild /p:TrackFileAccess=false /p:CLToolExe=clcache.exe build_msvc\bitcoin.sln /m /v:q /nologo
3737
after_build:
3838
- ps: fsutil behavior set disablelastaccess 1 # Disable Access time feature on Windows (better performance)
3939
- ps: clcache -z

build_msvc/common.vcxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
<ItemDefinitionGroup>
1616
<ClCompile>
1717
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
18+
<DisableSpecificWarnings>4018;4244;4267;4715;4805;</DisableSpecificWarnings>
19+
<TreatWarningAsError>true</TreatWarningAsError>
1820
</ClCompile>
1921
</ItemDefinitionGroup>
20-
</Project>
22+
</Project>

src/test/allocator_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class TestLockedPageAllocator: public LockedPageAllocator
144144
*lockingSuccess = true;
145145
}
146146

147-
return reinterpret_cast<void*>(0x08000000 + (count<<24)); // Fake address, do not actually use this memory
147+
return reinterpret_cast<void*>(uint64_t{static_cast<uint64_t>(0x08000000) + (count << 24)}); // Fake address, do not actually use this memory
148148
}
149149
return 0;
150150
}

src/test/crypto_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ BOOST_AUTO_TEST_CASE(countbits_tests)
532532
// Check handling of zero.
533533
BOOST_CHECK_EQUAL(CountBits(0), 0U);
534534
} else if (i < 10) {
535-
for (uint64_t j = 1 << (i - 1); (j >> i) == 0; ++j) {
535+
for (uint64_t j = (uint64_t)1 << (i - 1); (j >> i) == 0; ++j) {
536536
// Exhaustively test up to 10 bits
537537
BOOST_CHECK_EQUAL(CountBits(j), i);
538538
}

src/test/script_tests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,12 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScript
184184
stream << tx2;
185185
int libconsensus_flags = flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL;
186186
if (libconsensus_flags == flags) {
187+
int expectedSuccessCode = expect ? 1 : 0;
187188
if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
188-
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);
189+
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);
189190
} else {
190-
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);
191-
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expect,message);
191+
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);
192+
BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), (const unsigned char*)&stream[0], stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
192193
}
193194
}
194195
#endif

0 commit comments

Comments
 (0)