aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td8
-rw-r--r--test/Sema/switch-enum.c18
-rw-r--r--test/Sema/switch.c13
3 files changed, 7 insertions, 32 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index 73f3cda545..853f7666b3 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -4962,16 +4962,16 @@ def warn_missing_case_for_condition :
Warning<"no case matching constant switch condition '%0'">;
def warn_def_missing_case1 : Warning<
- "enumeration value %0 not handled in switch">,
+ "enumeration value %0 not explicitly handled in switch">,
InGroup<SwitchEnum>, DefaultIgnore;
def warn_def_missing_case2 : Warning<
- "enumeration values %0 and %1 not handled in switch">,
+ "enumeration values %0 and %1 not explicitly handled in switch">,
InGroup<SwitchEnum>, DefaultIgnore;
def warn_def_missing_case3 : Warning<
- "enumeration values %0, %1, and %2 not handled in switch">,
+ "enumeration values %0, %1, and %2 not explicitly handled in switch">,
InGroup<SwitchEnum>, DefaultIgnore;
def warn_def_missing_cases : Warning<
- "%0 enumeration values not handled in switch: %1, %2, %3...">,
+ "%0 enumeration values not explicitly handled in switch: %1, %2, %3...">,
InGroup<SwitchEnum>, DefaultIgnore;
def warn_missing_case1 : Warning<"enumeration value %0 not handled in switch">,
diff --git a/test/Sema/switch-enum.c b/test/Sema/switch-enum.c
deleted file mode 100644
index 98db150f33..0000000000
--- a/test/Sema/switch-enum.c
+++ /dev/null
@@ -1,18 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum -Wno-switch-redundant-default %s
-
-int test1() {
- enum { A, B } a;
- switch (a) { //expected-warning{{enumeration value 'B' not handled in switch}}
- case A: return 1;
- default: return 2;
- }
-}
-
-int test2() {
- enum { A, B } a;
- switch (a) {
- case A: return 1;
- case B: return 2;
- default: return 3;
- }
-}
diff --git a/test/Sema/switch.c b/test/Sema/switch.c
index f36ecb255f..012c5ecee7 100644
--- a/test/Sema/switch.c
+++ b/test/Sema/switch.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wswitch-enum %s
void f (int z) {
while (z) {
default: z--; // expected-error {{statement not in switch}}
@@ -203,7 +203,7 @@ void test11() {
break;
}
- switch(a) {
+ switch(a) { //expected-warning{{enumeration value 'A' not explicitly handled in switch}}
case B:
case C:
break;
@@ -294,14 +294,7 @@ int test18() {
switch (a) {
case A: return 0;
case B: return 1;
- default: return 2; // expected-warning {{default is unreachable as all enumeration values are accounted for}}
- }
-}
-
-int test19() {
- enum { A, B } a;
- switch (a) {
case 7: return 1; // expected-warning {{case value not in enumerated type}}
- default: return 3;
+ default: return 2; // expected-warning {{default is unreachable as all enumeration values are accounted for}}
}
}