Skip to content

Commit 70e4d6f

Browse files
committed
Merge bitcoin/bitcoin#30026: refactor, test: Always initialize pointer
bd2de7a refactor, test: Always initialize pointer (Hennadii Stepanov) Pull request description: This change fixes MSVC warning [C4703](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`. Required to simplify warning suppression porting to the CMake-based build system. ACKs for top commit: maflcko: utACK bd2de7a sipsorcery: utACK bd2de7a. ryanofsky: Code review ACK bd2de7a Tree-SHA512: 006db041d3c3697a77d9df14de86cf7c8a10804b45789df01268b2236cf6452e77dc57e89f5d5a6bc26d4b5cd483f0722d6035649c8a523b57954bb1fc810d0c
2 parents 99d7538 + bd2de7a commit 70e4d6f

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)