1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-24 01:29:19 +03:00

Rethink how to get float.h in old Windows API for isnan/isinf

We include <float.h> in every place that needs isnan(), because MSVC
used to require it.  However, since MSVC 2013 that's no longer necessary
(cf. commit cec8394b5c), so we can retire the inclusion to a
version-specific stanza in win32_port.h, where it doesn't need to
pollute random .c files.  The header is of course still needed in a few
places for other reasons.

I (Álvaro) removed float.h from a few more files than in Emre's original
patch.  This doesn't break the build in my system, but we'll see what
the buildfarm has to say about it all.

Author: Emre Hasegeli
Discussion: https://postgr.es/m/CAE2gYzyc0+5uG+Cd9-BSL7NKC8LSHLNg1Aq2=8ubjnUwut4_iw@mail.gmail.com
This commit is contained in:
Alvaro Herrera
2018-07-11 09:09:59 -04:00
parent a01d0fa1d8
commit f2c587067a
24 changed files with 7 additions and 35 deletions

View File

@@ -502,7 +502,14 @@ typedef unsigned short mode_t;
#define W_OK 2
#define R_OK 4
/*
* isinf() and isnan() should per spec be in <math.h>, but MSVC older than
* 2013 does not have them there. It does have _fpclass() and _isnan(), but
* they're in <float.h>, so include that here even though it means float.h
* percolates to our whole tree. Recent versions don't require any of this.
*/
#if (_MSC_VER < 1800)
#include <float.h>
#define isinf(x) ((_fpclass(x) == _FPCLASS_PINF) || (_fpclass(x) == _FPCLASS_NINF))
#define isnan(x) _isnan(x)
#endif