1 // RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wunreachable-code-aggressive -Wno-unused-value -Wno-covered-switch-default
3 // This previously triggered a warning from -Wunreachable-code because of
5 typedef signed char BOOL;
6 BOOL radar10989084(void) {
7 @autoreleasepool { // no-warning
12 // Test the warning works.
13 void test_unreachable(void) {
15 return; // expected-warning {{will never be executed}}
19 #define YES __objc_yes
22 // Test that 'NO' and 'YES' are not treated as configuration macros.
25 return 1; // expected-warning {{will never be executed}}
34 return 0; // expected-warning {{will never be executed}}
37 int test_CONFIG(void) {
44 // FIXME: This should at some point report a warning
45 // that the loop increment is unreachable.
46 void test_loop_increment(id container) {
47 for (id x in container) { // no-warning
52 void calledFun(void) {}
54 // Test "silencing" with parentheses.
55 void test_with_paren_silencing(int x) {
56 if (NO) calledFun(); // expected-warning {{will never be executed}} expected-note {{silence by adding parentheses to mark code as explicitly dead}}
57 if ((NO)) calledFun(); // no-warning
59 if (YES) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
62 calledFun(); // expected-warning {{will never be executed}}
67 calledFun(); // no-warning
69 if (!YES) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
70 calledFun(); // expected-warning {{code will never be executed}}
75 calledFun(); // no-warning
80 calledFun(); // no-warning