diff --git a/deps/googletest/include/gtest/gtest-printers.h b/deps/googletest/include/gtest/gtest-printers.h index 0007a2a9db0b23..b2822bcde23cc7 100644 --- a/deps/googletest/include/gtest/gtest-printers.h +++ b/deps/googletest/include/gtest/gtest-printers.h @@ -124,7 +124,7 @@ #if GTEST_INTERNAL_HAS_STD_SPAN #include // NOLINT -#endif // GTEST_INTERNAL_HAS_STD_SPAN +#endif // GTEST_INTERNAL_HAS_STD_SPAN namespace testing { @@ -241,8 +241,8 @@ struct StreamPrinter { // ADL (possibly involving implicit conversions). // (Use SFINAE via return type, because it seems GCC < 12 doesn't handle name // lookup properly when we do it in the template parameter list.) - static auto PrintValue(const T& value, ::std::ostream* os) - -> decltype((void)(*os << value)) { + static auto PrintValue(const T& value, + ::std::ostream* os) -> decltype((void)(*os << value)) { // Call streaming operator found by ADL, possibly with implicit conversions // of the arguments. *os << value; @@ -558,43 +558,50 @@ int AppropriateResolution(FloatType val) { #endif if (val < 1000000) { FloatType mulfor6 = 1e10; - if (val >= 100000.0) { // 100,000 to 999,999 + // Without these static casts, the template instantiation for float would + // fail to compile when -Wdouble-promotion is enabled, as the arithmetic and + // comparison logic would promote floats to doubles. + if (val >= static_cast(100000.0)) { // 100,000 to 999,999 mulfor6 = 1.0; - } else if (val >= 10000.0) { + } else if (val >= static_cast(10000.0)) { mulfor6 = 1e1; - } else if (val >= 1000.0) { + } else if (val >= static_cast(1000.0)) { mulfor6 = 1e2; - } else if (val >= 100.0) { + } else if (val >= static_cast(100.0)) { mulfor6 = 1e3; - } else if (val >= 10.0) { + } else if (val >= static_cast(10.0)) { mulfor6 = 1e4; - } else if (val >= 1.0) { + } else if (val >= static_cast(1.0)) { mulfor6 = 1e5; - } else if (val >= 0.1) { + } else if (val >= static_cast(0.1)) { mulfor6 = 1e6; - } else if (val >= 0.01) { + } else if (val >= static_cast(0.01)) { mulfor6 = 1e7; - } else if (val >= 0.001) { + } else if (val >= static_cast(0.001)) { mulfor6 = 1e8; - } else if (val >= 0.0001) { + } else if (val >= static_cast(0.0001)) { mulfor6 = 1e9; } - if (static_cast(static_cast(val * mulfor6 + 0.5)) / + if (static_cast(static_cast( + val * mulfor6 + (static_cast(0.5)))) / mulfor6 == val) return 6; - } else if (val < 1e10) { - FloatType divfor6 = 1.0; - if (val >= 1e9) { // 1,000,000,000 to 9,999,999,999 + } else if (val < static_cast(1e10)) { + FloatType divfor6 = static_cast(1.0); + if (val >= static_cast(1e9)) { // 1,000,000,000 to 9,999,999,999 divfor6 = 10000; - } else if (val >= 1e8) { // 100,000,000 to 999,999,999 + } else if (val >= + static_cast(1e8)) { // 100,000,000 to 999,999,999 divfor6 = 1000; - } else if (val >= 1e7) { // 10,000,000 to 99,999,999 + } else if (val >= + static_cast(1e7)) { // 10,000,000 to 99,999,999 divfor6 = 100; - } else if (val >= 1e6) { // 1,000,000 to 9,999,999 + } else if (val >= static_cast(1e6)) { // 1,000,000 to 9,999,999 divfor6 = 10; } - if (static_cast(static_cast(val / divfor6 + 0.5)) * + if (static_cast(static_cast( + val / divfor6 + (static_cast(0.5)))) * divfor6 == val) return 6; diff --git a/deps/googletest/include/gtest/internal/gtest-internal.h b/deps/googletest/include/gtest/internal/gtest-internal.h index 4f077fcfbe2f03..806b08624cb45a 100644 --- a/deps/googletest/include/gtest/internal/gtest-internal.h +++ b/deps/googletest/include/gtest/internal/gtest-internal.h @@ -555,7 +555,7 @@ struct SuiteApiResolver : T { // type_param: the name of the test's type parameter, or NULL if // this is not a typed or a type-parameterized test. // value_param: text representation of the test's value parameter, -// or NULL if this is not a type-parameterized test. +// or NULL if this is not a value-parameterized test. // code_location: code location where the test is defined // fixture_class_id: ID of the test fixture class // set_up_tc: pointer to the function that sets up the test suite