Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@fruffy
Copy link
Collaborator

@fruffy fruffy commented Jan 22, 2024

C++20 is now supported in most major distributions and compilers and there are several features that are useful for us to have. Let's switch to C++20.

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Jan 22, 2024
@vlstill
Copy link
Member

vlstill commented Jan 23, 2024

I started looking at this some time ago in #4297. I was probably too sneaky though. Still not complete, there is quite lot of things that break and I don't have much time for it now. The main problem is clashing operators.

@fruffy
Copy link
Collaborator Author

fruffy commented Jan 23, 2024

I started looking at this some time ago in #4297. I was probably too sneaky though. Still not complete, there is quite lot of things that break and I don't have much time for it now. The main problem is clashing operators.

I can close this PR in favor of yours. I just wanted to see what needs to be done and it seems moving up is non-trivial.

@vlstill
Copy link
Member

vlstill commented Jan 23, 2024

I started looking at this some time ago in #4297. I was probably too sneaky though. Still not complete, there is quite lot of things that break and I don't have much time for it now. The main problem is clashing operators.

I can close this PR in favor of yours. I just wanted to see what needs to be done and it seems moving up is non-trivial.

OK. Yes, it does not seem as easy as was the move to C++17.

@fruffy fruffy closed this Jan 23, 2024
@fruffy fruffy deleted the fruffy/C++20 branch January 23, 2024 16:49
@fruffy fruffy restored the fruffy/C++20 branch April 11, 2024 18:01
@fruffy fruffy reopened this Apr 11, 2024
@fruffy fruffy added run-ubuntu18 Use this tag to trigger a Ubuntu-18 CI run. run-sanitizer Use this tag to run a Clang+Sanitzers CI run. run-static Use this tag to trigger static build CI run. labels Apr 11, 2024
@fruffy fruffy marked this pull request as ready for review May 31, 2024 12:41
@fruffy
Copy link
Collaborator Author

fruffy commented May 31, 2024

There is not much missing for C++20 support. It looks like there is just one small failure left.

@vlstill
Copy link
Member

vlstill commented May 31, 2024

Hmm, the error is in boost, that might be hard to fix unless it is our bad usage of boost of course :-). Seems to be related to a particular version as it fails just in the sanitizers build.

What are your thoughts on switching? Do you think it is time for that? We don't get many goodies until we bump minimal required GCC, but even some things from GCC 9 are nice. It would also unlock C++20 for downstreams that have newer compilers. On the other hand, we would be having a more experimental setup, with GCC that is far from stable on C++20.

@fruffy
Copy link
Collaborator Author

fruffy commented May 31, 2024

Hmm, the error is in boost, that might be hard to fix unless it is our bad usage of boost of course :-). Seems to be related to a particular version as it fails just in the sanitizers build.

The boost version should be the same for Ubuntu 20.04 but this compiler is Clang. Maybe that is the reason.

What are your thoughts on switching? Do you think it is time for that? We don't get many goodies until we bump minimal required GCC, but even some things from GCC 9 are nice. It would also unlock C++20 for downstreams that have newer compilers. On the other hand, we would be having a more experimental setup, with GCC that is far from stable on C++20.

I am happy to switch, there are some folks that have been waiting for us to upgrade to C++20 already. We can try to be conservative with the features we introduce and keep Ubuntu 20.04 as the minimum supported version until it hits EOL.

@fruffy fruffy changed the title Switch from C++17 to C++20. Switch compilation from C++17 to C++20. May 31, 2024
@fruffy
Copy link
Collaborator Author

fruffy commented May 31, 2024

Hmm, the error is in boost, that might be hard to fix unless it is our bad usage of boost of course :-). Seems to be related to a particular version as it fails just in the sanitizers build.

Cherrypicking #4663 fixes the issue. There were two more small fixes required which I can fork into a separate PR.

@vlstill
Copy link
Member

vlstill commented Jun 3, 2024

Hmm, the error is in boost, that might be hard to fix unless it is our bad usage of boost of course :-). Seems to be related to a particular version as it fails just in the sanitizers build.

Cherrypicking #4663 fixes the issue. There were two more small fixes required which I can fork into a separate PR.

Personally I'm OK with the operator fixes to be there, but the boost should be separate.

@vlstill
Copy link
Member

vlstill commented Jun 3, 2024

I've just notice that docs/C++.md still mentions C++11. No point fixing it to 17 now, but should be fixed when we switch to C++20.

@fruffy
Copy link
Collaborator Author

fruffy commented Jun 3, 2024

Personally I'm OK with the operator fixes to be there, but the boost should be separate.

Yes, the changes were for testing purposes, I will move them into separate PRs.

@fruffy fruffy force-pushed the fruffy/C++20 branch 3 times, most recently from 63d7c31 to 07beb28 Compare June 3, 2024 18:08
@fruffy
Copy link
Collaborator Author

fruffy commented Jun 3, 2024

It looks like there is very little that can be done to fix the compilation issue sans fixing boost. I am not sure why this pops up with clang only though.

@fruffy fruffy force-pushed the fruffy/C++20 branch 2 times, most recently from ff023c7 to c13b298 Compare April 12, 2025 19:38
@fruffy fruffy force-pushed the fruffy/C++20 branch 2 times, most recently from 51bcc1b to 5ddbf9a Compare May 19, 2025 00:57
@fruffy fruffy force-pushed the fruffy/C++20 branch 3 times, most recently from aa8e764 to c50c865 Compare May 25, 2025 00:21
@fruffy fruffy force-pushed the fruffy/C++20 branch 3 times, most recently from 221a4c6 to 9c957ce Compare June 15, 2025 17:41
@fruffy fruffy requested review from asl, kfcripps and vlstill July 5, 2025 17:38
@fruffy fruffy added the breaking-change This change may break assumptions of compiler back ends. label Jul 5, 2025
@fruffy fruffy requested a review from smolkaj July 5, 2025 19:19
Copy link
Member

@smolkaj smolkaj left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

Copy link
Contributor

@asl asl left a comment

Choose a reason for hiding this comment

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

Looks trivial enough!

@fruffy
Copy link
Collaborator Author

fruffy commented Jul 12, 2025

@jafingerhut @vlstill Any concerns or objections? I am planning to pull the trigger and switch the next week.

@jafingerhut
Copy link
Contributor

@jafingerhut @vlstill Any concerns or objections? I am planning to pull the trigger and switch the next week.

No concerns or objections from me. It looks like you have a good variety of reviews from other folks, which is good.

@fruffy fruffy added this pull request to the merge queue Jul 15, 2025
Merged via the queue into main with commit 4d0e0da Jul 15, 2025
22 of 23 checks passed
@fruffy fruffy deleted the fruffy/C++20 branch July 15, 2025 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change This change may break assumptions of compiler back ends. core Topics concerning the core segments of the compiler (frontend, midend, parser) p4tc Topics related to the P4-TC back end. On PRs, also triggers p4tc CI tests to run. run-sanitizer Use this tag to run a Clang+Sanitzers CI run. run-static Use this tag to trigger static build CI run. run-ubuntu18 Use this tag to trigger a Ubuntu-18 CI run. run-validation Use this tag to trigger a Validation CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants