1 | // RUN: %clang_cc1 -fsyntax-only -Wfloat-equal -verify %s |
2 | |
3 | int f1(float x, float y) { |
4 | return x == y; // expected-warning {{comparing floating point with ==}} |
5 | } |
6 | |
7 | int f2(float x, float y) { |
8 | return x != y; // expected-warning {{comparing floating point with ==}} |
9 | } |
10 | |
11 | int f3(float x) { |
12 | return x == x; // no-warning |
13 | } |
14 | |
15 | int f4(float x) { |
16 | return x == 0.0; // no-warning {{comparing}} |
17 | } |
18 | |
19 | int f5(float x) { |
20 | return x == __builtin_inf(); // no-warning |
21 | } |
22 | |
23 | int f7(float x) { |
24 | return x == 3.14159; // expected-warning {{comparing}} |
25 | } |
26 | |