From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id F13B03858434; Tue, 2 Apr 2024 15:53:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F13B03858434 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1712073211; bh=Pk2xaD1LZF+TTA5xpKmPptb17DluznDEo1fH+rFAL9U=; h=From:To:Subject:Date:From; b=vsufIU/cV7wNVyd9KmK9CPymAFEIWTv6BrkAr21vxhy0R7BKkJhA1MiVjpDpoMgpu hfgc04Z2vnYWKRV6C+wXAjR96mdqYgeU0g7MEnPN2yOS/FkvG06j6lrenocaOr7OUD piQa2adoB6oNjscCvhzefRZQ+Js/axrs/zoqH7Rg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] support: Handle clang support/dtotimespec.c on dtotimespec X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: b3c1352a18495462d17415d42c99481687765c2f X-Git-Newrev: b69b668f99ca223ff9918d51f056d78a1d526241 Message-Id: <20240402155331.F13B03858434@sourceware.org> Date: Tue, 2 Apr 2024 15:53:31 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b69b668f99ca223ff9918d51f056d78a1d526241 commit b69b668f99ca223ff9918d51f056d78a1d526241 Author: Adhemerval Zanella Date: Mon Mar 20 16:20:48 2023 -0300 support: Handle clang support/dtotimespec.c on dtotimespec 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. Diff: --- support/dtotimespec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/dtotimespec.c b/support/dtotimespec.c index 106b64f486..8c8eaddb51 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 {