]> granicus.if.org Git - postgresql/commitdiff
Rethink how to get float.h in old Windows API for isnan/isinf
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 11 Jul 2018 13:09:59 +0000 (09:09 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 11 Jul 2018 13:11:48 +0000 (09:11 -0400)
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 cec8394b5ccd), 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

24 files changed:
contrib/cube/cube.c
contrib/jsonb_plperl/jsonb_plperl.c
contrib/tsm_system_time/tsm_system_time.c
src/backend/access/gist/gistproc.c
src/backend/access/gist/gistutil.c
src/backend/access/tablesample/bernoulli.c
src/backend/access/tablesample/system.c
src/backend/optimizer/path/costsize.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/int8.c
src/backend/utils/adt/nabstime.c
src/backend/utils/adt/orderedsetaggs.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/timestamp.c
src/backend/utils/misc/help_config.c
src/include/port/win32_port.h
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/timestamp.c
src/port/rint.c
src/port/snprintf.c
src/test/regress/regress.c

index 092ef149cfa9e3e8ec9e09f77ef8ea272aebd581..f02ac24ea182d269324d72b5c89fb0e40187394f 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "postgres.h"
 
-#include <float.h>
 #include <math.h>
 
 #include "access/gist.h"
index e847ae53699d1390c07d9e342da15db4fbfe91b0..79c5f57d8fdbc8ac7edee6427cd43cd53c14c659 100644 (file)
@@ -1,6 +1,5 @@
 #include "postgres.h"
 
-#include <float.h>
 #include <math.h>
 
 /* Defined by Perl */
index f0c220aa4ac589b40bcb1daf4105267a76f53517..249d6f4d463181e5fd05bf853b09e5a3543f4ba3 100644 (file)
@@ -24,9 +24,6 @@
 
 #include "postgres.h"
 
-#ifdef _MSC_VER
-#include <float.h>                             /* for _isnan */
-#endif
 #include <math.h>
 
 #include "access/relscan.h"
index 97e6dc99100115dfaccc15d056e2e178b651cb55..0536b318ccba848488b0489afb319e0303fdd6c3 100644 (file)
@@ -17,7 +17,6 @@
  */
 #include "postgres.h"
 
-#include <float.h>
 #include <math.h>
 
 #include "access/gist.h"
index 55cccd247a085d3919b3904f2dee7bd42c6dceaa..12804c321c223e08d8f9ababbb92b4268445f24f 100644 (file)
@@ -13,7 +13,6 @@
  */
 #include "postgres.h"
 
-#include <float.h>
 #include <math.h>
 
 #include "access/gist_private.h"
index 1f2a9339351ab9d1135af88a18f8303371fbe22f..fba62e7b1678262cbdaebb762dab6b045a51ed39 100644 (file)
@@ -24,9 +24,6 @@
 
 #include "postgres.h"
 
-#ifdef _MSC_VER
-#include <float.h>                             /* for _isnan */
-#endif
 #include <math.h>
 
 #include "access/hash.h"
index f888e04f40cf3b2b82e241a121fb34047beb7739..4d937b4258af037e9c335d9b48378768c59cd658 100644 (file)
@@ -24,9 +24,6 @@
 
 #include "postgres.h"
 
-#ifdef _MSC_VER
-#include <float.h>                             /* for _isnan */
-#endif
 #include <math.h>
 
 #include "access/hash.h"
index a2a7e0c520228b7840fb2d1507179b6aec84bbc5..a6811e0338487babe2b7e01ebe4073af8491c7f4 100644 (file)
@@ -71,9 +71,6 @@
 
 #include "postgres.h"
 
-#ifdef _MSC_VER
-#include <float.h>                             /* for _isnan */
-#endif
 #include <math.h>
 
 #include "access/amapi.h"
index 0cbdbe5587e0c9d7b7789712affe6b614c788d17..0c6c9da253e587ce4f73c8dce641c14951ed6678 100644 (file)
@@ -15,9 +15,6 @@
 #include "postgres.h"
 
 #include <ctype.h>
-#ifdef _MSC_VER
-#include <float.h>                             /* for _isnan */
-#endif
 #include <math.h>
 
 #include "access/hash.h"
index 979f6fd7b22f0b63105bfcefcb497fd4cbbe9a17..017cc1a7b15ac297e326f5ab638369e6c8e4d2b5 100644 (file)
@@ -15,7 +15,6 @@
 #include "postgres.h"
 
 #include <ctype.h>
-#include <float.h>
 #include <limits.h>
 #include <math.h>
 
