← Commit list

2f1a21b1d9

Tyler Yankee
Tyler Yankee
2026-09-06
SUCCESS Duration: 426s

Subject

build: convert HAS_TIME_T_UNSIGNED to a compile-time check

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

CMake/CurlTests.c+10 -0
@@ -388,3 +388,13 @@ int main(void)
return 0;
}
#endif
+
+#ifdef HAVE_TIME_T_UNSIGNED
+#include <time.h>
+static int time_t_is_unsigned[((time_t)-1 > 0) ? 1 : -1];
+int main(void)
+{
+ (void)time_t_is_unsigned;
+ return 0;
+}
+#endif
CMakeLists.txt+1 -10
@@ -1798,16 +1798,7 @@ if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING)
}" HAVE_WRITABLE_ARGV)
endif()
-if(NOT CMAKE_CROSSCOMPILING)
- include(CheckCSourceRuns)
- check_c_source_runs("
- #include <time.h>
- int main(void)
- {
- time_t t = -1;
- return t < 0;
- }" HAVE_TIME_T_UNSIGNED)
-endif()
+curl_internal_test(HAVE_TIME_T_UNSIGNED)
curl_internal_test(HAVE_GLIBC_STRERROR_R)
curl_internal_test(HAVE_POSIX_STRERROR_R)
configure.ac+11 -12
@@ -4157,22 +4157,21 @@ case $host_os in
;;
*)
AC_MSG_CHECKING([if time_t is unsigned])
- CURL_RUN_IFELSE(
- [
- #include <time.h>
- int main(void)
- {
- time_t t = -1;
- return t < 0;
- }
- ],[
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([[
+ #include <time.h>
+ static int time_t_is_unsigned[((time_t)-1 > 0) ? 1 : -1];
+ int main(void)
+ {
+ (void)time_t_is_unsigned;
+ return 0;
+ }
+ ]])
+ ],[
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
],[
AC_MSG_RESULT([no])
- ],[
- dnl cross-compiling, most systems are signed
- AC_MSG_RESULT([no])
])
;;
esac