[libvirt] [PATCH 2/2] util: Cast to 'long double' when calling isnan()
Martin Kletzander
mkletzan at redhat.com
Tue Jan 3 12:54:06 UTC 2017
On Mon, Jan 02, 2017 at 07:15:31PM +0100, Andrea Bolognani wrote:
>Clang 3.9 chokes when calling isnan() on a double variable:
>
> util/virxml.c:153:21: error: implicit conversion increases
> floating-point precision: 'double' to
> 'long double' [-Werror,-Wdouble-promotion]
> (isnan(obj->floatval))) {
> ~~~~~~~~~~~^~~~~~~~~
> /usr/include/math.h:360:46: note: expanded from macro 'isnan'
> # define isnan(x) __MATH_TG ((x), __isnan, (x))
> ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
> /usr/include/math.h:295:16: note: expanded from macro '__MATH_TG'
> : FUNC ## l ARGS)
> ~~~~~~~~~ ^~~~
>
>Note how the wrong version of isnan() is being called: isnanl()
>is for 'long double's, but obj->floatval is a double and a
>suitable version should be called instead.
>
I don't know where do you see that ^^. Good eyes, I guess =)
>Cast the value to 'long double' to make the compiler happy.
>---
>Clang seems to be tripping on the specific way the isnan()
>macro is defined in recent glibc versions; more specifically,
>if I replace the current definition in <math.h> with the one
>that predates the introduction of the __MATH_TG() macro, I
>can get the current code to compile. I was not able to find
>anything wrong with the __MATH_TG() macro though.
>
This sounds like a glibc <=> clang problem that we shoudn't introduce
more complexity for. Also *I* don't see this error, for a change =)
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170103/4b222688/attachment-0001.sig>
More information about the libvir-list
mailing list