Skip to content
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

refactor: remove C++17 workarounds #6380

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft

Conversation

kwvg
Copy link
Collaborator

@kwvg kwvg commented Nov 2, 2024

Additional Information

  • Depends on depends: update 'src/immer' to arximboldi/immer@5875f773 as c0b716f2 #6377

  • Using an existing namespace as an alias for a namespace part of the std namespace (as done in ranges) has been done before, see namespace fs, an alias to std::filesystem (here).

  • While the comment in wallet.cpp did mention that there would be a better way to do the cast than in C++17, the method to do so, using std::chrono::clock_cast, has still not been implemented in Clang (source). The issue has been sidestepped by not using std::time_t at all and instead relying on fs::file_time_type, the type returned by fs::last_write_time.

Breaking changes

None expected.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas (note: N/A)
  • I have added or updated relevant unit/integration/functional/e2e tests (note: N/A)
  • I have made corresponding changes to the documentation (note: N/A)
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

kwvg added 4 commits November 1, 2024 11:42
std::clock_cast is a part of C++20, hence the original TODO comment but
it's still not implemented in Clang, as of this writing. We can sidestep
the cast by not using time_t to begin with.
@kwvg kwvg added this to the 23 milestone Nov 2, 2024
PastaPastaPasta added a commit that referenced this pull request Nov 4, 2024
…as c0b716f2

f18e839 build: drop symlinks in immer subtree (Kittywhiskers Van Gogh)
d761111 build: fix gitian builds (Kittywhiskers Van Gogh)
a9f46b3 Squashed 'src/immer/' changes from 9cb6a5a845..5875f7739a (Kittywhiskers Van Gogh)
e4ee302 revert: fix gitian builds (Kittywhiskers Van Gogh)
fb00300 revert: drop symlinks in immer subtree (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  * Dependency for #6380

  #6380 will be using `std::ranges` as a replacement for [dash#4622](#4622) and currently, it will fail to compile due to the current version of `immer` (last updated two years ago in #4911) not meeting constraints ([source](https://en.cppreference.com/w/cpp/language/constraints)) set by `std::ranges` (see below).

  ```
  ./evo/deterministicmns.h:243:16: error: no matching function for call to object of type 'const __count_if_fn'
          return ranges::count_if(mnMap, [](const auto& p) { return IsMNValid(*p.second); });
                 ^~~~~~~~~~~~~~~~
  /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:331:7: note: candidate template ignored: substitution failure [with _Range = const MnMap &, _Proj = identity, _Pred = (lambda at ./evo/deterministicmns.h:243:40)]: constraints not satisfied for alias template 'range_difference_t' [with _Range = const immer::map<uint256, std::shared_ptr<const CDeterministicMN>, CDeterministicMNList::ImmerHasher> &]
        operator()(_Range&& __r, _Pred __pred, _Proj __proj = {}) const
        ^
  /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/ranges_algo.h:316:7: note: candidate function template not viable: requires at least 3 arguments, but 2 were provided
        operator()(_Iter __first, _Sent __last,
        ^
  ```

  This has been resolved by updating `immer` to the latest available release, [v0.8.1](https://github.com/arximboldi/immer/releases/tag/v0.8.1).

  Expected subtree hash **without changes** are `a5ded361aec714bc74149909c5e1984c10ab132c4c539c63fe57362dccd95556` (see [here](#6323 (review)) for verification instructions).

  ## Breaking Changes

  None expected.

  ## Checklist

  - [x] I have performed a self-review of my own code **(note: N/A)**
  - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)**
  - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)**
  - [x] I have made corresponding changes to the documentation **(note: N/A)**
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  PastaPastaPasta:
    utACK f18e839
  UdjinM6:
    utACK f18e839

Tree-SHA512: 99d1b577eb4cf3fcc3ebfd28f19006700f085d23ccdabe802a2aa5844e4b39314347b0c0e49a352c5fc034d6584a0109edf08fa3c0846514967f1fb16e7f127a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant