-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin/bitcoin#28721: multiprocess compatibility updates
3b70f7b doc: fix broken doc/design/multiprocess.md links after #24352 (Ryan Ofsky) 6d43aad span: Make Span template deduction guides work in SFINAE context (Ryan Ofsky) 8062c3b util: Add ArgsManager SetConfigFilePath method (Ryan Ofsky) 441d00c interfaces: Rename CalculateBumpFees methods to be compatible with capn'proto (Ryan Ofsky) 156f49d interfaces: Change getUnspentOutput return type to avoid multiprocess segfault (Ryan Ofsky) 4978754 interfaces: Add schedulerMockForward method so mockscheduler RPC can work across processes (Ryan Ofsky) 924327e interfaces: Fix const virtual method that breaks multiprocess support (Ryan Ofsky) 82a379e streams: Add SpanReader ignore method (Russell Yanofsky) Pull request description: This is a collection of small changes to interfaces and code which were needed as part of multiprocess PR #10102, but have been moved here to make that PR smaller. All of these changes are refactoring changes which do not affect behavior of current code --- This PR is part of the [process separation project](bitcoin/bitcoin#28722). ACKs for top commit: achow101: ACK 3b70f7b naumenkogs: ACK 3b70f7b maflcko: re-ACK 3b70f7b 🎆 Tree-SHA512: 2368772b887056ad8a9f84c299cfde76ba45943770e3b5353130580900afa9611302195b899ced7b6e303b11f053ff204cae7c28ff4e12c55562fcc81119ba4c
- Loading branch information
Showing
19 changed files
with
147 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) 2023 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include <span.h> | ||
|
||
#include <boost/test/unit_test.hpp> | ||
#include <array> | ||
#include <set> | ||
#include <vector> | ||
|
||
namespace { | ||
struct Ignore | ||
{ | ||
template<typename T> Ignore(T&&) {} | ||
}; | ||
template<typename T> | ||
bool Spannable(T&& value, decltype(Span{value})* enable = nullptr) | ||
{ | ||
return true; | ||
} | ||
bool Spannable(Ignore) | ||
{ | ||
return false; | ||
} | ||
|
||
#if defined(__clang__) | ||
# pragma clang diagnostic push | ||
# pragma clang diagnostic ignored "-Wunneeded-member-function" | ||
# pragma clang diagnostic ignored "-Wunused-member-function" | ||
#endif | ||
struct SpannableYes | ||
{ | ||
int* data(); | ||
size_t size(); | ||
}; | ||
struct SpannableNo | ||
{ | ||
void* data(); | ||
size_t size(); | ||
}; | ||
#if defined(__clang__) | ||
# pragma clang diagnostic pop | ||
#endif | ||
} // namespace | ||
|
||
BOOST_AUTO_TEST_SUITE(span_tests) | ||
|
||
// Make sure template Span template deduction guides accurately enable calls to | ||
// Span constructor overloads that work, and disable calls to constructor overloads that | ||
// don't work. This makes it is possible to use the Span constructor in a SFINAE | ||
// contexts like in the Spannable function above to detect whether types are or | ||
// aren't compatible with Spans at compile time. | ||
// | ||
// Previously there was a bug where writing a SFINAE check for vector<bool> was | ||
// not possible, because in libstdc++ vector<bool> has a data() memeber | ||
// returning void*, and the Span template guide ignored the data() return value, | ||
// so the template substitution would succeed, but the constructor would fail, | ||
// resulting in a fatal compile error, rather than a SFINAE error that could be | ||
// handled. | ||
BOOST_AUTO_TEST_CASE(span_constructor_sfinae) | ||
{ | ||
BOOST_CHECK(Spannable(std::vector<int>{})); | ||
BOOST_CHECK(!Spannable(std::set<int>{})); | ||
BOOST_CHECK(!Spannable(std::vector<bool>{})); | ||
BOOST_CHECK(Spannable(std::array<int, 3>{})); | ||
BOOST_CHECK(Spannable(Span<int>{})); | ||
BOOST_CHECK(Spannable("char array")); | ||
BOOST_CHECK(Spannable(SpannableYes{})); | ||
BOOST_CHECK(!Spannable(SpannableNo{})); | ||
} | ||
|
||
BOOST_AUTO_TEST_SUITE_END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.