bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: latest gcc vs lib/timespec.h:85


From: Tim Rühsen
Subject: Re: latest gcc vs lib/timespec.h:85
Date: Wed, 13 Dec 2017 10:32:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 10/30/2017 12:43 AM, Jim Meyering wrote:
> On Sun, Oct 29, 2017 at 4:27 PM, Paul Eggert <address@hidden> wrote:
>> Jim Meyering wrote:
>>>
>>> Here's a proposed patch:
>>
>> I prefer 'assume' to 'assure' here, since it's a low-level time-comparison
>> primitive and lots of other code in the module already silently assumes that
>> the timestamps are valid. Also, while I was in the neighborhood I noticed
>> that the cast is no longer needed, since the module provokes -Wconversion
>> warnings in several other places now (and I expect nobody notices because
>> nobody looks at those warnings any more). So I installed the attached
>> followup.
> 
> Oh, yes. Definitely prefer assume. Thanks for the fix.

Now clang throws out an annoying warning about the return value of
timespec_cmp():

In file included from wget.c:51:
../lib/timespec.h:94:20: warning: implicit conversion loses integer
precision: 'long' to 'int' [-Wshorten-64-to-32]
  return a.tv_nsec - b.tv_nsec;
  ~~~~~~ ~~~~~~~~~~^~~~~~~~~~~

I wonder if we can't silence clang and gcc by keeping the 'assume()'
*and* using return (int) (a.tv_nsec - b.tv_nsec));

WDYT ?

With Best Regards, Tim

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]