diff options
author | merge-script <fanquake@gmail.com> | 2024-06-12 18:16:07 +0100 |
---|---|---|
committer | merge-script <fanquake@gmail.com> | 2024-06-12 18:16:07 +0100 |
commit | a7bc9b76e73f04dfe4d6ba42033fe38659090e8b (patch) | |
tree | d9a6e8c2ea425dc24514b9d305062f0c8c721f70 /src/test | |
parent | d0cb5167d6d85ebc5b3123ee7902d3b1dc095e49 (diff) | |
parent | faa41e29d5b90e62179d651f4010272dae685621 (diff) |
Merge bitcoin/bitcoin#30229: fuzz: Use std::span in FuzzBufferType
faa41e29d5b90e62179d651f4010272dae685621 fuzz: Use std::span in FuzzBufferType (MarcoFalke)
Pull request description:
The use of `Span` is problematic, because it lacks methods such as `rbegin`, leading to compile failures when used:
```
error: no member named 'rbegin' in 'Span<const unsigned char>'
```
One could fix `Span`, but it seems better to use `std::span`, given that `Span` will be removed anyway in the long term.
ACKs for top commit:
dergoegge:
utACK faa41e29d5b90e62179d651f4010272dae685621
Tree-SHA512: 54bcaf51c83a1b48739cd7f1e8445c6eba0eb04231bce5c35591a47dddb3890ffcaf562cf932930443c80ab0e66950c4619560e6692240de0c52aeef3214facd
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/fuzz/bitset.cpp | 6 | ||||
-rw-r--r-- | src/test/fuzz/fuzz.h | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/test/fuzz/bitset.cpp b/src/test/fuzz/bitset.cpp index 98fcddfb8d..7684337729 100644 --- a/src/test/fuzz/bitset.cpp +++ b/src/test/fuzz/bitset.cpp @@ -12,8 +12,8 @@ namespace { -/** Pop the first byte from a Span<const uint8_t>, and return it. */ -uint8_t ReadByte(Span<const uint8_t>& buffer) +/** Pop the first byte from a byte-span, and return it. */ +uint8_t ReadByte(FuzzBufferType& buffer) { if (buffer.empty()) return 0; uint8_t ret = buffer.front(); @@ -23,7 +23,7 @@ uint8_t ReadByte(Span<const uint8_t>& buffer) /** Perform a simulation fuzz test on BitSet type S. */ template<typename S> -void TestType(Span<const uint8_t> buffer) +void TestType(FuzzBufferType buffer) { /** This fuzz test's design is based on the assumption that the actual bits stored in the * bitsets and their simulations do not matter for the purpose of detecting edge cases, thus diff --git a/src/test/fuzz/fuzz.h b/src/test/fuzz/fuzz.h index ca74d53de7..c468cd39e3 100644 --- a/src/test/fuzz/fuzz.h +++ b/src/test/fuzz/fuzz.h @@ -5,10 +5,9 @@ #ifndef BITCOIN_TEST_FUZZ_FUZZ_H #define BITCOIN_TEST_FUZZ_FUZZ_H -#include <span.h> - #include <cstdint> #include <functional> +#include <span> #include <string_view> /** @@ -23,7 +22,7 @@ #define LIMITED_WHILE(condition, limit) \ for (unsigned _count{limit}; (condition) && _count; --_count) -using FuzzBufferType = Span<const uint8_t>; +using FuzzBufferType = std::span<const uint8_t>; using TypeTestOneInput = std::function<void(FuzzBufferType)>; struct FuzzTargetOptions { |