public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] support: Handle clang support/dtotimespec.c on dtotimespec
Date: Wed,  7 Feb 2024 14:07:03 +0000 (GMT)	[thread overview]
Message-ID: <20240207140703.AE7D43858285@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=97fa106e90fdf226bbb9fc7bc8823e17146eed06

commit 97fa106e90fdf226bbb9fc7bc8823e17146eed06
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
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
     {

             reply	other threads:[~2024-02-07 14:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 14:07 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-17 20:07 Adhemerval Zanella
2024-04-02 15:53 Adhemerval Zanella
2024-02-09 17:31 Adhemerval Zanella
2024-01-29 17:57 Adhemerval Zanella
2023-12-21 18:53 Adhemerval Zanella
2023-09-28 17:52 Adhemerval Zanella
2023-08-30 12:42 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240207140703.AE7D43858285@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).