summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan2018-11-18 17:36:31 +0000
committerAndrew Dunstan2018-11-18 17:36:31 +0000
commitd5d7f7f3b78e00009ee87ad01d1fb87b28968f65 (patch)
tree5672298ae5e372d24b7c76354105ba9c8ca5374c /src
parent0b59b0e8bcc9e85bad6fffa7828344db1a36f20a (diff)
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/[email protected]
Diffstat (limited to 'src')
-rw-r--r--src/pl/plperl/plperl.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index 12fbad97873..0a77860b98f 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -40,10 +40,15 @@
/*
* 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
#define __inline__ inline
+#ifdef isname
+#undef isnan
+#endif
#endif
/*
@@ -135,6 +140,13 @@
#define vprintf pg_vprintf
#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 */
#define NEED_eval_pv
#define NEED_newRV_noinc