From d346ca621f1e9d2610b255b221bd6df3e07e799e Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@enterprisedb.com>
Date: Wed, 2 May 2018 17:23:30 +1200
Subject: [PATCH] Try to fix compiler warnings in plperl on Windows.

Perl's XSUB.h header defines macros to replace libc functions.  Our header
port_win32.h does something similar earlier, so XSUB.h causes compiler
warnings about macro redefinition.  Undefine our macros before including
XSUB.h

Thomas Munro
Discussion: https://postgr.es/m/CAEepm%3D3%3DTDYEXUEcHpEx%2BTwc31wo7PA0oBAiNt6sWmq93MW02A%40mail.gmail.com
---
 src/pl/plperl/plperl.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index c72c6ea59fc..91826ad1ba6 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -70,6 +70,27 @@
  * before ppport.h, so use a #define flag to control inclusion here.
  */
 #ifdef PG_NEED_PERL_XSUB_H
+/* port_win32.h defines macros that XSUB.h redefines, so avoid warnings. */
+#ifdef WIN32
+#undef accept
+#undef bind
+#undef connect
+#undef fopen
+#undef kill
+#undef listen
+#undef lstat
+#undef mkdir
+#undef open
+#undef putenv
+#undef recv
+#undef rename
+#undef select
+#undef send
+#undef socket
+#undef stat
+#undef unlink
+#undef vfprintf
+#endif
 #include "XSUB.h"
 #endif
 
-- 
2.17.0

