Skip to content

Commit f20423f

Browse files
authored
[clang] Rename -Wdeprecated-switch-case to -Wdeprecated-declarations-switch-case (#141779)
To make it more clear that it's a subset of -Wdeprecated-declarations. Follow-up to #138562
1 parent f48f844 commit f20423f

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,8 @@ Improvements to Clang's diagnostics
575575

576576
- ``-Wswitch`` will now diagnose unhandled enumerators in switches also when
577577
the enumerator is deprecated. Warnings about using deprecated enumerators in
578-
switch cases have moved behind a new ``-Wdeprecated-switch-case`` flag.
578+
switch cases have moved behind a new ``-Wdeprecated-declarations-switch-case``
579+
flag.
579580

580581
For example:
581582

@@ -598,7 +599,7 @@ Improvements to Clang's diagnostics
598599
The warning can be fixed either by adding a ``default:``, or by adding
599600
``case Blue:``. Since the enumerator is deprecated, the latter approach will
600601
trigger a ``'Blue' is deprecated`` warning, which can be turned off with
601-
``-Wno-deprecated-switch-case``.
602+
``-Wno-deprecated-declarations-switch-case``.
602603

603604
Improvements to Clang's time-trace
604605
----------------------------------

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ def DeprecatedCopyWithDtor : DiagGroup<"deprecated-copy-with-dtor", [DeprecatedC
234234
def DeprecatedLiteralOperator : DiagGroup<"deprecated-literal-operator">;
235235
// For compatibility with GCC.
236236
def : DiagGroup<"deprecated-copy-dtor", [DeprecatedCopyWithDtor]>;
237-
def DeprecatedSwitchCase : DiagGroup<"deprecated-switch-case">;
238-
def DeprecatedDeclarations : DiagGroup<"deprecated-declarations", [DeprecatedSwitchCase]>;
237+
def DeprecatedDeclarationsSwitchCase : DiagGroup<"deprecated-declarations-switch-case">;
238+
def DeprecatedDeclarations : DiagGroup<"deprecated-declarations", [DeprecatedDeclarationsSwitchCase]>;
239239
def DeprecatedRedundantConstexprStaticDef : DiagGroup<"deprecated-redundant-constexpr-static-def">;
240240
def UnavailableDeclarations : DiagGroup<"unavailable-declarations">;
241241
def UnguardedAvailabilityNew : DiagGroup<"unguarded-availability-new">;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6065,7 +6065,7 @@ def err_undeclared_use : Error<"use of undeclared %0">;
60656065
def warn_deprecated : Warning<"%0 is deprecated">,
60666066
InGroup<DeprecatedDeclarations>;
60676067
def warn_deprecated_switch_case : Warning<warn_deprecated.Summary>,
6068-
InGroup<DeprecatedSwitchCase>;
6068+
InGroup<DeprecatedDeclarationsSwitchCase>;
60696069
def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
60706070
def warn_property_method_deprecated :
60716071
Warning<"property access is using %0 method which is deprecated">,

clang/test/Sema/switch-availability.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -verify -Wswitch -Wreturn-type -triple x86_64-apple-macosx10.12 %s
2-
// RUN: %clang_cc1 -verify -Wswitch -Wreturn-type -Wno-deprecated-switch-case -DNO_DEPRECATED_CASE -triple x86_64-apple-macosx10.12 %s
2+
// RUN: %clang_cc1 -verify -Wswitch -Wreturn-type -Wno-deprecated-declarations-switch-case -DNO_DEPRECATED_CASE -triple x86_64-apple-macosx10.12 %s
33

44
enum SwitchOne {
55
Unavail __attribute__((availability(macos, unavailable))),

0 commit comments

Comments
 (0)