[clang] [clang] Add C++26 diagnostics to compatibility diagnosic groups (PR #97806)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 5 02:43:30 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Vlad Serebrennikov (Endilll)
<details>
<summary>Changes</summary>
This patch adds `CXXPre26Compat` and `CXXPre26CompatPedantic` groups (which are concerned with new features not available in older language modes) to `CXX98Compat`, etc. This way, if user has `-Wc++20-compat` and they use pack indexing, they will be warned.
Ideally this should have been done when C++26 groups were created, but we shipped two releases of Clang since then.
---
Full diff: https://github.com/llvm/llvm-project/pull/97806.diff
2 Files Affected:
- (modified) clang/docs/ReleaseNotes.rst (+4)
- (modified) clang/include/clang/Basic/DiagnosticGroups.td (+20-10)
``````````diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 36cf615a4287c..cf1b529eb7321 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -476,6 +476,10 @@ Modified Compiler Flags
evaluating to ``true`` and an empty body such as ``while(1);``)
are considered infinite, even when the ``-ffinite-loop`` flag is set.
+- Diagnostics groups about compatibility with a particular C++ Standard version
+ now include dianostics about C++26 features that are not present in older
+ versions.
+
Removed Compiler Flags
-------------------------
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 9431eea1f6be2..a4496431e46e4 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -344,7 +344,8 @@ def CXX98Compat : DiagGroup<"c++98-compat",
CXXPre14Compat,
CXXPre17Compat,
CXXPre20Compat,
- CXXPre23Compat]>;
+ CXXPre23Compat,
+ CXXPre26Compat]>;
// Warnings for C++11 features which are Extensions in C++98 mode.
def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic",
[CXX98Compat,
@@ -353,7 +354,8 @@ def CXX98CompatPedantic : DiagGroup<"c++98-compat-pedantic",
CXXPre14CompatPedantic,
CXXPre17CompatPedantic,
CXXPre20CompatPedantic,
- CXXPre23CompatPedantic]>;
+ CXXPre23CompatPedantic,
+ CXXPre26CompatPedantic]>;
def CXX11NarrowingConstReference : DiagGroup<"c++11-narrowing-const-reference">;
def CXX11Narrowing : DiagGroup<"c++11-narrowing", [CXX11NarrowingConstReference]>;
@@ -384,39 +386,47 @@ def CXX11Compat : DiagGroup<"c++11-compat",
CXXPre14Compat,
CXXPre17Compat,
CXXPre20Compat,
- CXXPre23Compat]>;
+ CXXPre23Compat,
+ CXXPre26Compat]>;
def : DiagGroup<"c++0x-compat", [CXX11Compat]>;
def CXX11CompatPedantic : DiagGroup<"c++11-compat-pedantic",
[CXX11Compat,
CXXPre14CompatPedantic,
CXXPre17CompatPedantic,
CXXPre20CompatPedantic,
- CXXPre23CompatPedantic]>;
+ CXXPre23CompatPedantic,
+ CXXPre26CompatPedantic]>;
def CXX14Compat : DiagGroup<"c++14-compat", [CXXPre17Compat,
CXXPre20Compat,
- CXXPre23Compat]>;
+ CXXPre23Compat,
+ CXXPre26Compat]>;
def CXX14CompatPedantic : DiagGroup<"c++14-compat-pedantic",
[CXX14Compat,
CXXPre17CompatPedantic,
CXXPre20CompatPedantic,
- CXXPre23CompatPedantic]>;
+ CXXPre23CompatPedantic,
+ CXXPre26CompatPedantic]>;
def CXX17Compat : DiagGroup<"c++17-compat", [DeprecatedRegister,
DeprecatedIncrementBool,
CXX17CompatMangling,
CXXPre20Compat,
- CXXPre23Compat]>;
+ CXXPre23Compat,
+ CXXPre26Compat]>;
def CXX17CompatPedantic : DiagGroup<"c++17-compat-pedantic",
[CXX17Compat,
CXXPre20CompatPedantic,
- CXXPre23CompatPedantic]>;
+ CXXPre23CompatPedantic,
+ CXXPre26CompatPedantic]>;
def : DiagGroup<"c++1z-compat", [CXX17Compat]>;
-def CXX20Compat : DiagGroup<"c++20-compat", [CXXPre23Compat]>;
+def CXX20Compat : DiagGroup<"c++20-compat", [CXXPre23Compat,
+ CXXPre26Compat]>;
def CXX20CompatPedantic : DiagGroup<"c++20-compat-pedantic",
[CXX20Compat,
- CXXPre23CompatPedantic]>;
+ CXXPre23CompatPedantic,
+ CXXPre26CompatPedantic]>;
def : DiagGroup<"c++2a-compat", [CXX20Compat]>;
def : DiagGroup<"c++2a-compat-pedantic", [CXX20CompatPedantic]>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/97806
More information about the cfe-commits
mailing list