From d621f28cee75e0493b5cff3b5cf461e88eea6848 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Wed, 7 Feb 2024 14:02:58 -0500
Subject: [PATCH] Reverse logic on GCC/Win32 detection for alloca/malloc.h

Mingw32 is _WIN32 and GCC, and we need some way to get the free()
prototype. :D
---
 src/xpdev/genwrap.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h
index bb7dc4998c..3b725ec39f 100644
--- a/src/xpdev/genwrap.h
+++ b/src/xpdev/genwrap.h
@@ -71,11 +71,11 @@ extern "C" {
  * On platforms where alloca() is not in libc, programs which use
  * it will fail to link when compiled with non-GNU compilers.
  */
-#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
+#if defined(_WIN32)
+#include <malloc.h>
+#elif __GNUC__ >= 2 || defined(__INTEL_COMPILER)
 #undef  alloca  /* some GNU bits try to get cute and define this on their own */
 #define alloca(sz) __builtin_alloca(sz)
-#elif defined(_WIN32)
-#include <malloc.h>
 #endif
 
 /*********************/
-- 
GitLab