Skip to content

Commit 5127844

Browse files
committed
Merge bitcoin/bitcoin#30017: refactor, fuzz: Make 64-bit shift explicit
b50d127 refactor: Make 64-bit shift explicit (Hennadii Stepanov) Pull request description: This PR fixes MSVC warning [C4334](https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4334) in the fuzzing code. Similar to bitcoin/bitcoin#26252. All `DisableSpecificWarnings` dropped from `fuzz.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 b50d127 sipsorcery: utACK b50d127 Tree-SHA512: 18f6082b4234506ad2f9df54e577031b97cdf9f7ef64cad4162f275660716ab73587a97d3af0f778dfd48d2751d8676b5d3381d0aa837fcc60a09704473a9209
2 parents 62ef33a + b50d127 commit 5127844

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

build_msvc/fuzz/fuzz.vcxproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@
8080
<Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project>
8181
</ProjectReference>
8282
</ItemGroup>
83-
<ItemDefinitionGroup>
84-
<ClCompile>
85-
<DisableSpecificWarnings>4018;4244;4267;4334;4715;4805</DisableSpecificWarnings>
86-
</ClCompile>
87-
</ItemDefinitionGroup>
8883
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8984
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
9085
<Import Project="..\common.vcxproj" />

src/test/fuzz/poolresource.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ class PoolResourceFuzzer
6363
{
6464
if (m_total_allocated > 0x1000000) return;
6565
size_t alignment_bits = m_provider.ConsumeIntegralInRange<size_t>(0, 7);
66-
size_t alignment = 1 << alignment_bits;
66+
size_t alignment = size_t{1} << alignment_bits;
6767
size_t size_bits = m_provider.ConsumeIntegralInRange<size_t>(0, 16 - alignment_bits);
68-
size_t size = m_provider.ConsumeIntegralInRange<size_t>(1U << size_bits, (1U << (size_bits + 1)) - 1U) << alignment_bits;
68+
size_t size = m_provider.ConsumeIntegralInRange<size_t>(size_t{1} << size_bits, (size_t{1} << (size_bits + 1)) - 1U) << alignment_bits;
6969
Allocate(size, alignment);
7070
}
7171

0 commit comments

Comments
 (0)