summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-03-30 12:09:23 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-03-30 12:10:15 -0700
commitd79361faf639618b501312a5dcdefeaa5bbadfd8 (patch)
tree123223f316f3c7064ec4919271643bfcd6b0beb4
parent2d31912897d4b4a72424368154d37f05c93677cb (diff)
Changes necessary to support clang-cl
This change fixes -Wimplicit-const-int-float-conversion warnings by making the conversions explicit. PiperOrigin-RevId: 520707623 Change-Id: Ib6917469120cd7458257195cbf39beb3fd397543
-rw-r--r--absl/log/internal/BUILD.bazel2
-rw-r--r--absl/numeric/int128_test.cc5
-rw-r--r--absl/random/internal/iostream_state_saver_test.cc5
3 files changed, 7 insertions, 5 deletions
diff --git a/absl/log/internal/BUILD.bazel b/absl/log/internal/BUILD.bazel
index a1f1a67c..555c5e5c 100644
--- a/absl/log/internal/BUILD.bazel
+++ b/absl/log/internal/BUILD.bazel
@@ -320,13 +320,13 @@ cc_library(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":test_helpers",
- "@com_google_googletest//:gtest",
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:log_severity",
"//absl/log:log_entry",
"//absl/strings",
"//absl/time",
+ "@com_google_googletest//:gtest",
] + select({
"//absl:msvc_compiler": [],
"//conditions:default": [
diff --git a/absl/numeric/int128_test.cc b/absl/numeric/int128_test.cc
index a6fed5cf..01e3eb5c 100644
--- a/absl/numeric/int128_test.cc
+++ b/absl/numeric/int128_test.cc
@@ -285,8 +285,9 @@ TEST(Uint128, ConversionTests) {
EXPECT_EQ(from_precise_double, from_precise_ints);
EXPECT_DOUBLE_EQ(static_cast<double>(from_precise_ints), precise_double);
- double approx_double = 0xffffeeeeddddcccc * std::pow(2.0, 64.0) +
- 0xbbbbaaaa99998888;
+ double approx_double =
+ static_cast<double>(0xffffeeeeddddcccc) * std::pow(2.0, 64.0) +
+ static_cast<double>(0xbbbbaaaa99998888);
absl::uint128 from_approx_double(approx_double);
EXPECT_DOUBLE_EQ(static_cast<double>(from_approx_double), approx_double);
diff --git a/absl/random/internal/iostream_state_saver_test.cc b/absl/random/internal/iostream_state_saver_test.cc
index 6e66266c..ea9d2af0 100644
--- a/absl/random/internal/iostream_state_saver_test.cc
+++ b/absl/random/internal/iostream_state_saver_test.cc
@@ -345,8 +345,9 @@ TEST(IOStreamStateSaver, RoundTripLongDoubles) {
}
// Avoid undefined behavior (overflow/underflow).
- if (dd <= std::numeric_limits<int64_t>::max() &&
- dd >= std::numeric_limits<int64_t>::lowest()) {
+ if (dd <= static_cast<long double>(std::numeric_limits<int64_t>::max()) &&
+ dd >=
+ static_cast<long double>(std::numeric_limits<int64_t>::lowest())) {
int64_t x = static_cast<int64_t>(dd);
EXPECT_EQ(x, StreamRoundTrip<int64_t>(x));
}