aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzysztof KosiƄski <krzysio@google.com>2024-01-09 08:38:41 -0800
committerCopybara-Service <copybara-worker@google.com>2024-01-09 08:39:28 -0800
commit3b26f7e53bbe287deb57c75c796f17c9a82229a1 (patch)
treee5dd756807f1d94c73da79e7f0e6ea7480249c31
parentdddb219c3eb96d7f9200f09b0a381f016e6b4562 (diff)
downloadgoogletest-3b26f7e53bbe287deb57c75c796f17c9a82229a1.tar.gz
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
-rw-r--r--googletest/include/gtest/gtest-printers.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index 1b12ef68..0007a2a9 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -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
@@ -595,6 +599,9 @@ int AppropriateResolution(FloatType val) {
val)
return 6;
}
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
return full;
}