Commit d5d7f7f3 authored by Andrew Dunstan's avatar Andrew Dunstan

Silence MSVC warnings about redefinition of isnan

Some versions of perl.h define isnan when the compiler is MSVC. To avoid
warnings about this, undefine the symbol before including perl.h and
re-add the definition afterwards if it wasn't recreated.

Discussion: https://postgr.es/m/caf0568e-3c1f-07fd-6914-d903f22560f2@2ndQuadrant.com
parent 0b59b0e8
...@@ -40,10 +40,15 @@ ...@@ -40,10 +40,15 @@
/* /*
* ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's * ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
* __inline__. Translate to something MSVC recognizes. * __inline__. Translate to something MSVC recognizes. Also, perl.h sometimes
* defines isnan, so undefine it here and put back the definition later if
* perl.h doesn't.
*/ */
#ifdef _MSC_VER #ifdef _MSC_VER
#define __inline__ inline #define __inline__ inline
#ifdef isname
#undef isnan
#endif
#endif #endif
/* /*
...@@ -135,6 +140,13 @@ ...@@ -135,6 +140,13 @@
#define vprintf pg_vprintf #define vprintf pg_vprintf
#define printf(...) pg_printf(__VA_ARGS__) #define printf(...) pg_printf(__VA_ARGS__)
/* put back the definition of isnan if needed */
#ifdef _MSC_VER
#ifndef isnan
#define isnan(x) _isnan(x)
#endif
#endif
/* perl version and platform portability */ /* perl version and platform portability */
#define NEED_eval_pv #define NEED_eval_pv
#define NEED_newRV_noinc #define NEED_newRV_noinc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment