[clang] be3a8b8 - [clang] Add C++26 diagnostics to compatibility diagnosic groups (#97806)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 6 04:52:23 PDT 2024
Author: Vlad Serebrennikov
Date: 2024-07-06T15:52:19+04:00
New Revision: be3a8b8d94608746b22cb0cf3fc03af33b7d8648
URL: https://github.com/llvm/llvm-project/commit/be3a8b8d94608746b22cb0cf3fc03af33b7d8648
DIFF: https://github.com/llvm/llvm-project/commit/be3a8b8d94608746b22cb0cf3fc03af33b7d8648.diff
LOG: [clang] Add C++26 diagnostics to compatibility diagnosic groups (#97806)
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.
Added:
Modified:
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticGroups.td
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d60c6fbf15d56..39187078d5786 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -439,8 +439,11 @@ New Compiler Flags
Matches MSVC behaviour by defining ``__STDC__`` to ``1`` when
MSVC compatibility mode is used. It has no effect for C++ code.
+- ``-Wc++23-compat`` group was added to help migrating existing codebases
+ to C++23.
+
- ``-Wc++2c-compat`` group was added to help migrating existing codebases
- to C++26.
+ to upcoming C++26.
Deprecated Compiler Flags
-------------------------
@@ -480,6 +483,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 1b25cf36dd4f8..2241f8481484e 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,42 +386,52 @@ 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]>;
+def CXX23Compat : DiagGroup<"c++23-compat", [CXXPre26Compat]>;
+
def CXX26Compat : DiagGroup<"c++2c-compat", [DeleteIncomplete]>;
def ExitTimeDestructors : DiagGroup<"exit-time-destructors">;
More information about the cfe-commits
mailing list