Skip to content

Commit 3b26f7e

Browse files
tweenkcopybara-github
authored andcommitted
Disable -Wfloat-equal in AppropriateResolution().
This function makes exact floating point that are correct in this context, but trigger the compiler warning. PiperOrigin-RevId: 596944060 Change-Id: I4bba3c2abcf3ac189107530978961955ad47d6f0
1 parent dddb219 commit 3b26f7e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

googletest/include/gtest/gtest-printers.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,10 @@ int AppropriateResolution(FloatType val) {
552552
int full = std::numeric_limits<FloatType>::max_digits10;
553553
if (val < 0) val = -val;
554554

555+
#ifdef __GNUC__
556+
#pragma GCC diagnostic push
557+
#pragma GCC diagnostic ignored "-Wfloat-equal"
558+
#endif
555559
if (val < 1000000) {
556560
FloatType mulfor6 = 1e10;
557561
if (val >= 100000.0) { // 100,000 to 999,999
@@ -595,6 +599,9 @@ int AppropriateResolution(FloatType val) {
595599
val)
596600
return 6;
597601
}
602+
#ifdef __GNUC__
603+
#pragma GCC diagnostic pop
604+
#endif
598605
return full;
599606
}
600607

0 commit comments

Comments
 (0)