summaryrefslogtreecommitdiffstats
path: root/test/Sema/warn-unreachable.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/warn-unreachable.c')
-rw-r--r--test/Sema/warn-unreachable.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/Sema/warn-unreachable.c b/test/Sema/warn-unreachable.c
index 10ed696..20e0c31 100644
--- a/test/Sema/warn-unreachable.c
+++ b/test/Sema/warn-unreachable.c
@@ -35,8 +35,8 @@ void test2() {
dead(); // expected-warning {{will never be executed}}
case 3:
- live() // expected-warning {{will never be executed}}
- +
+ live()
+ + // expected-warning {{will never be executed}}
halt();
dead();
@@ -75,8 +75,8 @@ void test2() {
goto c6;
case 7:
halt()
- + // expected-warning {{will never be executed}}
- dead();
+ +
+ dead(); // expected-warning {{will never be executed}}
- // expected-warning {{will never be executed}}
halt();
case 8:
@@ -98,3 +98,19 @@ void test2() {
}
}
}
+
+enum Cases { C1, C2, C3 };
+int test_enum_cases(enum Cases C) {
+ switch (C) {
+ case C1:
+ case C2:
+ case C3:
+ return 1;
+ default: {
+ int i = 0; // expected-warning{{will never be executed}}
+ ++i;
+ return i;
+ }
+ }
+}
+
OpenPOWER on IntegriCloud