build: Add –enable-c++20 option #24169

pull MarcoFalke wants to merge 4 commits into bitcoin:master from MarcoFalke:2201-ciCpp20 changing 6 files +39 −8
  1. MarcoFalke commented at 7:04 pm on January 26, 2022: member

    This is for CI and devs only and doesn’t change that C++17 is the standard we are currently using. The option --enable-c++20 allows CI to check that the C++17 code in the repo is also valid C++20. (There are some cases where valid C++17 doesn’t compile under C++20).

    Also, it allows developers to easily play with C++20 in the codebase.

  2. MarcoFalke added the label Build system on Jan 26, 2022
  3. MarcoFalke added this to the milestone Future on Jan 26, 2022
  4. PastaPastaPasta commented at 8:28 am on January 27, 2022: contributor

    You may or may not be interested in one of my PRs to dash that did this https://github.com/dashpay/dash/pull/4600

    I was planning on doing the equivalent here, but didn’t want to until we could merge #23340 which if I recall correctly is required to fix cxx20 builds

  5. jonatack commented at 4:34 pm on January 27, 2022: member
    Concept ACK
  6. fanquake commented at 10:02 am on February 11, 2022: member
    Support for c++20 has now been merged into the ax_cxx_compile_stdcxx.m4 macro upstream: https://github.com/autoconf-archive/autoconf-archive/pull/244.
  7. MarcoFalke force-pushed on Feb 11, 2022
  8. MarcoFalke renamed this:
    [WIP DRAFT] build: Add --enable-c++20 option
    build: Add --enable-c++20 option
    on Feb 11, 2022
  9. MarcoFalke marked this as ready for review on Feb 11, 2022
  10. MarcoFalke removed this from the milestone Future on Feb 11, 2022
  11. MarcoFalke marked this as a draft on Feb 11, 2022
  12. DrahtBot commented at 8:01 am on February 15, 2022: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    No conflicts as of last run.

  13. DrahtBot added the label Needs rebase on Feb 17, 2022
  14. MarcoFalke force-pushed on Feb 17, 2022
  15. MarcoFalke force-pushed on Feb 17, 2022
  16. MarcoFalke force-pushed on Feb 17, 2022
  17. DrahtBot removed the label Needs rebase on Feb 17, 2022
  18. MarcoFalke force-pushed on Feb 21, 2022
  19. MarcoFalke force-pushed on Feb 21, 2022
  20. MarcoFalke force-pushed on Feb 21, 2022
  21. MarcoFalke force-pushed on Feb 23, 2022
  22. MarcoFalke force-pushed on Feb 23, 2022
  23. fanquake commented at 11:49 am on February 23, 2022: member
    If you want to split the macro update off, happy to merge that earlier, given it’s a mechanical change.
  24. MarcoFalke force-pushed on Mar 2, 2022
  25. felipsoarez commented at 4:34 pm on March 2, 2022: none
    utACK
  26. fanquake referenced this in commit cc70f65d21 on Mar 4, 2022
  27. sidhujag referenced this in commit b8252ff751 on Mar 5, 2022
  28. MarcoFalke force-pushed on Mar 7, 2022
  29. MarcoFalke force-pushed on Mar 7, 2022
  30. MarcoFalke force-pushed on Mar 7, 2022
  31. MarcoFalke marked this as ready for review on Mar 10, 2022
  32. MarcoFalke force-pushed on Mar 10, 2022
  33. fanquake commented at 10:56 am on March 11, 2022: member
    Concept ACK. I think having the developer option, and carrying some number of code changes to support c++20 compilation is fine, but it’s going to be a long time before we can make it a requirement.
  34. MarcoFalke force-pushed on Mar 17, 2022
  35. MarcoFalke force-pushed on Mar 17, 2022
  36. MarcoFalke commented at 1:03 pm on March 17, 2022: member
    Force pushed to address feedback: #24531 (review)
  37. in src/fs.h:54 in fa73ff980e outdated
    50@@ -51,12 +51,26 @@ class path : public std::filesystem::path
    51     // Disallow std::string conversion method to avoid locale-dependent encoding on windows.
    52     std::string string() const = delete;
    53 
    54+    std::string u8string() const
    


    fanquake commented at 1:15 pm on March 17, 2022:
    @ryanofsky or @hebasto you might be interested in the fs changes here?
  38. MarcoFalke force-pushed on Mar 17, 2022
  39. MarcoFalke force-pushed on Mar 17, 2022
  40. ryanofsky approved
  41. ryanofsky commented at 8:08 pm on March 17, 2022: member

    Code review ACK fa442133f1ea37edb7c769590da9592b541fce6c. All these changes look safe to me, and it is definitely better if the code is tested with c++20 and compiles without changes.

    A lot of changes are made in the PR without an explanation about the reason, though. Like the enum-enum warning change and scheduler lambda change. Ideally the changes would be broken up more, with one change per commit, and the commit messages would explain the reasons behind the changes, or at least give hints.

  42. MarcoFalke force-pushed on Mar 17, 2022
  43. MarcoFalke commented at 8:56 pm on March 17, 2022: member
    Thx, done. (No code changes)
  44. ryanofsky approved
  45. ryanofsky commented at 9:02 pm on March 17, 2022: member
    Code review ACK fab63ca14298d37022e23d3e9747bc4bf94121c9. Thanks for the descriptions, I understand this much better now!
  46. fanquake commented at 10:54 am on March 18, 2022: member
    @theuni you might also be interested here
  47. theStack approved
  48. theStack commented at 5:34 pm on March 19, 2022: member

    Concept and code-review ACK fab63ca14298d37022e23d3e9747bc4bf94121c9 :two: :zero:

    Tested --enable-c++20 compilation with clang 11.1.0 (OpenBSD 7.0).

  49. hebasto commented at 7:22 am on March 21, 2022: member
    Concept ACK.
  50. hebasto commented at 10:21 am on March 21, 2022: member
    Approach ACK fab63ca14298d37022e23d3e9747bc4bf94121c9, except for the fa08f8b8cd4eb13cc5904d33e027f6c485b9f4b1 “Set -Wno-deprecated-enum-enum-conversion” commit. An alternative has been suggested in #24624.
  51. MarcoFalke commented at 8:10 am on March 22, 2022: member
    I’d say the two pull requests are mostly orthogonal. If one is merged before the other, the one merged second can drop the temporary -Wno commit.
  52. hebasto approved
  53. hebasto commented at 9:56 am on March 22, 2022: member

    ACK fab63ca14298d37022e23d3e9747bc4bf94121c9

    I’d say the two pull requests are mostly orthogonal. If one is merged before the other, the one merged second can drop the temporary -Wno commit.

    Agree.

  54. MarcoFalke referenced this in commit f05cf59d91 on Mar 22, 2022
  55. MarcoFalke commented at 12:44 pm on March 22, 2022: member
    Removed a commit. Should be trivial to re-ACK.
  56. MarcoFalke force-pushed on Mar 22, 2022
  57. hebasto approved
  58. hebasto commented at 1:34 pm on March 22, 2022: member

    ~re-ACK fa6bc3b2ccb7386ed496dd8be6b748e95c28b957~

    CI failure?

  59. MarcoFalke commented at 3:39 pm on March 22, 2022: member
    Please review #24641 first, while this fails to compile.
  60. MarcoFalke marked this as a draft on Mar 22, 2022
  61. scheduler: Capture ‘this’ explicitly in lambda
    Without the changes, g++ will warn to compile under C++20:
    
    scheduler.cpp:114:21: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated]
      114 |     scheduleFromNow([=] { Repeat(*this, f, delta); }, delta);
          |                     ^
    scheduler.cpp:114:21: note: add explicit ‘this’ or ‘*this’ capture
    fae2220f4e
  62. Make fs.h C++20 compliant
    Without the changes, the file will fail to compile under C++20 because
    char8_t can not be converted to char implicitly.
    fabb7c4ba6
  63. MarcoFalke marked this as ready for review on Mar 24, 2022
  64. Add CSerializedNetMsg::Copy() helper
    This makes code that uses the helper less verbose.
    
    Moreover, this makes net_processing C++20 compliant. Otherwise, it would
    lead to a compile error (see below). C++20 disables aggregate
    initialization when any constructor is declared. See
    http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p1008r1.pdf
    
    net_processing.cpp:1627:42: error: no matching constructor for initialization of 'CSerializedNetMsg'
                m_connman.PushMessage(pnode, CSerializedNetMsg{ser_cmpctblock.data, ser_cmpctblock.m_type});
                                             ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fae679065e
  65. build: Add --enable-c++20 option 999982b06c
  66. MarcoFalke force-pushed on Mar 24, 2022
  67. ryanofsky approved
  68. ryanofsky commented at 12:20 pm on March 24, 2022: member
    Code review ACK 999982b06ce1d1280e5ce48f9253c6c536f41a12. Since last review was rebased, and enum-conversion change was dropped, and CSerializedNetMsg copy workaround was added
  69. fanquake approved
  70. fanquake commented at 1:00 pm on March 24, 2022: member
    utACK 999982b06ce1d1280e5ce48f9253c6c536f41a12
  71. fanquake merged this on Mar 24, 2022
  72. fanquake closed this on Mar 24, 2022

  73. MarcoFalke deleted the branch on Mar 24, 2022
  74. Sjors commented at 9:26 am on March 26, 2022: member
    Nice! Though macOS trips over a deprecation (warning), see #24682.
  75. sidhujag referenced this in commit aad46d4291 on Apr 2, 2022
  76. DrahtBot locked this on Mar 26, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-06-17 22:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me