This is an archive of the discontinued LLVM Phabricator instance.

Add C++26 compile flags.
ClosedPublic

Authored by erichkeane on May 12 2023, 7:33 AM.

Details

Reviewers
aaron.ballman
Mordante
cor3ntin
MaskRay
Group Reviewers
Restricted Project
Commits
rGb763d6a4ed46: Add C++26 compile flags.
Summary

Now that we've updated to C++23, we need to add C++26/C++2c command line
flags, as discussed in
https://discourse.llvm.org/t/rfc-lets-just-call-it-c-26-and-forget-about-the-c-2c-business-at-least-internally/70383

Diff Detail

Event Timeline

erichkeane created this revision.May 12 2023, 7:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2023, 7:33 AM
erichkeane requested review of this revision.May 12 2023, 7:33 AM
erichkeane added inline comments.May 12 2023, 7:36 AM
clang/include/clang/Basic/DiagnosticGroups.td
310

Aaron: note the names of the diag groups: would you prefer this to be c++2c?

clang/include/clang/Basic/LangOptions.def
101

It isn't clear to me what the string here is used to output, so not sure if this should be 2c.

clang/include/clang/Basic/LangStandards.def
170

Note I made the c++26/gnu++26 values an alias, when we come to update this for C++26's release, this will be added to the LANGSTANDARD, and c++2c/gnu++2c should become an ALIAS_DEPR

clang/lib/Frontend/InitPreprocessor.cpp
456

At the moment, I just chose '1 more than c++23', but that hasn't been set yet. Once we have the final value, we should make this 1 more than 23's official value.

clang/www/OpenProjects.html
126

Should this spot in the docs be C++2c?

clang/docs/ReleaseNotes.rst
114

This should be 2c

clang/lib/Frontend/InitPreprocessor.cpp
456

A value lesser than 202401L seems super confusing to me

clang/www/OpenProjects.html
126

I think so

cor3ntin added inline comments.May 12 2023, 8:00 AM
clang/lib/Frontend/InitPreprocessor.cpp
456

In the DIS __cplusplus is 202302L

erichkeane marked 4 inline comments as done.May 12 2023, 8:39 AM
erichkeane added a subscriber: Mordante.

Ah! I'd not noticed that one (or maybe someone mentioned it?). If @Mordante wants to take this over/change his to meet our RFC, I'm all for it.

Update based on @cor3ntin s feedback.

Ah! I'd not noticed that one (or maybe someone mentioned it?). If @Mordante wants to take this over/change his to meet our RFC, I'm all for it.

I've mentioned it in https://discourse.llvm.org/t/rfc-lets-just-call-it-c-26-and-forget-about-the-c-2c-business-at-least-internally/70383/3 to avoid duplicated effort.

It seems, as expected. the patches have a large overlap, but you added a bit more of the status page and I updated the clang-cl driver.

I just updated my patch before I saw this update in the mail.

clang/lib/Frontend/InitPreprocessor.cpp
461
erichkeane marked an inline comment as done.

fix init-preprocessor, remove fixme.

Ah! I'd not noticed that one (or maybe someone mentioned it?). If @Mordante wants to take this over/change his to meet our RFC, I'm all for it.

I've mentioned it in https://discourse.llvm.org/t/rfc-lets-just-call-it-c-26-and-forget-about-the-c-2c-business-at-least-internally/70383/3 to avoid duplicated effort.

It seems, as expected. the patches have a large overlap, but you added a bit more of the status page and I updated the clang-cl driver.

I just updated my patch before I saw this update in the mail.

Woops, looks like that was long enough ago I completely forgot about it :)

Completely up to you if you want to just steal my stuff and we can go with your review, or you want to just help me fill in anything I missed here.

Added clang-cl versioning as stolen from @Mordante

Mordante accepted this revision.May 12 2023, 9:31 AM

Ah! I'd not noticed that one (or maybe someone mentioned it?). If @Mordante wants to take this over/change his to meet our RFC, I'm all for it.

I've mentioned it in https://discourse.llvm.org/t/rfc-lets-just-call-it-c-26-and-forget-about-the-c-2c-business-at-least-internally/70383/3 to avoid duplicated effort.

It seems, as expected. the patches have a large overlap, but you added a bit more of the status page and I updated the clang-cl driver.

I just updated my patch before I saw this update in the mail.

Woops, looks like that was long enough ago I completely forgot about it :)

Completely up to you if you want to just steal my stuff and we can go with your review, or you want to just help me fill in anything I missed here.

No problem. I think it's easier to land this patch instead of me stealing your work.
I mainly care that Clang get C++2c support so I can prepare libc++ for C++2c.

