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
Details
- Reviewers
aaron.ballman Mordante cor3ntin MaskRay - Group Reviewers
Restricted Project - Commits
- rGb763d6a4ed46: Add C++26 compile flags.
Diff Detail
Event Timeline
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? |
Similar PR here https://reviews.llvm.org/D149875
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 |
clang/lib/Frontend/InitPreprocessor.cpp | ||
---|---|---|
456 | In the DIS __cplusplus is 202302L |
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 | ||
---|---|---|
462 | Note this has been committed in the draft for N4950. |
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 | ||
---|---|---|
6650 | The CI will fail in the test clang/test/Driver/cl-options.c | |
clang/test/Preprocessor/init.c | ||
22 | I had noticed I missed this too, this landed earlier today D150063. |
clang/docs/ReleaseNotes.rst | ||
---|---|---|
114 | double backsticks. |
Added double-backticks, updated the tests for the new __cplusplus entries I changed during review.
clang/include/clang/Basic/LangStandard.h | ||
---|---|---|
128 | 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. |
clang/lib/Driver/ToolChains/Clang.cpp | ||
---|---|---|
6649 |
clang/www/cxx_status.html | ||
---|---|---|
1568 | This sounds like an excellent improvement. |
clang/lib/Frontend/InitPreprocessor.cpp | ||
---|---|---|
463 | Separate patch / commit? |
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. | |
1120 | 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 | ||
128 | ||
clang/include/clang/Basic/LangStandards.def | ||
167 | We should probably drop ISO from this as we did above? | |
clang/lib/Frontend/InitPreprocessor.cpp | ||
461 | 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. | |
463 | 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. |
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 | ||
461 | 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! |
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.)