[PATCH 27/59] support: Handle clang support/dtotimespec.c on dtotimespec
Adhemerval Zanella
adhemerval.zanella@linaro.org
Fri Oct 17 19:13:02 GMT 2025
clang issues:
dtotimespec.c:31:25: error: implicit conversion from 'time_t' (aka
'long') to 'double' changes value from 9223372036854775807 to
9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
~ ^~~~~~~~~~~~~~~~~~~~~
../include/intprops.h:57:4: note: expanded from macro 'TYPE_MAXIMUM'
((t) (! TYPE_SIGNED (t)
\
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So explicit cast it to double.
---
support/dtotimespec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/support/dtotimespec.c b/support/dtotimespec.c
index b4e252c715..1b66575281 100644
--- a/support/dtotimespec.c
+++ b/support/dtotimespec.c
@@ -28,7 +28,7 @@ dtotimespec (double sec)
{
if (sec <= TYPE_MINIMUM (time_t))
return make_timespec (TYPE_MINIMUM (time_t), 0);
- else if (sec >= 1.0 + TYPE_MAXIMUM (time_t))
+ else if (sec >= 1.0 + (double) TYPE_MAXIMUM (time_t))
return make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_HZ - 1);
else
{
--
2.43.0
More information about the Libc-alpha
mailing list