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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
----------------------------------
Expand Down
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -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">;
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -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">,
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Sema/switch-availability.c
Original file line number Diff line number Diff line change
@@ -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))),
Expand Down