Rewording the diagnostic to be more precise/correct: "default label in switch
which covers all enumeration values" and changed the switch to
-Wcovered-switch-default
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148783
91177308-0d34-0410-b5e6-
96231b3b80d8
def StrictSelector : DiagGroup<"strict-selector-match">;
def MethodDuplicate : DiagGroup<"duplicate-method-match">;
def SwitchEnum : DiagGroup<"switch-enum">;
-def SwitchRedundantDefault : DiagGroup<"switch-redundant-default">;
-def Switch : DiagGroup<"switch", [SwitchRedundantDefault]>;
+def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
+def Switch : DiagGroup<"switch", [CoveredSwitchDefault]>;
def Trigraphs : DiagGroup<"trigraphs">;
def : DiagGroup<"type-limits">;
InGroup<Switch>;
def warn_unreachable_default : Warning<
- "default is unreachable as all enumeration values are accounted for">,
- InGroup<SwitchRedundantDefault>;
+ "default label in switch which covers all enumeration values">,
+ InGroup<CoveredSwitchDefault>;
def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
InGroup<Switch>;
def err_typecheck_statement_requires_scalar : Error<
case A: return 0;
case B: return 1;
case 7: return 1; // expected-warning {{case value not in enumerated type}}
- default: return 2; // expected-warning {{default is unreachable as all enumeration values are accounted for}}
+ default: return 2; // expected-warning {{default label in switch which covers all enumeration values}}
}
}
-// RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wunreachable-code -Wno-unused-value -Wno-switch-redundant-default
+// RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wunreachable-code -Wno-unused-value -Wno-covered-switch-default
int halt() __attribute__((noreturn));
int live();
-// RUN: %clang_cc1 -verify -Wno-switch-redundant-default %s
+// RUN: %clang_cc1 -verify -Wno-covered-switch-default %s
enum E {
one,
-// RUN: %clang_cc1 %s -fsyntax-only -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-switch-redundant-default
-// RUN: %clang_cc1 %s -fsyntax-only -std=c++11 -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-switch-redundant-default
+// RUN: %clang_cc1 %s -fsyntax-only -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
+// RUN: %clang_cc1 %s -fsyntax-only -std=c++11 -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default
// A destructor may be marked noreturn and should still influence the CFG.
void pr6884_abort() __attribute__((noreturn));