[clang] [clang] Rename -Wdeprecated-switch-case to -Wdeprecated-declarations-switch-case (PR #141779)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Wed May 28 12:34:54 PDT 2025
https://github.com/zmodem updated https://github.com/llvm/llvm-project/pull/141779
>From ca8e6ce98db72d3b37a26b59bda5ed4c8b7a6ed5 Mon Sep 17 00:00:00 2001
From: Hans Wennborg <hans at chromium.org>
Date: Wed, 28 May 2025 16:35:16 +0200
Subject: [PATCH 1/2] [clang] Rename -Wdeprecated-switch-case to
-Wdeprecated-declarations-switch-case
To make it more clear that it's a subset of -Wdeprecated-declarations.
Follow-up to #138562
---
clang/include/clang/Basic/DiagnosticGroups.td | 4 ++--
clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 +-
clang/test/Sema/switch-availability.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index ff1dfc3e40d1a..abb5cefb1d2bb 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -234,8 +234,8 @@ def DeprecatedCopyWithDtor : DiagGroup<"deprecated-copy-with-dtor", [DeprecatedC
def DeprecatedLiteralOperator : DiagGroup<"deprecated-literal-operator">;
// For compatibility with GCC.
def : DiagGroup<"deprecated-copy-dtor", [DeprecatedCopyWithDtor]>;
-def DeprecatedSwitchCase : DiagGroup<"deprecated-switch-case">;
-def DeprecatedDeclarations : DiagGroup<"deprecated-declarations", [DeprecatedSwitchCase]>;
+def DeprecatedDeclarationsSwitchCase : DiagGroup<"deprecated-declarations-switch-case">;
+def DeprecatedDeclarations : DiagGroup<"deprecated-declarations", [DeprecatedDeclarationsSwitchCase]>;
def DeprecatedRedundantConstexprStaticDef : DiagGroup<"deprecated-redundant-constexpr-static-def">;
def UnavailableDeclarations : DiagGroup<"unavailable-declarations">;
def UnguardedAvailabilityNew : DiagGroup<"unguarded-availability-new">;
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 11bd7a8edfd72..8a879f7ca5529 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6065,7 +6065,7 @@ def err_undeclared_use : Error<"use of undeclared %0">;
def warn_deprecated : Warning<"%0 is deprecated">,
InGroup<DeprecatedDeclarations>;
def warn_deprecated_switch_case : Warning<warn_deprecated.Summary>,
- InGroup<DeprecatedSwitchCase>;
+ InGroup<DeprecatedDeclarationsSwitchCase>;
def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
def warn_property_method_deprecated :
Warning<"property access is using %0 method which is deprecated">,
diff --git a/clang/test/Sema/switch-availability.c b/clang/test/Sema/switch-availability.c
index 517b3f100b24c..6077790910fda 100644
--- a/clang/test/Sema/switch-availability.c
+++ b/clang/test/Sema/switch-availability.c
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -verify -Wswitch -Wreturn-type -triple x86_64-apple-macosx10.12 %s
-// RUN: %clang_cc1 -verify -Wswitch -Wreturn-type -Wno-deprecated-switch-case -DNO_DEPRECATED_CASE -triple x86_64-apple-macosx10.12 %s
+// RUN: %clang_cc1 -verify -Wswitch -Wreturn-type -Wno-deprecated-declarations-switch-case -DNO_DEPRECATED_CASE -triple x86_64-apple-macosx10.12 %s
enum SwitchOne {
Unavail __attribute__((availability(macos, unavailable))),
>From 7b7bf408bf8bbc11b285f0769530e03e830ba811 Mon Sep 17 00:00:00 2001
From: Hans Wennborg <hans at chromium.org>
Date: Wed, 28 May 2025 21:34:06 +0200
Subject: [PATCH 2/2] update the release notes
---
clang/docs/ReleaseNotes.rst | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index b21b683fb1360..540552bc47e8d 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -575,7 +575,8 @@ Improvements to Clang's diagnostics
- ``-Wswitch`` will now diagnose unhandled enumerators in switches also when
the enumerator is deprecated. Warnings about using deprecated enumerators in
- switch cases have moved behind a new ``-Wdeprecated-switch-case`` flag.
+ switch cases have moved behind a new ``-Wdeprecated-declarations-switch-case``
+ flag.
For example:
@@ -598,7 +599,7 @@ Improvements to Clang's diagnostics
The warning can be fixed either by adding a ``default:``, or by adding
``case Blue:``. Since the enumerator is deprecated, the latter approach will
trigger a ``'Blue' is deprecated`` warning, which can be turned off with
- ``-Wno-deprecated-switch-case``.
+ ``-Wno-deprecated-declarations-switch-case``.
Improvements to Clang's time-trace
----------------------------------
More information about the cfe-commits
mailing list