From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 8040538313B1; Thu, 28 Sep 2023 17:52:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8040538313B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695923523; bh=tL3Ghgm7Alyfy2JcGqiAkSEzDDBMdbuLESrmJwH3lC0=; h=From:To:Subject:Date:From; b=CghvS269WbvNIQ/IbkZ2J1UHzb+5+G3phTM0J+ztx0/uQT9Ek0G1oqHt6ZYXIxtHS YpF/6JnND5SdO+0RbmcvhAXl6NkiOrhaOyF2+ggJbgCrLPxy9fslAxs59UWFfnkhd6 TvfHV4QGq5AgugMRiyBdZE4Xd3C5Rt2c43sj8ldA= 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: 07adefbb3198257a7e626a5c2db472f101b72b22 X-Git-Newrev: 0a6178dcd6d1a6f60719615a7c99f6aaf236e71b Message-Id: <20230928175203.8040538313B1@sourceware.org> Date: Thu, 28 Sep 2023 17:52:03 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0a6178dcd6d1a6f60719615a7c99f6aaf236e71b commit 0a6178dcd6d1a6f60719615a7c99f6aaf236e71b 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 cde5b4d74c..45fa3a3e7f 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 {