Reword/rename -Wswitch-unreachable-default.
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 llvm-svn: 148783
This commit is contained in:
parent
3cad0c21ed
commit
38d0d295ea
|
@ -184,8 +184,8 @@ def : DiagGroup<"strict-prototypes">;
|
||||||
def StrictSelector : DiagGroup<"strict-selector-match">;
|
def StrictSelector : DiagGroup<"strict-selector-match">;
|
||||||
def MethodDuplicate : DiagGroup<"duplicate-method-match">;
|
def MethodDuplicate : DiagGroup<"duplicate-method-match">;
|
||||||
def SwitchEnum : DiagGroup<"switch-enum">;
|
def SwitchEnum : DiagGroup<"switch-enum">;
|
||||||
def SwitchRedundantDefault : DiagGroup<"switch-redundant-default">;
|
def CoveredSwitchDefault : DiagGroup<"covered-switch-default">;
|
||||||
def Switch : DiagGroup<"switch", [SwitchRedundantDefault]>;
|
def Switch : DiagGroup<"switch", [CoveredSwitchDefault]>;
|
||||||
def Trigraphs : DiagGroup<"trigraphs">;
|
def Trigraphs : DiagGroup<"trigraphs">;
|
||||||
|
|
||||||
def : DiagGroup<"type-limits">;
|
def : DiagGroup<"type-limits">;
|
||||||
|
|
|
@ -4987,8 +4987,8 @@ def warn_missing_cases : Warning<
|
||||||
InGroup<Switch>;
|
InGroup<Switch>;
|
||||||
|
|
||||||
def warn_unreachable_default : Warning<
|
def warn_unreachable_default : Warning<
|
||||||
"default is unreachable as all enumeration values are accounted for">,
|
"default label in switch which covers all enumeration values">,
|
||||||
InGroup<SwitchRedundantDefault>;
|
InGroup<CoveredSwitchDefault>;
|
||||||
def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
|
def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
|
||||||
InGroup<Switch>;
|
InGroup<Switch>;
|
||||||
def err_typecheck_statement_requires_scalar : Error<
|
def err_typecheck_statement_requires_scalar : Error<
|
||||||
|
|
|
@ -295,6 +295,6 @@ int test18() {
|
||||||
case A: return 0;
|
case A: return 0;
|
||||||
case B: return 1;
|
case B: return 1;
|
||||||
case 7: return 1; // expected-warning {{case value not in enumerated type}}
|
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}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// 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 halt() __attribute__((noreturn));
|
||||||
int live();
|
int live();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -verify -Wno-switch-redundant-default %s
|
// RUN: %clang_cc1 -verify -Wno-covered-switch-default %s
|
||||||
|
|
||||||
enum E {
|
enum E {
|
||||||
one,
|
one,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// RUN: %clang_cc1 %s -fsyntax-only -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-switch-redundant-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.
|
// A destructor may be marked noreturn and should still influence the CFG.
|
||||||
void pr6884_abort() __attribute__((noreturn));
|
void pr6884_abort() __attribute__((noreturn));
|
||||||
|
|
Loading…
Reference in New Issue