[PATCH] D97871: Update diagnostic groups for pre-compat warnings

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 3 09:52:31 PST 2021


aaron.ballman created this revision.
aaron.ballman added reviewers: rsmith, rjmccall.
aaron.ballman requested review of this revision.
Herald added a project: clang.

As a follow-up to D95691 <https://reviews.llvm.org/D95691>, add new diagnostic groups named `pre-c++N-compat` to replace the old diagnostic groups with the standards listed out explicitly. The old group names are retained for backwards compatibility.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97871

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/test/Parser/static_assert.c
  clang/test/SemaCXX/cxx98-compat-pedantic.cpp
  clang/test/SemaCXX/inline.cpp


Index: clang/test/SemaCXX/inline.cpp
===================================================================
--- clang/test/SemaCXX/inline.cpp
+++ clang/test/SemaCXX/inline.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wc++98-c++11-c++14-compat
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s -Wpre-c++17-compat
 
 // Check that we don't allow illegal uses of inline
 // (checking C++-only constructs here)
Index: clang/test/SemaCXX/cxx98-compat-pedantic.cpp
===================================================================
--- clang/test/SemaCXX/cxx98-compat-pedantic.cpp
+++ clang/test/SemaCXX/cxx98-compat-pedantic.cpp
@@ -4,7 +4,7 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -Werror %s
 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror %s -DCXX98
 
-// RUN: %clang_cc1 -fsyntax-only -std=c++1y -Wc++98-compat-pedantic -verify %s -Wno-c++98-c++11-compat-pedantic -DCXX1Y2
+// RUN: %clang_cc1 -fsyntax-only -std=c++1y -Wc++98-compat-pedantic -verify %s -Wno-pre-c++14-compat-pedantic -DCXX1Y2
 
 // -Wc++98-compat-pedantic warns on C++11 features which we accept without a
 // warning in C++98 mode.
Index: clang/test/Parser/static_assert.c
===================================================================
--- clang/test/Parser/static_assert.c
+++ clang/test/Parser/static_assert.c
@@ -7,7 +7,7 @@
 // RUN: %clang_cc1 -fsyntax-only -std=c++17 -pedantic -verify=cxx17-pedantic -x c++ %s
 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify=cxx98 -x c++ %s
 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -pedantic -verify=cxx98-pedantic -x c++ %s
-// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wc++98-c++11-c++14-compat -verify=cxx17-compat -x c++ %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -Wpre-c++17-compat -verify=cxx17-compat -x c++ %s
 
 // cxx17-no-diagnostics
 
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -253,22 +253,30 @@
 // Name of this warning in GCC.
 def NoexceptType : DiagGroup<"noexcept-type", [CXX17CompatMangling]>;
 
-// Warnings for C2x code which is not compatible with prior C standards.
+// Warnings for C code which is not compatible with previous C standards.
 def CPre2xCompat : DiagGroup<"pre-c2x-compat">;
 def CPre2xCompatPedantic : DiagGroup<"pre-c2x-compat-pedantic",
                                      [CPre2xCompat]>;
 
-// Warnings for C++1y code which is not compatible with prior C++ standards.
-def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">;
-def CXXPre14CompatPedantic : DiagGroup<"c++98-c++11-compat-pedantic",
+// Warnings for C++ code which is not compatible with previous C++ standards.
+def CXXPre14Compat : DiagGroup<"pre-c++14-compat">;
+def : DiagGroup<"c++98-c++11-compat", [CXXPre14Compat]>;
+def CXXPre14CompatPedantic : DiagGroup<"pre-c++14-compat-pedantic",
                                        [CXXPre14Compat,
                                         CXXPre14CompatBinaryLiteral]>;
-def CXXPre17Compat : DiagGroup<"c++98-c++11-c++14-compat">;
-def CXXPre17CompatPedantic : DiagGroup<"c++98-c++11-c++14-compat-pedantic",
+def : DiagGroup<"c++98-c++11-compat-pedantic", [CXXPre14CompatPedantic]>;
+def CXXPre17Compat : DiagGroup<"pre-c++17-compat">;
+def : DiagGroup<"c++98-c++11-c++14-compat", [CXXPre17Compat]>;
+def CXXPre17CompatPedantic : DiagGroup<"pre-c++17-compat-pedantic",
                                        [CXXPre17Compat]>;
-def CXXPre20Compat : DiagGroup<"c++98-c++11-c++14-c++17-compat">;
-def CXXPre20CompatPedantic : DiagGroup<"c++98-c++11-c++14-c++17-compat-pedantic",
+def : DiagGroup<"c++98-c++11-c++14-compat-pedantic",
+                [CXXPre17CompatPedantic]>;
+def CXXPre20Compat : DiagGroup<"pre-c++20-compat">;
+def : DiagGroup<"c++98-c++11-c++14-c++17-compat", [CXXPre20Compat]>;
+def CXXPre20CompatPedantic : DiagGroup<"pre-c++20-compat-pedantic",
                                        [CXXPre20Compat]>;
+def : DiagGroup<"c++98-c++11-c++14-c++17-compat-pedantic",
+                [CXXPre20CompatPedantic]>;
 def CXXPre2bCompat : DiagGroup<"pre-c++2b-compat">;
 def CXXPre2bCompatPedantic :
   DiagGroup<"pre-c++2b-compat-pedantic", [CXXPre2bCompat]>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97871.327834.patch
Type: text/x-patch
Size: 4402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210303/847e71f0/attachment.bin>


More information about the cfe-commits mailing list