-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiprocess compatibility updates #28721
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
82a379e
streams: Add SpanReader ignore method
ryanofsky 924327e
interfaces: Fix const virtual method that breaks multiprocess support
ryanofsky 4978754
interfaces: Add schedulerMockForward method so mockscheduler RPC can …
ryanofsky 156f49d
interfaces: Change getUnspentOutput return type to avoid multiprocess…
ryanofsky 441d00c
interfaces: Rename CalculateBumpFees methods to be compatible with ca…
ryanofsky 8062c3b
util: Add ArgsManager SetConfigFilePath method
ryanofsky 6d43aad
span: Make Span template deduction guides work in SFINAE context
ryanofsky 3b70f7b
doc: fix broken doc/design/multiprocess.md links after #24352
ryanofsky File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1fba885: I wonder if it is easier to just delete the content of this file and replace it with
using Span = std::span
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: #28721 (comment)
Switching from Span to std::span might work, but it's a bigger change and I'd expect it to require other fixes and not just be a drop-in replacement.
If replacing span gets implemented and merged first, that's great and this commit can be dropped. But otherwise the actual code change here is small. I wouldn't want multiprocess code to depend on replacing span when there is a direct fix here which is 3 lines and is just adding two
!std::is_void_v
checks.