From 15ee8a3a58223b48afbe33cb60084f864ef20889 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Tue, 19 May 2020 10:55:30 -0700 Subject: [PATCH] Silence warnings around int/float conversions. --- lldb/source/Plugins/Language/ObjC/Cocoa.cpp | 4 ++-- lldb/unittests/DataFormatter/MockTests.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp index 1ad443b..37b3522 100644 --- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp +++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp @@ -794,8 +794,8 @@ bool lldb_private::formatters::NSDate::FormatDateValue(double date_value, return true; } - if (date_value > std::numeric_limits::max() || - date_value < std::numeric_limits::min()) + if ((time_t)date_value > std::numeric_limits::max() || + (time_t)date_value < std::numeric_limits::min()) return false; time_t epoch = GetOSXEpoch(); diff --git a/lldb/unittests/DataFormatter/MockTests.cpp b/lldb/unittests/DataFormatter/MockTests.cpp index 1185d7b..f7daaf2 100644 --- a/lldb/unittests/DataFormatter/MockTests.cpp +++ b/lldb/unittests/DataFormatter/MockTests.cpp @@ -28,14 +28,14 @@ TEST(DataFormatterMockTest, NSDate) { EXPECT_EQ(*formatDateValue(-63114076800), "0001-12-30 00:00:00 +0000"); // Can't convert the date_value to a time_t. - EXPECT_EQ(formatDateValue(std::numeric_limits::max() + 1), + EXPECT_EQ(formatDateValue((double)(std::numeric_limits::max()) + 1), llvm::None); - EXPECT_EQ(formatDateValue(std::numeric_limits::min() - 1), + EXPECT_EQ(formatDateValue((double)(std::numeric_limits::min()) - 1), llvm::None); // Can't add the macOS epoch to the converted date_value (the add overflows). - EXPECT_EQ(formatDateValue(std::numeric_limits::max()), llvm::None); - EXPECT_EQ(formatDateValue(std::numeric_limits::min()), llvm::None); + EXPECT_EQ(formatDateValue((double)std::numeric_limits::max()), llvm::None); + EXPECT_EQ(formatDateValue((double)std::numeric_limits::min()), llvm::None); // FIXME: The formatting result is wrong on Windows because we adjust the // epoch when _WIN32 is defined (see GetOSXEpoch). -- 2.7.4