Skip to content

Commit bd2de7a

Browse files
committed
refactor, test: Always initialize pointer
This change fixes MSVC warning C4703. See: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4703 All `DisableSpecificWarnings` dropped from `test_bitcoin.vcxproj` as all remained are inherited from `common.init.vcxproj`.
1 parent 81174d8 commit bd2de7a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

build_msvc/test_bitcoin/test_bitcoin.vcxproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@
5959
<Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project>
6060
</ProjectReference>
6161
</ItemGroup>
62-
<ItemDefinitionGroup>
63-
<ClCompile>
64-
<DisableSpecificWarnings>4018;4244;4267;4703;4715;4805</DisableSpecificWarnings>
65-
</ClCompile>
66-
</ItemDefinitionGroup>
6762
<Target Name="RawBenchHeaderGen" BeforeTargets="PrepareForBuild">
6863
<PropertyGroup>
6964
<ErrorText>There was an error executing the JSON test header generation task.</ErrorText>

src/test/validation_chainstate_tests.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <test/util/random.h>
1313
#include <test/util/setup_common.h>
1414
#include <uint256.h>
15+
#include <util/check.h>
1516
#include <validation.h>
1617

1718
#include <vector>
@@ -102,14 +103,14 @@ BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup)
102103

103104
BOOST_CHECK_EQUAL(chainman.GetAll().size(), 2);
104105

105-
Chainstate& background_cs{*[&] {
106+
Chainstate& background_cs{*Assert([&]() -> Chainstate* {
106107
for (Chainstate* cs : chainman.GetAll()) {
107108
if (cs != &chainman.ActiveChainstate()) {
108109
return cs;
109110
}
110111
}
111-
assert(false);
112-
}()};
112+
return nullptr;
113+
}())};
113114

114115
// Append the first block to the background chain.
115116
BlockValidationState state;

0 commit comments

Comments
 (0)