Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jan 26, 2022

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.

@maflcko maflcko added this to the Future milestone Jan 26, 2022
@PastaPastaPasta
Copy link
Contributor

You may or may not be interested in one of my PRs to dash that did this dashpay#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

@jonatack
Copy link
Member

Concept ACK

@fanquake
Copy link
Member

Support for c++20 has now been merged into the ax_cxx_compile_stdcxx.m4 macro upstream: autoconf-archive/autoconf-archive#244.

@maflcko maflcko changed the title [WIP DRAFT] build: Add --enable-c++20 option build: Add --enable-c++20 option Feb 11, 2022
@maflcko maflcko marked this pull request as ready for review February 11, 2022 11:22
@maflcko maflcko removed this from the Future milestone Feb 11, 2022
@maflcko maflcko marked this pull request as draft February 11, 2022 12:01
@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 15, 2022

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

Conflicts

No conflicts as of last run.

@fanquake
Copy link
Member

If you want to split the macro update off, happy to merge that earlier, given it's a mechanical change.

@maflcko
Copy link
Member Author

maflcko commented Mar 17, 2022

Thx, done. (No code changes)

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK fab63ca. Thanks for the descriptions, I understand this much better now!

@fanquake
Copy link
Member

@theuni you might also be interested here

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept and code-review ACK fab63ca 2️⃣ 0️⃣

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

@hebasto
Copy link
Member

hebasto commented Mar 21, 2022

Concept ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK fab63ca, except for the fa08f8b "Set -Wno-deprecated-enum-enum-conversion" commit. An alternative has been suggested in #24624.

@maflcko
Copy link
Member Author

maflcko commented Mar 22, 2022

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.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK fab63ca

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.

maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Mar 22, 2022
…um-conversion warnings

acd98ad qt: Avoid potential -Wdeprecated-enum-enum-conversion warning (Hennadii Stepanov)
d8641f0 qt: Use human-readable strings in preference to hard-coded integers (Hennadii Stepanov)

Pull request description:

  This PR is related to bitcoin/bitcoin#24169. It adjusts code in order to avoid `-Wdeprecated-enum-enum-conversion` warnings instead of disabling them.

  Could be tested with gcc 11.2.

ACKs for top commit:
  MarcoFalke:
    Approach ACK acd98ad
  fanquake:
    untested ACK acd98ad - thanks.
  promag:
    Code review ACK acd98ad.

Tree-SHA512: e8043d997d85f8dba0f37ca02f1c60eb756a1732cf76a75908b01eb2cf7a4c6d4aaf6007271a929c213de37a0c1d96bc25280f0ee9eca488f370904461222ede
@maflcko
Copy link
Member Author

maflcko commented Mar 22, 2022

Removed a commit. Should be trivial to re-ACK.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK fa6bc3b

CI failure?

@maflcko
Copy link
Member Author

maflcko commented Mar 22, 2022

Please review #24641 first, while this fails to compile.

@maflcko maflcko marked this pull request as draft March 22, 2022 15:40
MarcoFalke added 2 commits March 24, 2022 11:36
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
Without the changes, the file will fail to compile under C++20 because
char8_t can not be converted to char implicitly.
@maflcko maflcko marked this pull request as ready for review March 24, 2022 10:37
MarcoFalke added 2 commits March 24, 2022 11:37
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});
                                         ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 999982b. Since last review was rebased, and enum-conversion change was dropped, and CSerializedNetMsg copy workaround was added

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 999982b

@fanquake fanquake merged commit 213e98c into bitcoin:master Mar 24, 2022
@maflcko maflcko deleted the 2201-ciCpp20 branch March 24, 2022 13:28
@Sjors
Copy link
Member

Sjors commented Mar 26, 2022

Nice! Though macOS trips over a deprecation (warning), see #24682.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 2, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Mar 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants