Richard Trieu | 19582e9 | 2014-03-26 01:55:33 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wno-bool-conversion -Wno-string-compare -Wno-tautological-compare -Waddress %s |
| 2 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 3 | |
| 4 | void foo(); |
| 5 | int arr[5]; |
| 6 | int global; |
| 7 | const char* str = ""; |
| 8 | |
| 9 | void test() { |
| 10 | if (foo) {} // expected-warning{{always evaluate to 'true'}} \ |
| 11 | // expected-note{{silence}} |
| 12 | if (arr) {} // expected-warning{{always evaluate to 'true'}} |
| 13 | if (&global) {} // expected-warning{{always evaluate to 'true'}} |
| 14 | if (foo == 0) {} // expected-warning{{always false}} \ |
| 15 | // expected-note{{silence}} |
| 16 | if (arr == 0) {} // expected-warning{{always false}} |
| 17 | if (&global == 0) {} // expected-warning{{always false}} |
| 18 | |
| 19 | if (str == "foo") {} // expected-warning{{unspecified}} |
| 20 | } |