| 1 |
// RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-logical-not-parentheses |
| 2 |
|
| 3 |
void f(_Atomic(int) a, _Atomic(int) b) { |
| 4 |
if (a > b) {} // no warning |
| 5 |
if (a < b) {} // no warning |
| 6 |
if (a >= b) {} // no warning |
| 7 |
if (a <= b) {} // no warning |
| 8 |
if (a == b) {} // no warning |
| 9 |
if (a != b) {} // no warning |
| 10 |
|
| 11 |
if (a == 0) {} // no warning |
| 12 |
if (a > 0) {} // no warning |
| 13 |
if (a > 1) {} // no warning |
| 14 |
if (a > 2) {} // no warning |
| 15 |
|
| 16 |
if (!a > 0) {} // no warning |
| 17 |
if (!a > 1) {} // expected-warning {{comparison of constant 1 with boolean expression is always false}} |
| 18 |
if (!a > 2) {} // expected-warning {{comparison of constant 2 with boolean expression is always false}} |
| 19 |
if (!a > b) {} // no warning |
| 20 |
if (!a > -1) {} // expected-warning {{comparison of constant -1 with boolean expression is always true}} |
| 21 |
} |
| 22 |
|
| 23 |
typedef _Atomic(int) Ty; |
| 24 |
void PR23638(Ty *a) { |
| 25 |
if (*a == 1) {} // no warning |
| 26 |
} |