From fd0b114540cbd5950a4c6e01131d8b73e1e01c98 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 5 Aug 2022 17:35:47 -0700
Subject: [PATCH 2/5] windows: Remove HAVE_MINIDUMP_TYPE test

We've relied on it being present for msvc for ages...
---
 src/include/pg_config.h.in      |  3 ---
 src/backend/main/main.c         |  2 +-
 src/backend/port/win32/Makefile |  4 +---
 configure                       | 26 --------------------------
 configure.ac                    | 11 -----------
 src/Makefile.global.in          |  3 ---
 src/tools/msvc/Solution.pm      |  1 -
 7 files changed, 2 insertions(+), 48 deletions(-)

diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 5ec31e532e3..63c17c77a5c 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -325,9 +325,6 @@
 /* Define to 1 if you have the `memset_s' function. */
 #undef HAVE_MEMSET_S
 
-/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
-#undef HAVE_MINIDUMP_TYPE
-
 /* Define to 1 if you have the `mkdtemp' function. */
 #undef HAVE_MKDTEMP
 
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index bb782fa1ec6..5a964a0db67 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -63,7 +63,7 @@ main(int argc, char *argv[])
 	 * If supported on the current platform, set up a handler to be called if
 	 * the backend/postmaster crashes with a fatal signal or exception.
 	 */
-#if defined(WIN32) && defined(HAVE_MINIDUMP_TYPE)
+#if defined(WIN32)
 	pgwin32_install_crashdump_handler();
 #endif
 
diff --git a/src/backend/port/win32/Makefile b/src/backend/port/win32/Makefile
index 90126f634ac..61e0369d621 100644
--- a/src/backend/port/win32/Makefile
+++ b/src/backend/port/win32/Makefile
@@ -13,11 +13,9 @@ top_builddir = ../../../..
 include $(top_builddir)/src/Makefile.global
 
 OBJS = \
+	crashdump.o \
 	signal.o \
 	socket.o \
 	timer.o
-ifeq ($(have_win32_dbghelp), yes)
-OBJS += crashdump.o
-endif
 
 include $(top_srcdir)/src/backend/common.mk
diff --git a/configure b/configure
index 3891ae61d31..c60c827a3c8 100755
--- a/configure
+++ b/configure
@@ -648,7 +648,6 @@ MSGFMT
 PG_CRC32C_OBJS
 CFLAGS_ARMV8_CRC32C
 CFLAGS_SSE42
-have_win32_dbghelp
 LIBOBJS
 ZSTD
 LZ4
@@ -16911,32 +16910,7 @@ esac
  ;;
 esac
 
-  ac_fn_c_check_type "$LINENO" "MINIDUMP_TYPE" "ac_cv_type_MINIDUMP_TYPE" "
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-#include <dbghelp.h>
-"
-if test "x$ac_cv_type_MINIDUMP_TYPE" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_MINIDUMP_TYPE 1
-_ACEOF
-
-pgac_minidump_type=yes
-else
-  pgac_minidump_type=no
 fi
-
-fi
-if test x"$pgac_minidump_type" = x"yes" ; then
-  have_win32_dbghelp=yes
-
-else
-  have_win32_dbghelp=no
-
-fi
-
 # Cygwin needs only a bit of that
 if test "$PORTNAME" = "cygwin"; then
   case " $LIBOBJS " in
diff --git a/configure.ac b/configure.ac
index d96066e3803..8593c50575f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1939,18 +1939,7 @@ if test "$PORTNAME" = "win32"; then
   AC_LIBOBJ(win32security)
   AC_LIBOBJ(win32setlocale)
   AC_LIBOBJ(win32stat)
-  AC_CHECK_TYPES(MINIDUMP_TYPE, [pgac_minidump_type=yes], [pgac_minidump_type=no], [
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <string.h>
-#include <dbghelp.h>])
 fi
-if test x"$pgac_minidump_type" = x"yes" ; then
-  AC_SUBST(have_win32_dbghelp,yes)
-else
-  AC_SUBST(have_win32_dbghelp,no)
-fi
-
 # Cygwin needs only a bit of that
 if test "$PORTNAME" = "cygwin"; then
   AC_LIBOBJ(dirmod)
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 14fdd4ef7b1..0625b60c434 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -547,9 +547,6 @@ host_cpu = @host_cpu@
 # Backend stack size limit has to be hard-wired on Windows (it's in bytes)
 WIN32_STACK_RLIMIT=4194304
 
-# Set if we have a working win32 crashdump header
-have_win32_dbghelp = @have_win32_dbghelp@
-
 DLSUFFIX = @DLSUFFIX@
 
 # Pull in platform-specific magic
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 7615a228aa9..ab8f4b24dba 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -305,7 +305,6 @@ sub GenerateFiles
 		HAVE_MBSTOWCS_L             => 1,
 		HAVE_MEMORY_H               => 1,
 		HAVE_MEMSET_S               => undef,
-		HAVE_MINIDUMP_TYPE          => 1,
 		HAVE_MKDTEMP                => undef,
 		HAVE_NETINET_TCP_H          => undef,
 		HAVE_NET_IF_H               => undef,
-- 
2.37.0.3.g30cc8d0f14

