brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 811bce0 Raw
25 lines · plain
1// RUN: %clang_cc1 %s -verify2 3typedef signed char BOOL;4#define YES __objc_yes5#define NO __objc_no6 7BOOL B;8 9void test(void) {10  int r;11  r = B > 0;12  r = B > 1; // expected-warning {{result of comparison of constant 1 with expression of type 'BOOL' is always false, as the only well defined values for 'BOOL' are YES and NO}}13  r = B < 1;14  r = B < 0; // expected-warning {{result of comparison of constant 0 with expression of type 'BOOL' is always false, as the only well defined values for 'BOOL' are YES and NO}}15  r = B >= 0; // expected-warning {{result of comparison of constant 0 with expression of type 'BOOL' is always true, as the only well defined values for 'BOOL' are YES and NO}}16  r = B <= 0;17 18  r = B > YES; // expected-warning {{result of comparison of constant YES with expression of type 'BOOL' is always false, as the only well defined values for 'BOOL' are YES and NO}}19  r = B > NO;20  r = B < NO; // expected-warning {{result of comparison of constant NO with expression of type 'BOOL' is always false, as the only well defined values for 'BOOL' are YES and NO}}21  r = B < YES;22  r = B >= NO; // expected-warning {{result of comparison of constant NO with expression of type 'BOOL' is always true, as the only well defined values for 'BOOL' are YES and NO}}23  r = B <= NO;24}25