Skip to content

Commit

Permalink
Disable -Wfloat-equal in AppropriateResolution().
Browse files Browse the repository at this point in the history
This function makes exact floating point that are correct in this context, but trigger the compiler warning.

PiperOrigin-RevId: 596944060
Change-Id: I4bba3c2abcf3ac189107530978961955ad47d6f0
  • Loading branch information
tweenk authored and copybara-github committed Jan 9, 2024
1 parent dddb219 commit 3b26f7e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions googletest/include/gtest/gtest-printers.h
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,10 @@ int AppropriateResolution(FloatType val) {
int full = std::numeric_limits<FloatType>::max_digits10;
if (val < 0) val = -val;

#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
if (val < 1000000) {
FloatType mulfor6 = 1e10;
if (val >= 100000.0) { // 100,000 to 999,999
Expand Down Expand Up @@ -595,6 +599,9 @@ int AppropriateResolution(FloatType val) {
val)
return 6;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
return full;
}

Expand Down

0 comments on commit 3b26f7e

Please sign in to comment.