annotate clang/test/Sema/atomic-compare.c @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-logical-not-parentheses
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 void f(_Atomic(int) a, _Atomic(int) b) {
anatofuz
parents:
diff changeset
4 if (a > b) {} // no warning
anatofuz
parents:
diff changeset
5 if (a < b) {} // no warning
anatofuz
parents:
diff changeset
6 if (a >= b) {} // no warning
anatofuz
parents:
diff changeset
7 if (a <= b) {} // no warning
anatofuz
parents:
diff changeset
8 if (a == b) {} // no warning
anatofuz
parents:
diff changeset
9 if (a != b) {} // no warning
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 if (a == 0) {} // no warning
anatofuz
parents:
diff changeset
12 if (a > 0) {} // no warning
anatofuz
parents:
diff changeset
13 if (a > 1) {} // no warning
anatofuz
parents:
diff changeset
14 if (a > 2) {} // no warning
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 if (!a > 0) {} // no warning
anatofuz
parents:
diff changeset
17 if (!a > 1) {} // expected-warning {{comparison of constant 1 with boolean expression is always false}}
anatofuz
parents:
diff changeset
18 if (!a > 2) {} // expected-warning {{comparison of constant 2 with boolean expression is always false}}
anatofuz
parents:
diff changeset
19 if (!a > b) {} // no warning
anatofuz
parents:
diff changeset
20 if (!a > -1) {} // expected-warning {{comparison of constant -1 with boolean expression is always true}}
anatofuz
parents:
diff changeset
21 }
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 typedef _Atomic(int) Ty;
anatofuz
parents:
diff changeset
24 void PR23638(Ty *a) {
anatofuz
parents:
diff changeset
25 if (*a == 1) {} // no warning
anatofuz
parents:
diff changeset
26 }