std::ranges::views::reverse
, which allows us to drop our own reverse_iterator.h
implementation and also makes it easier to chain views (even though I think we currently don’t use this).
std::ranges::views::reverse
, which allows us to drop our own reverse_iterator.h
implementation and also makes it easier to chain views (even though I think we currently don’t use this).
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For detailed information about the code coverage, see the test coverage report.
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
WIP: our
prevector
implementation requires modification forstd::ranges::views::reverse
to work. More specifically: it needs to implement thebidirectional_range
concept, which currently it seems not to (seestatic_assert(std::ranges::bidirectional_range<prevector>)
output below) as we’re not satisfyingrange
. Once that’s done, we can update the last usage ofreverse_iterator.h
here and here and remove the header entirely.
That is also required by std::span
.
Needs rebase
Thx, rebased to include #28349 & updated PR description
https://github.com/bitcoin/bitcoin/pull/28687/checks?check_run_id=19528202548
0/usr/bin/ccache clang++-13 -stdlib=libc++ -std=c++20 -DHAVE_CONFIG_H -I. -I../src/config -fmacro-prefix-map=/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -DHAVE_BUILD_INFO -DPROVIDE_FUZZ_MAIN_FUNCTION -I. -I./minisketch/include -I./secp256k1/include -I./univalue/include -I./leveldb/include -isystem /ci_container_base/depends/x86_64-pc-linux-gnu/include -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_NO_CXX98_FUNCTION_BASE -isystem /ci_container_base/depends/x86_64-pc-linux-gnu/include -pthread -I/ci_container_base/depends/x86_64-pc-linux-gnu/include -I/ci_container_base/depends/x86_64-pc-linux-gnu/include/ -fdebug-prefix-map=/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu=. -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Werror -fvisibility=hidden -fPIE -pipe -std=c++20 -O2 -c -o libbitcoin_node_a-net_processing.o `test -f 'net_processing.cpp' || echo './'`net_processing.cpp
1net_processing.cpp:2074:62: error: no member named 'reverse' in namespace 'std::views'
2 for (const uint256& hash : vHashes | std::views::reverse) {
3 ~~~~~~~~~~~~^
4net_processing.cpp:2760:69: error: no member named 'reverse' in namespace 'std::views'
5 for (const CBlockIndex *pindex : vToFetch | std::views::reverse) {
6 ~~~~~~~~~~~~^
72 errors generated.
Looks like ranges didn’t become complete / non-experimental in LLVM until version 16: https://releases.llvm.org/16.0.0/projects/libcxx/docs/ReleaseNotes.html
The C++20 ranges library has been completed and is no longer experimental (with the exception of ranges::join_view which is still marked as experimental because it is about to undergo an ABI-breaking change in the Standard due to D2770). Work on C++23 ranges has started.
Note that prior versions of LLVM required distros/venders to compile with special flags, so I assume it’s just not going to be generally available until 16? i.e from the LLVM 14 release notes:
More parts of ranges have been implemented. Since we still expect to make some API and ABI breaking changes, those are disabled by default. However, vendors that wish to enable in their distribution may do so by defining -DLIBCXX_ENABLE_INCOMPLETE_FEATURES=ON when configuring their build.
Hmm, there’s no clang-16 in the current LTS release of Ubuntu, so I guess this will have to wait for some time.
https://packages.ubuntu.com/jammy/clang-16
I wonder whether std::span will be usable, given that it internally assumes ranges?
Interesting that the guix macOS build passed, given that it is on clang-15, no?
I’d guess this is because our macOS SDK (libc++) is from Xcode 15, which is based on LLVM ~16, and includes support for ranges. So as long as clang-15 can compile it, which it should given vanilla LLVM supports the use of ranges (experimentally) in 15, it probably works.
Though, on GHA it says XCode 14.3, see https://github.com/bitcoin/bitcoin/actions/runs/7171999335/job/19528203033?pr=28687#step:3:14
0clang --version
1Apple clang version 14.0.3 (clang-1403.0.22.14.1)
2Target: x86_64-apple-darwin22.6.0
3Thread model: posix
4InstalledDir: /Applications/Xcode_14.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Though, on GHA it says XCode 14.3
According to https://developer.apple.com/xcode/cpp/#c++20, “Ranges” have been available on macOS since Xcode 14.3.
WIP: our
prevector
implementation requires modification forstd::ranges::views::reverse
to work. More specifically: it needs to implement thebidirectional_range
concept, which currently it seems not to (seestatic_assert(std::ranges::bidirectional_range<prevector>)
output below) as we’re not satisfyingrange
. Once that’s done, we can update the last usage ofreverse_iterator.h
here and here and remove the header entirely.That is also required by
std::span
.
(Possibly?) fixed in https://github.com/bitcoin/bitcoin/pull/29275
(Possibly?) fixed in #29275
Looks like it does, this compiles for me locally atleast: https://github.com/fanquake/bitcoin/tree/28687_29275. @stickies-v can you rebase this branch on top of #29275.
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.
Possibly this is due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
Leave a comment here, if you need help tracking down a confusing failure.
Force pushed to:
previous releases, depends DEBUG
task passmultiprocess, i686, DEBUG
pass when mergedno wallet, libbitcoinkernel
is now the only remaining unadressed failing CI task, afaict requiring a bump to clang-16 too
Use std::ranges::views::reverse instead of the implementation in
reverse_iterator.h, and remove it as it is no longer used.
ACK 2925bd537cbd8c70594e23f6c4298b7101f7f73d 🎷
Signature:
0untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
1RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
2trusted comment: ACK 2925bd537cbd8c70594e23f6c4298b7101f7f73d 🎷
3hdWxKaQlmycdmMRya28H4AKptHOQLgq//CDoWCwS6QAA5hcnhTRD1nkFbYpGtK6moizOMjisBVHALD8qIuYNAA==
stickies-v
DrahtBot
fanquake
maflcko
achow101
TheCharlatan
Milestone
28.0