index 96686ccb2c903de1acb7330370e69ba617f388c0..73798e7796b816cb7bcec33d1e5959890796f8d6 100644 (file)
@@ -14,7 +14,6 @@
 #include "postgres.h"
 
 #include <ctype.h>
-#include <float.h>                             /* for _isnan */
 #include <limits.h>
 #include <math.h>
 
index fae97135dbb49b3a22d7eae0fd8049a6a2154c47..6ecb41b98f5b7f9aded1017839f69babe5918cd2 100644 (file)
@@ -17,7 +17,6 @@
 #include "postgres.h"
 
 #include <ctype.h>
-#include <float.h>
 #include <limits.h>
 #include <math.h>
 #include <time.h>
index 5867f3df07059495ee4fac077eb714001d578e2c..be9422dcfb68ba06cf88dbaaa6b63ffd6efd974b 100644 (file)
@@ -14,7 +14,6 @@
  */
 #include "postgres.h"
 
-#include <float.h>
 #include <math.h>
 
 #include "catalog/pg_aggregate.h"
index 4b08cdb721aca0bc64647ffbac352cc47ac4c73a..f1c78ffb65631d11b7910e48f550cacbf0c5c751 100644 (file)
@@ -98,7 +98,6 @@
 #include "postgres.h"
 
 #include <ctype.h>
-#include <float.h>
 #include <math.h>
 
 #include "access/brin.h"
index 1d75caebe174e4cc20912017eb34d7376cab8b2e..b98036f200b832dd0f0e255761291339307d4c7e 100644 (file)
@@ -17,7 +17,6 @@
 
 #include <ctype.h>
 #include <math.h>
-#include <float.h>
 #include <limits.h>
 #include <sys/time.h>
 
index 25f5c828046cffd2461c384b93e84c6e463eb2aa..871c535756867998eca66da13a3c8bc81b9d5394 100644 (file)
@@ -16,7 +16,6 @@
  */
 #include "postgres.h"
 
-#include <float.h>
 #include <limits.h>
 #include <unistd.h>
 
index d31c28f7d4433571ef73609ef0e0a8bc29288b76..b398cd3b975434c57a09abf6c072c9db294e741f 100644 (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
index bd8553f1f5348e185e77a2440f8eddb3bb3f5510..f3d326a50b1a4aed7807f6747699ee0cff2ebe81 100644 (file)
@@ -3,7 +3,6 @@
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
 
-#include <float.h>
 #include <math.h>
 
 #include "ecpgtype.h"
index c1b44d36f2b5db87b6647a09f4d772f7b2d5c81b..6f6819a8f48f1eef367037dddee46c18c07a05d9 100644 (file)
@@ -16,7 +16,6 @@
 #define POSTGRES_ECPG_INTERNAL
 #include "postgres_fe.h"
 
-#include <float.h>
 #include <math.h>
 
 #include "catalog/pg_type_d.h"
index 1e692a5f9efdb197fe344d27cc9adc036abc739a..ed321febf2b2101cd4b62bd2c3608b9b32e8010d 100644 (file)
@@ -4,7 +4,6 @@
 
 #include <time.h>
 #include <ctype.h>
-#include <float.h>
 #include <limits.h>
 
 #include "extern.h"
index abccc268dccea79348c1cb312be4ab6bdd00b462..4cd4fe2da288a1c7d29e8f609675784fa1f54844 100644 (file)
@@ -4,7 +4,6 @@
 #include "postgres_fe.h"
 
 #include <time.h>
-#include <float.h>
 #include <limits.h>
 #include <math.h>
 
index d27fdfa6b4a1b89529f1962456cb0896f6d03575..d59d9ab774307b7db2f7cb2347815a30da563fc5 100644 (file)
@@ -12,7 +12,6 @@
  */
 #include "c.h"
 
-#include <float.h>
 #include <math.h>
 
 /*
index 83584259802348dc506a008b5713ae7b045b8f3a..a184134ee6b02b323a78982b60a6dc740aba4fc7 100644 (file)
@@ -33,9 +33,6 @@
 #include "c.h"
 
 #include <ctype.h>
-#ifdef _MSC_VER
-#include <float.h>                             /* for _isnan */
-#endif
 #include <limits.h>
 #include <math.h>
 #ifndef WIN32
index 7060b6fbf32a7338639aacfa67045207a79e5b5f..97a50f30e7b289d992ba3f30c91fc79c8a31cafc 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "postgres.h"
 
-#include <float.h>
 #include <math.h>
 #include <signal.h>