diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /test/Sema/warn-unreachable.c | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'test/Sema/warn-unreachable.c')
-rw-r--r-- | test/Sema/warn-unreachable.c | 24 |
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; + } + } +} + |