LGTM after clang/test/Driver/cl-options.c is fixed.

clang/lib/Driver/ToolChains/Clang.cpp
6664–6665

The CI will fail in the test clang/test/Driver/cl-options.c
see https://reviews.llvm.org/D149875#change-s8WC0AhDg4dT

clang/test/Preprocessor/init.c
22

I had noticed I missed this too, this landed earlier today D150063.

This revision is now accepted and ready to land.May 12 2023, 9:31 AM

Updated last few things @Mordante mentioned, did a rebase.

cor3ntin accepted this revision.May 12 2023, 9:51 AM

LGTM. I'm looking forward to start implementing upcoming proposals

MaskRay accepted this revision.May 12 2023, 11:29 AM
MaskRay added inline comments.
clang/docs/ReleaseNotes.rst
114

double backsticks.

erichkeane marked an inline comment as done.

Added double-backticks, updated the tests for the new __cplusplus entries I changed during review.

h-vetinari added inline comments.
clang/include/clang/Basic/LangStandard.h
131

Spuriously removed slash

clang/www/cxx_status.html
1568

The longer this page gets, the more I feel it should be sorted in reverse chronological order of the standard versions. It's bothersome IMO to keep scrolling past almost-fully implemented standards (currently the tables for C++17 & C++20) before getting to see the status of the latest & greatest.

https://en.cppreference.com/w/cpp/compiler_support is sorted in reverse order as well.

shafik added a subscriber: shafik.May 12 2023, 7:02 PM
shafik added inline comments.
clang/lib/Driver/ToolChains/Clang.cpp
6663–6664
cor3ntin added inline comments.May 13 2023, 12:25 AM
clang/www/cxx_status.html
1568

This sounds like an excellent improvement.
Erich, would you rather do that in this pr, or i can submit a different patch afterwards?

xbolva00 added inline comments.
clang/lib/Frontend/InitPreprocessor.cpp
462

Separate patch / commit?

aaron.ballman added inline comments.May 15 2023, 5:10 AM
clang/docs/CommandGuide/clang.rst
206–210

We shouldn't call it ISO C++ 2026 until it's published by ISO. (I don't have strong opinions about 2c vs 26 in there, but since we need to update it anyway when 26 is released, I figured it'd be easier to find again with 2c.)

clang/docs/ReleaseNotes.rst
114
clang/include/clang/Basic/DiagnosticGroups.td
310

Let's go ahead and add the alias so that either c++2c or c++26 works.

1122

Same here as above.

clang/include/clang/Basic/LangOptions.def
101

The only place this matters is when dumping information about a module file for debugging purposes, so I don't think it's critical this be named 2c.

clang/include/clang/Basic/LangStandard.h
131
clang/include/clang/Basic/LangStandards.def
167

We should probably drop ISO from this as we did above?

clang/lib/Frontend/InitPreprocessor.cpp
460

This value is fine by me, but we should probably coordinate with the GCC folks so we don't wind up with two different values between us.

462

Agreed, the change for C++23 should be done in a separate patch.

clang/www/OpenProjects.html
126

Agreed -- basically, if it's user-facing, it should be 2c, and if it's internal to the project, it should be 26.

clang/www/cxx_status.html
1568

I love the idea, and I think it should be done in a separate patch.

erichkeane marked 8 inline comments as done.May 15 2023, 8:07 AM
erichkeane added inline comments.
clang/docs/CommandGuide/clang.rst
206–210

Ah, I just copied from what we had for C++23 before the flip. But this makes sense, I chose 2c for the reason you mentioned.

clang/lib/Frontend/InitPreprocessor.cpp
460

Email sent to GCC maintainer (aaron copied!).

clang/www/cxx_status.html
1568

Corentin: you're welcome to do it in a different patch, but I like the idea as well!

Mordante added inline comments.May 15 2023, 8:10 AM
clang/docs/CommandGuide/clang.rst
206–210

Note that before D149553 similar wording was used for C++2b "Working draft for ISO C++ 2023".

Aarons comments, split 23 changes into a separate patch and rebased.

erichkeane added inline comments.May 15 2023, 8:40 AM
clang/lib/Frontend/InitPreprocessor.cpp
456

GCC is going to go with 202400L, so that is what we're going to do.

460

GCC is going to go with 202400L, so that is what we're going to do.

change __cplusplus to match GCC's plan.

aaron.ballman accepted this revision.May 15 2023, 8:48 AM

LGTM, thank you Erich!

This revision was landed with ongoing or failed builds.May 15 2023, 8:56 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2023, 8:56 AM