Skip to content

[clang] Rename -Wdeprecated-switch-case to -Wdeprecated-declarations-switch-case #141779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2025

Conversation

zmodem
Copy link
Collaborator

@zmodem zmodem commented May 28, 2025

To make it more clear that it's a subset of -Wdeprecated-declarations.

Follow-up to #138562

…switch-case

To make it more clear that it's a subset of -Wdeprecated-declarations.

Follow-up to llvm#138562
@zmodem zmodem requested review from nico, rnk, cor3ntin and AaronBallman May 28, 2025 14:42
@zmodem zmodem added the clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer label May 28, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels May 28, 2025
@llvmbot
Copy link
Member

llvmbot commented May 28, 2025

@llvm/pr-subscribers-clang

Author: Hans Wennborg (zmodem)

Changes

To make it more clear that it's a subset of -Wdeprecated-declarations.

Follow-up to #138562


Full diff: https://github.com/llvm/llvm-project/pull/141779.diff

3 Files Affected:

  • (modified) clang/include/clang/Basic/DiagnosticGroups.td (+2-2)
  • (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+1-1)
  • (modified) clang/test/Sema/switch-availability.c (+1-1)
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))),

Copy link
Contributor

@nico nico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nico
Copy link
Contributor

nico commented May 28, 2025

@zmodem
Copy link
Collaborator Author

zmodem commented May 28, 2025

Thanks! Ironically, ReleaseNotes.rst is where I started my patch, but I forgot to actually update it :)

@zmodem zmodem merged commit f20423f into llvm:main May 28, 2025
9 of 11 checks passed
google-yfyang pushed a commit to google-yfyang/llvm-project that referenced this pull request May 29, 2025
…switch-case (llvm#141779)

To make it more clear that it's a subset of -Wdeprecated-declarations.

Follow-up to llvm#138562
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…switch-case (llvm#141779)

To make it more clear that it's a subset of -Wdeprecated-declarations.

Follow-up to llvm#138562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants