Fix -Wimplicit-int-float-conversion.
Bug: 989932
Change-Id: I7c40945ec731e6497c3f552cf3cd4482f553bb0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3001416
Reviewed-by: Kevin Schoedel <kpschoedel@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Will Harris <wfh@chromium.org>
Reviewed-by: weiliangc <weiliangc@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#901649}
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index e157ee9..97508d03 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -1609,9 +1609,6 @@
# TODO(thakis): Only for no_chromium_code? http://crbug.com/912662
"-Wno-ignored-pragma-optimize",
- # TODO(https://crbug.com/989932): Evaluate and possibly enable.
- "-Wno-implicit-int-float-conversion",
-
# TODO(https://crbug.com/999886): Clean up, enable.
"-Wno-final-dtor-non-final-class",
diff --git a/components/viz/service/compositor_frame_fuzzer/compositor_frame_fuzzer_util.cc b/components/viz/service/compositor_frame_fuzzer/compositor_frame_fuzzer_util.cc
index dbdc8f5..34e5e9d 100644
--- a/components/viz/service/compositor_frame_fuzzer/compositor_frame_fuzzer_util.cc
+++ b/components/viz/service/compositor_frame_fuzzer/compositor_frame_fuzzer_util.cc
@@ -36,7 +36,8 @@
// Normalizes value to a float in [0, 1]. Use to convert a fuzzed
// uint32 into a percentage.
float Normalize(uint32_t x) {
- return static_cast<float>(x) / std::numeric_limits<uint32_t>::max();
+ return static_cast<float>(x) /
+ static_cast<float>(std::numeric_limits<uint32_t>::max());
}
gfx::Size GetSizeFromProtobuf(const proto::Size& proto_size) {
diff --git a/media/gpu/test/image_quality_metrics.cc b/media/gpu/test/image_quality_metrics.cc
index da56c4df..40eea6d7 100644
--- a/media/gpu/test/image_quality_metrics.cc
+++ b/media/gpu/test/image_quality_metrics.cc
@@ -138,11 +138,12 @@
double ComputeSimilarity(const VideoFrame* frame1,
const VideoFrame* frame2,
SimilarityMetrics mode) {
- ASSERT_TRUE_OR_RETURN(frame1->IsMappable() && frame2->IsMappable(),
- std::numeric_limits<std::size_t>::max());
+ ASSERT_TRUE_OR_RETURN(
+ frame1->IsMappable() && frame2->IsMappable(),
+ static_cast<double>(std::numeric_limits<std::size_t>::max()));
ASSERT_TRUE_OR_RETURN(
frame1->visible_rect().size() == frame2->visible_rect().size(),
- std::numeric_limits<std::size_t>::max());
+ static_cast<double>(std::numeric_limits<std::size_t>::max()));
// Ideally, frame1->BitDepth() should be the same as frame2->BitDepth()
// always. But in the 10 bit case, the 10 bit frame can be carried with P016LE
// whose bit depth is regarded to be 16. This is due to a lack of NV12 10-bit
@@ -151,7 +152,7 @@
ASSERT_TRUE_OR_RETURN(
(frame1->BitDepth() == 8 && frame1->BitDepth() == frame2->BitDepth()) ||
std::min(frame1->BitDepth(), frame2->BitDepth()) == 10,
- std::numeric_limits<std::size_t>::max());
+ static_cast<double>(std::numeric_limits<std::size_t>::max()));
const size_t bit_depth = std::min(frame1->BitDepth(), frame2->BitDepth());
const VideoPixelFormat common_format =
bit_depth == 8 ? PIXEL_FORMAT_I420 : PIXEL_FORMAT_YUV420P10;
diff --git a/third_party/tcmalloc/README.chromium b/third_party/tcmalloc/README.chromium
index ec09d38..3a8e560 100644
--- a/third_party/tcmalloc/README.chromium
+++ b/third_party/tcmalloc/README.chromium
@@ -79,3 +79,4 @@
- Enable ASLR support on both Linux and ChromeOS
- Remove unused base::subtle::Acquire_Store/Release_Load (https://github.com/gperftools/gperftools/pull/1249)
- Fix thread-safety annotations (https://github.com/gperftools/gperftools/pull/1251)
+- Fixed -Wimplicit-int-float-conversion.
diff --git a/third_party/tcmalloc/chromium/src/sampler.cc b/third_party/tcmalloc/chromium/src/sampler.cc
index 358b52c7..6337826 100644
--- a/third_party/tcmalloc/chromium/src/sampler.cc
+++ b/third_party/tcmalloc/chromium/src/sampler.cc
@@ -116,7 +116,8 @@
// Very large values of interval overflow ssize_t. If we happen to
// hit such improbable condition, we simply cheat and clamp interval
// to largest supported value.
- return static_cast<ssize_t>(std::min<double>(interval, MAX_SSIZE));
+ return static_cast<ssize_t>(
+ std::min(interval, static_cast<double>(MAX_SSIZE)));
}
bool Sampler::RecordAllocationSlow(size_t k) {
diff --git a/ui/events/chromecast/scroller_unittest.cc b/ui/events/chromecast/scroller_unittest.cc
index d955f318..1ffbd21 100644
--- a/ui/events/chromecast/scroller_unittest.cc
+++ b/ui/events/chromecast/scroller_unittest.cc
@@ -103,15 +103,9 @@
base::TimeTicks start_time = base::TimeTicks::Now();
// Start a fling and verify initialized values.
- scroller.Fling(kDefaultStartX,
- kDefaultStartY,
- kDefaultVelocityX,
- kDefaultVelocityY,
- INT_MIN,
- INT_MAX,
- INT_MIN,
- INT_MAX,
- start_time);
+ scroller.Fling(kDefaultStartX, kDefaultStartY, kDefaultVelocityX,
+ kDefaultVelocityY, INT_MIN, static_cast<float>(INT_MAX),
+ INT_MIN, static_cast<float>(INT_MAX), start_time);
EXPECT_EQ(kDefaultStartX, scroller.GetStartX());
EXPECT_EQ(kDefaultStartY, scroller.GetStartY());