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: Paul Eggert
Subject: Re: latest gcc vs lib/timespec.h:85
Date: Wed, 13 Dec 2017 13:55:37 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 12/13/2017 01:32 AM, Tim Rühsen wrote:
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)); I'd rather continue to omit the cast, as casts are too powerful (it's too easy to get them wrong, with no diagnostic).

-Wshorten-64-to-32 is like -Wconversion, and we should ask people not to use -Wshorten-64-to-32 in the same way that we ask them not to use -Wconversion. Does it fix things to add -Wshorten-64-to-32 to build-aux/gcc-warning.spec and to build-aux/g++-warning.spec?





reply via email to

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