Merge #20733: inline non-member functions with body in fuzzing headers

d8b9cec25b inline non-member functions with body in fuzzing headers (Patrick Strateman)

Pull request description:

  Resolves the issue noted [here](https://github.com/bitcoin/bitcoin/pull/20560#issuecomment-748339644)

ACKs for top commit:
  MarcoFalke:
    ACK d8b9cec25b

Tree-SHA512: fb34707e2d2c5b664d4160e0e4b56e3df9fb2c9045da6ddea7139e0b4982262c4e085812a8543a6221febc9cd0815423b8287fec66baae3236e5f3339cc9df8c
This commit is contained in:
MarcoFalke 2020-12-21 08:13:02 +01:00
commit e9efb64a07
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25
2 changed files with 7 additions and 7 deletions

View File

@ -15,7 +15,7 @@ using TypeInitialize = std::function<void()>;
void FuzzFrameworkRegisterTarget(std::string_view name, TypeTestOneInput target, TypeInitialize init);
void FuzzFrameworkEmptyFun() {}
inline void FuzzFrameworkEmptyFun() {}
#define FUZZ_TARGET(name) \
FUZZ_TARGET_INIT(name, FuzzFrameworkEmptyFun)

View File

@ -249,7 +249,7 @@ template <class T>
return result;
}
CNetAddr ConsumeNetAddr(FuzzedDataProvider& fuzzed_data_provider) noexcept
inline CNetAddr ConsumeNetAddr(FuzzedDataProvider& fuzzed_data_provider) noexcept
{
const Network network = fuzzed_data_provider.PickValueInArray({Network::NET_IPV4, Network::NET_IPV6, Network::NET_INTERNAL, Network::NET_ONION});
CNetAddr net_addr;
@ -271,22 +271,22 @@ CNetAddr ConsumeNetAddr(FuzzedDataProvider& fuzzed_data_provider) noexcept
return net_addr;
}
CSubNet ConsumeSubNet(FuzzedDataProvider& fuzzed_data_provider) noexcept
inline CSubNet ConsumeSubNet(FuzzedDataProvider& fuzzed_data_provider) noexcept
{
return {ConsumeNetAddr(fuzzed_data_provider), fuzzed_data_provider.ConsumeIntegral<uint8_t>()};
}
CService ConsumeService(FuzzedDataProvider& fuzzed_data_provider) noexcept
inline CService ConsumeService(FuzzedDataProvider& fuzzed_data_provider) noexcept
{
return {ConsumeNetAddr(fuzzed_data_provider), fuzzed_data_provider.ConsumeIntegral<uint16_t>()};
}
CAddress ConsumeAddress(FuzzedDataProvider& fuzzed_data_provider) noexcept
inline CAddress ConsumeAddress(FuzzedDataProvider& fuzzed_data_provider) noexcept
{
return {ConsumeService(fuzzed_data_provider), static_cast<ServiceFlags>(fuzzed_data_provider.ConsumeIntegral<uint64_t>()), fuzzed_data_provider.ConsumeIntegral<uint32_t>()};
}
CNode ConsumeNode(FuzzedDataProvider& fuzzed_data_provider) noexcept
inline CNode ConsumeNode(FuzzedDataProvider& fuzzed_data_provider) noexcept
{
const NodeId node_id = fuzzed_data_provider.ConsumeIntegral<NodeId>();
const ServiceFlags local_services = static_cast<ServiceFlags>(fuzzed_data_provider.ConsumeIntegral<uint64_t>());
@ -302,7 +302,7 @@ CNode ConsumeNode(FuzzedDataProvider& fuzzed_data_provider) noexcept
return {node_id, local_services, my_starting_height, socket, address, keyed_net_group, local_host_nonce, addr_bind, addr_name, conn_type, inbound_onion};
}
void InitializeFuzzingContext(const std::string& chain_name = CBaseChainParams::REGTEST)
inline void InitializeFuzzingContext(const std::string& chain_name = CBaseChainParams::REGTEST)
{
static const BasicTestingSetup basic_testing_setup{chain_name, {"-nodebuglogfile"}};
}