tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

TestNANTestingExpr.cpp (1215B)


      1 #line 1 "tests/SkScalar.h"
      2 // This checks that the whitelist accounts for #line directives and such. If you
      3 // remove SkScalar from the whitelist, please change the filename here instead
      4 // of adding expected diagnostics.
      5 inline int headerSays(double x) {
      6  return x != x;
      7 }
      8 #line 9 "TestNANTestingExpr.cpp"
      9 void test(bool x);
     10 void foo() {
     11  float f, f2;
     12  typedef double mydouble;
     13  mydouble d;
     14  double d2;
     15  test(f == f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
     16  test(d == d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
     17  test(f != f); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
     18  test(d != d); // expected-error{{comparing a floating point value to itself for NaN checking can lead to incorrect results}} expected-note{{consider using std::isnan instead}}
     19  test(f != d);
     20  test(d == (d - f));
     21  test(f == f2);
     22  test(d == d2);
     23  test(d + 1 == d);
     24 }