annotate clang/test/Sema/floating-point-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 c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -Wfloat-equal -verify %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 int f1(float x, float y) {
anatofuz
parents:
diff changeset
4 return x == y; // expected-warning {{comparing floating point with ==}}
anatofuz
parents:
diff changeset
5 }
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 int f2(float x, float y) {
anatofuz
parents:
diff changeset
8 return x != y; // expected-warning {{comparing floating point with ==}}
anatofuz
parents:
diff changeset
9 }
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 int f3(float x) {
anatofuz
parents:
diff changeset
12 return x == x; // no-warning
anatofuz
parents:
diff changeset
13 }
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 int f4(float x) {
anatofuz
parents:
diff changeset
16 return x == 0.0; // no-warning {{comparing}}
anatofuz
parents:
diff changeset
17 }
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 int f5(float x) {
anatofuz
parents:
diff changeset
20 return x == __builtin_inf(); // no-warning
anatofuz
parents:
diff changeset
21 }
anatofuz
parents:
diff changeset
22
anatofuz
parents:
diff changeset
23 int f7(float x) {
anatofuz
parents:
diff changeset
24 return x == 3.14159; // expected-warning {{comparing}}
anatofuz
parents:
diff changeset
25 }