Skip to content

Commit

Permalink
Merge bitcoin#30026: refactor, test: Always initialize pointer
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ryanofsky committed May 3, 2024
2 parents 99d7538 + bd2de7a commit 70e4d6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 0 additions & 5 deletions build_msvc/test_bitcoin/test_bitcoin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@
<Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project>
</ProjectReference>
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<DisableSpecificWarnings>4018;4244;4267;4703;4715;4805</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<Target Name="RawBenchHeaderGen" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>There was an error executing the JSON test header generation task.</ErrorText>
Expand Down
7 changes: 4 additions & 3 deletions src/test/validation_chainstate_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <test/util/random.h>
#include <test/util/setup_common.h>
#include <uint256.h>
#include <util/check.h>
#include <validation.h>

#include <vector>
Expand Down Expand Up @@ -102,14 +103,14 @@ BOOST_FIXTURE_TEST_CASE(chainstate_update_tip, TestChain100Setup)

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

Chainstate& background_cs{*[&] {
Chainstate& background_cs{*Assert([&]() -> Chainstate* {
for (Chainstate* cs : chainman.GetAll()) {
if (cs != &chainman.ActiveChainstate()) {
return cs;
}
}
assert(false);
}()};
return nullptr;
}())};

// Append the first block to the background chain.
BlockValidationState state;
Expand Down

0 comments on commit 70e4d6f

Please sign in to comment.