-
Couldn't load subscription status.
- Fork 15k
Revert "[libc] Add -Werror for libc tests" #164684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 5d6c00c.
|
@llvm/pr-subscribers-libc Author: None (lntue) ChangesReverts llvm/llvm-project#160413 Patch is 22.73 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/164684.diff 15 Files Affected:
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 53bba3e1ef201..933b81b9f1d46 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -38,7 +38,7 @@ function(_get_common_test_compile_options output_var c_test flags)
list(APPEND compile_options "-Wextra")
# -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror.
if(NOT LIBC_WNO_ERROR)
- list(APPEND compile_options "-Werror")
+ # list(APPEND compile_options "-Werror")
endif()
list(APPEND compile_options "-Wconversion")
# FIXME: convert to -Wsign-conversion
diff --git a/libc/test/include/complex_test.cpp b/libc/test/include/complex_test.cpp
index 70e8c1c3d9216..6f900aa4fb674 100644
--- a/libc/test/include/complex_test.cpp
+++ b/libc/test/include/complex_test.cpp
@@ -27,8 +27,8 @@ TEST(LlvmLibcComplexTest, CMPLXMacro) {
EXPECT_CFP_EQ(CMPLXL(1.0l, 0), 1.0l);
#ifdef LIBC_TYPES_HAS_CFLOAT16
- EXPECT_CFP_EQ(CMPLXF16(0, 1.0), static_cast<_Complex _Float16>(I));
- EXPECT_CFP_EQ(CMPLXF16(1.0, 0), static_cast<_Complex _Float16>(1.0));
+ EXPECT_CFP_EQ(CMPLXF16(0, 1.0), I);
+ EXPECT_CFP_EQ(CMPLXF16(1.0, 0), 1.0);
#endif // LIBC_TYPES_HAS_CFLOAT16
#ifdef LIBC_TYPES_HAS_CFLOAT128
diff --git a/libc/test/integration/src/pthread/pthread_barrier_test.cpp b/libc/test/integration/src/pthread/pthread_barrier_test.cpp
index 3fef16522c425..c8e11047e1d80 100644
--- a/libc/test/integration/src/pthread/pthread_barrier_test.cpp
+++ b/libc/test/integration/src/pthread/pthread_barrier_test.cpp
@@ -26,7 +26,7 @@
pthread_barrier_t barrier;
LIBC_NAMESPACE::cpp::Atomic<int> counter;
-void *increment_counter_and_wait([[maybe_unused]] void *args) {
+void *increment_counter_and_wait(void *args) {
counter.fetch_add(1);
return reinterpret_cast<void *>(
LIBC_NAMESPACE::pthread_barrier_wait(&barrier));
@@ -102,7 +102,7 @@ void reused_barrier_test() {
LIBC_NAMESPACE::pthread_barrier_destroy(&barrier);
}
-void *barrier_wait([[maybe_unused]] void *in) {
+void *barrier_wait(void *in) {
return reinterpret_cast<void *>(
LIBC_NAMESPACE::pthread_barrier_wait(&barrier));
}
diff --git a/libc/test/src/math/exhaustive/bfloat16_add_test.cpp b/libc/test/src/math/exhaustive/bfloat16_add_test.cpp
index 20a66e27fa61b..3f4c77978a93d 100644
--- a/libc/test/src/math/exhaustive/bfloat16_add_test.cpp
+++ b/libc/test/src/math/exhaustive/bfloat16_add_test.cpp
@@ -23,9 +23,8 @@ struct Bfloat16AddChecker : public virtual LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<bfloat16>;
using StorageType = typename FPBits::StorageType;
- uint64_t check(uint16_t x_start, uint16_t x_stop,
- [[maybe_unused]] uint16_t y_start, uint16_t y_stop,
- mpfr::RoundingMode rounding) {
+ uint64_t check(uint16_t x_start, uint16_t x_stop, uint16_t y_start,
+ uint16_t y_stop, mpfr::RoundingMode rounding) {
mpfr::ForceRoundingMode r(rounding);
if (!r.success)
return true;
diff --git a/libc/test/src/math/exhaustive/bfloat16_div_test.cpp b/libc/test/src/math/exhaustive/bfloat16_div_test.cpp
index 43e033108861e..2648d5f775af5 100644
--- a/libc/test/src/math/exhaustive/bfloat16_div_test.cpp
+++ b/libc/test/src/math/exhaustive/bfloat16_div_test.cpp
@@ -23,9 +23,8 @@ struct Bfloat16DivChecker : public virtual LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<bfloat16>;
using StorageType = typename FPBits::StorageType;
- uint64_t check(uint16_t x_start, uint16_t x_stop,
- [[maybe_unused]] uint16_t y_start, uint16_t y_stop,
- mpfr::RoundingMode rounding) {
+ uint64_t check(uint16_t x_start, uint16_t x_stop, uint16_t y_start,
+ uint16_t y_stop, mpfr::RoundingMode rounding) {
mpfr::ForceRoundingMode r(rounding);
if (!r.success)
return true;
diff --git a/libc/test/src/math/exhaustive/bfloat16_mul_test.cpp b/libc/test/src/math/exhaustive/bfloat16_mul_test.cpp
index 4fd9ccf440a9d..3cbbcb500a4fb 100644
--- a/libc/test/src/math/exhaustive/bfloat16_mul_test.cpp
+++ b/libc/test/src/math/exhaustive/bfloat16_mul_test.cpp
@@ -23,9 +23,8 @@ struct Bfloat16MulChecker : public virtual LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<bfloat16>;
using StorageType = typename FPBits::StorageType;
- uint64_t check(uint16_t x_start, uint16_t x_stop,
- [[maybe_unused]] uint16_t y_start, uint16_t y_stop,
- mpfr::RoundingMode rounding) {
+ uint64_t check(uint16_t x_start, uint16_t x_stop, uint16_t y_start,
+ uint16_t y_stop, mpfr::RoundingMode rounding) {
mpfr::ForceRoundingMode r(rounding);
if (!r.success)
return true;
diff --git a/libc/test/src/math/exhaustive/bfloat16_sub_test.cpp b/libc/test/src/math/exhaustive/bfloat16_sub_test.cpp
index 350af52930744..11bc6f59dd294 100644
--- a/libc/test/src/math/exhaustive/bfloat16_sub_test.cpp
+++ b/libc/test/src/math/exhaustive/bfloat16_sub_test.cpp
@@ -23,9 +23,8 @@ struct Bfloat16SubChecker : public virtual LIBC_NAMESPACE::testing::Test {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<bfloat16>;
using StorageType = typename FPBits::StorageType;
- uint64_t check(uint16_t x_start, uint16_t x_stop,
- [[maybe_unused]] uint16_t y_start, uint16_t y_stop,
- mpfr::RoundingMode rounding) {
+ uint64_t check(uint16_t x_start, uint16_t x_stop, uint16_t y_start,
+ uint16_t y_stop, mpfr::RoundingMode rounding) {
mpfr::ForceRoundingMode r(rounding);
if (!r.success)
return true;
diff --git a/libc/test/src/signal/sigaltstack_test.cpp b/libc/test/src/signal/sigaltstack_test.cpp
index 43c679b23bb29..8c252c47452df 100644
--- a/libc/test/src/signal/sigaltstack_test.cpp
+++ b/libc/test/src/signal/sigaltstack_test.cpp
@@ -33,7 +33,7 @@ static void handler(int) {
// out or mapped to a register.
uint8_t var[LOCAL_VAR_SIZE];
for (int i = 0; i < LOCAL_VAR_SIZE; ++i)
- var[i] = static_cast<uint8_t>(i);
+ var[i] = i;
// Verify that array is completely on the alt_stack.
for (int i = 0; i < LOCAL_VAR_SIZE; ++i) {
if (!(uintptr_t(var + i) < uintptr_t(alt_stack + ALT_STACK_SIZE) &&
diff --git a/libc/test/src/stdio/fileop_test.cpp b/libc/test/src/stdio/fileop_test.cpp
index 1dc9b6522006d..02328042b92b3 100644
--- a/libc/test/src/stdio/fileop_test.cpp
+++ b/libc/test/src/stdio/fileop_test.cpp
@@ -101,7 +101,7 @@ TEST_F(LlvmLibcFILETest, SimpleFileOperations) {
// This is not a readable file.
ASSERT_THAT(LIBC_NAMESPACE::fread(data, 1, 1, file),
- returns(EQ(static_cast<size_t>(0))).with_errno(NE(0)));
+ returns(EQ(0)).with_errno(NE(0)));
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
@@ -175,7 +175,7 @@ TEST_F(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
// Trying to read more should fetch nothing.
ASSERT_THAT(
LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file),
- returns(EQ(static_cast<size_t>(0))).with_errno(EQ(0)));
+ returns(EQ(0)).with_errno(EQ(0)));
EXPECT_NE(LIBC_NAMESPACE::feof(file), 0);
EXPECT_EQ(LIBC_NAMESPACE::ferror(file), 0);
ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);
diff --git a/libc/test/src/stdio/fopen_test.cpp b/libc/test/src/stdio/fopen_test.cpp
index e427e496895e0..3f651f755e7f3 100644
--- a/libc/test/src/stdio/fopen_test.cpp
+++ b/libc/test/src/stdio/fopen_test.cpp
@@ -15,14 +15,15 @@
#include "test/UnitTest/Test.h"
TEST(LlvmLibcFOpenTest, PrintToFile) {
+ int result;
FILE *file =
LIBC_NAMESPACE::fopen(APPEND_LIBC_TEST("testdata/test.txt"), "w");
ASSERT_FALSE(file == nullptr);
static constexpr char STRING[] = "A simple string written to a file\n";
- size_t result = LIBC_NAMESPACE::fwrite(STRING, 1, sizeof(STRING) - 1, file);
- EXPECT_GE(result, static_cast<size_t>(0));
+ result = LIBC_NAMESPACE::fwrite(STRING, 1, sizeof(STRING) - 1, file);
+ EXPECT_GE(result, 0);
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
diff --git a/libc/test/src/sys/socket/linux/send_recv_test.cpp b/libc/test/src/sys/socket/linux/send_recv_test.cpp
index 5bfa4fb2ed572..46f73a29d6f7a 100644
--- a/libc/test/src/sys/socket/linux/send_recv_test.cpp
+++ b/libc/test/src/sys/socket/linux/send_recv_test.cpp
@@ -50,15 +50,13 @@ TEST_F(LlvmLibcSendRecvTest, SendFails) {
const char TEST_MESSAGE[] = "connection terminated";
const size_t MESSAGE_LEN = sizeof(TEST_MESSAGE);
- ASSERT_THAT(
- static_cast<int>(LIBC_NAMESPACE::send(-1, TEST_MESSAGE, MESSAGE_LEN, 0)),
- Fails(EBADF));
+ ASSERT_THAT(LIBC_NAMESPACE::send(-1, TEST_MESSAGE, MESSAGE_LEN, 0),
+ Fails(EBADF));
}
TEST_F(LlvmLibcSendRecvTest, RecvFails) {
char buffer[256];
- ASSERT_THAT(
- static_cast<int>(LIBC_NAMESPACE::recv(-1, buffer, sizeof(buffer), 0)),
- Fails(EBADF));
+ ASSERT_THAT(LIBC_NAMESPACE::recv(-1, buffer, sizeof(buffer), 0),
+ Fails(EBADF));
}
diff --git a/libc/test/src/sys/socket/linux/sendmsg_recvmsg_test.cpp b/libc/test/src/sys/socket/linux/sendmsg_recvmsg_test.cpp
index 31099650dd20b..7ed94b20c564a 100644
--- a/libc/test/src/sys/socket/linux/sendmsg_recvmsg_test.cpp
+++ b/libc/test/src/sys/socket/linux/sendmsg_recvmsg_test.cpp
@@ -45,9 +45,8 @@ TEST_F(LlvmLibcSendMsgRecvMsgTest, SucceedsWithSocketPair) {
send_message.msg_controllen = 0;
send_message.msg_flags = 0;
- ASSERT_THAT(
- static_cast<int>(LIBC_NAMESPACE::sendmsg(sockpair[0], &send_message, 0)),
- Succeeds(static_cast<ssize_t>(MESSAGE_LEN)));
+ ASSERT_THAT(LIBC_NAMESPACE::sendmsg(sockpair[0], &send_message, 0),
+ Succeeds(static_cast<ssize_t>(MESSAGE_LEN)));
char buffer[256];
@@ -64,9 +63,8 @@ TEST_F(LlvmLibcSendMsgRecvMsgTest, SucceedsWithSocketPair) {
recv_message.msg_controllen = 0;
recv_message.msg_flags = 0;
- ASSERT_THAT(
- static_cast<int>(LIBC_NAMESPACE::recvmsg(sockpair[1], &recv_message, 0)),
- Succeeds(static_cast<ssize_t>(MESSAGE_LEN)));
+ ASSERT_THAT(LIBC_NAMESPACE::recvmsg(sockpair[1], &recv_message, 0),
+ Succeeds(static_cast<ssize_t>(MESSAGE_LEN)));
ASSERT_STREQ(buffer, TEST_MESSAGE);
@@ -93,8 +91,7 @@ TEST_F(LlvmLibcSendMsgRecvMsgTest, SendFails) {
send_message.msg_controllen = 0;
send_message.msg_flags = 0;
- ASSERT_THAT(static_cast<int>(LIBC_NAMESPACE::sendmsg(-1, &send_message, 0)),
- Fails(EBADF));
+ ASSERT_THAT(LIBC_NAMESPACE::sendmsg(-1, &send_message, 0), Fails(EBADF));
}
TEST_F(LlvmLibcSendMsgRecvMsgTest, RecvFails) {
@@ -113,6 +110,5 @@ TEST_F(LlvmLibcSendMsgRecvMsgTest, RecvFails) {
recv_message.msg_controllen = 0;
recv_message.msg_flags = 0;
- ASSERT_THAT(static_cast<int>(LIBC_NAMESPACE::recvmsg(-1, &recv_message, 0)),
- Fails(EBADF));
+ ASSERT_THAT(LIBC_NAMESPACE::recvmsg(-1, &recv_message, 0), Fails(EBADF));
}
diff --git a/libc/test/src/sys/socket/linux/sendto_recvfrom_test.cpp b/libc/test/src/sys/socket/linux/sendto_recvfrom_test.cpp
index c3f84266d464c..8377260252c37 100644
--- a/libc/test/src/sys/socket/linux/sendto_recvfrom_test.cpp
+++ b/libc/test/src/sys/socket/linux/sendto_recvfrom_test.cpp
@@ -54,7 +54,7 @@ TEST_F(LlvmLibcSendToRecvFromTest, SendToFails) {
ASSERT_THAT(
LIBC_NAMESPACE::sendto(-1, TEST_MESSAGE, MESSAGE_LEN, 0, nullptr, 0),
- Fails(static_cast<ssize_t>(EBADF), static_cast<ssize_t>(-1)));
+ Fails(EBADF));
}
TEST_F(LlvmLibcSendToRecvFromTest, RecvFromFails) {
@@ -62,5 +62,5 @@ TEST_F(LlvmLibcSendToRecvFromTest, RecvFromFails) {
ASSERT_THAT(
LIBC_NAMESPACE::recvfrom(-1, buffer, sizeof(buffer), 0, nullptr, 0),
- Fails(static_cast<ssize_t>(EBADF), static_cast<ssize_t>(-1)));
+ Fails(EBADF));
}
diff --git a/libc/test/src/time/ctime_r_test.cpp b/libc/test/src/time/ctime_r_test.cpp
index 084db300bf2d6..ee06c706734fb 100644
--- a/libc/test/src/time/ctime_r_test.cpp
+++ b/libc/test/src/time/ctime_r_test.cpp
@@ -23,7 +23,7 @@ TEST_F(LlvmLibcCtimeR, Nullptr) {
result = LIBC_NAMESPACE::ctime_r(nullptr, buffer);
ASSERT_STREQ(nullptr, result);
- time_t t = 2147483648; // invalid argument
+ time_t t;
result = LIBC_NAMESPACE::ctime_r(&t, nullptr);
ASSERT_STREQ(nullptr, result);
}
diff --git a/libc/test/src/time/mktime_test.cpp b/libc/test/src/time/mktime_test.cpp
index 1062fa45ef644..1dfdd73de5440 100644
--- a/libc/test/src/time/mktime_test.cpp
+++ b/libc/test/src/time/mktime_test.cpp
@@ -36,8 +36,7 @@ TEST(LlvmLibcMkTime, FailureSetsErrno) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
TEST(LlvmLibcMkTime, InvalidSeconds) {
@@ -52,8 +51,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Succeeds(-1));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-1));
EXPECT_TM_EQ((tm{.tm_sec = 59,
.tm_min = 59,
.tm_hour = 23,
@@ -77,8 +75,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Succeeds(60));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(60));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 1,
.tm_hour = 0,
@@ -104,7 +101,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-LIBC_NAMESPACE::time_constants::SECONDS_PER_MIN));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 59,
@@ -129,7 +126,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(60 * LIBC_NAMESPACE::time_constants::SECONDS_PER_MIN));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -156,7 +153,7 @@ TEST(LlvmLibcMkTime, InvalidHours) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-LIBC_NAMESPACE::time_constants::SECONDS_PER_HOUR));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -182,7 +179,7 @@ TEST(LlvmLibcMkTime, InvalidHours) {
.tm_yday = 0,
.tm_isdst = 0};
EXPECT_THAT(
- static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(24 * LIBC_NAMESPACE::time_constants::SECONDS_PER_HOUR));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -208,7 +205,7 @@ TEST(LlvmLibcMkTime, InvalidYear) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-LIBC_NAMESPACE::time_constants::DAYS_PER_NON_LEAP_YEAR *
LIBC_NAMESPACE::time_constants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
@@ -237,8 +234,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -252,8 +248,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -267,8 +262,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -282,8 +276,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -297,8 +290,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
{
@@ -312,8 +304,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
- Fails(EOVERFLOW));
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW));
}
}
@@ -330,7 +321,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) {
.tm_yday = 0,
.tm_isdst = 0};
EXPECT_THAT(
- static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-32 * LIBC_NAMESPACE::time_constants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -356,7 +347,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) {
.tm_yday = 0,
.tm_isdst = 0};
EXPECT_THAT(
- static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(LIBC_NAMESPACE::time_constants::DAYS_PER_NON_LEAP_YEAR *
LIBC_NAMESPACE::time_constants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
@@ -384,7 +375,7 @@ TEST(LlvmLibcMkTime, InvalidDays) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(-1 * LIBC_NAMESPACE::time_constants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -409,7 +400,7 @@ TEST(LlvmLibcMkTime, InvalidDays) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(31 * LIBC_NAMESPACE::time_constants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -434,7 +425,7 @@ TEST(LlvmLibcMkTime, InvalidDays) {
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0};
- EXPECT_THAT(static_cast<int>(LIBC_NAMESPACE::mktime(&tm_data)),
+ EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data),
Succeeds(59 * LIBC_NAMESPACE::time_constants::SECONDS_PER_DAY));
EXPECT_TM_EQ((tm{.tm_sec = 0,
.tm_min = 0,
@@ -460,7 +451,7 @@ TEST(LlvmLibcMkT...
[truncated]
|
jhuber6
approved these changes
Oct 22, 2025
dvbuka
pushed a commit
to dvbuka/llvm-project
that referenced
this pull request
Oct 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #160413