This is a great warning, but it was observed that a ton of real world code violates
it all the time for (semi-)legitimate reasons. This warnings is fairly pedantic, which is good,
but not for everyone. For example, there is a fair amount of idiomatic code out there
that does "default: abort()", and similar idioms.
Addresses <rdar://problem/
10814651>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150055
91177308-0d34-0410-b5e6-
96231b3b80d8
def : DiagGroup<"strict-prototypes">;
def StrictSelector : DiagGroup<"strict-selector-match">;
def MethodDuplicate : DiagGroup<"duplicate-method-match">;
-def SwitchEnum : DiagGroup<"switch-enum">;
def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
-def Switch : DiagGroup<"switch", [CoveredSwitchDefault]>;
+def SwitchEnum : DiagGroup<"switch-enum">;
+def Switch : DiagGroup<"switch">;
def Trigraphs : DiagGroup<"trigraphs">;
def : DiagGroup<"type-limits">;
def warn_unreachable_default : Warning<
"default label in switch which covers all enumeration values">,
- InGroup<CoveredSwitchDefault>;
+ InGroup<CoveredSwitchDefault>, DefaultIgnore;
def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
InGroup<Switch>;
def err_typecheck_statement_requires_scalar : Error<
-// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum -Wcovered-switch-default %s
void f (int z) {
while (z) {
default: z--; // expected-error {{statement not in switch}}