]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
backtrace: Fix build with newer MinGW versions
authorTobias Brunner <tobias@strongswan.org>
Thu, 10 Nov 2022 12:44:21 +0000 (13:44 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 10 Nov 2022 12:44:21 +0000 (13:44 +0100)
A recent change added CALLBACK to PENUM_PAGE_FILE_CALLBACKW/A in psapi.h,
which conflicts with our own macro of the same name.  Our compat/windows.h
header undefs the Windows definition, but that only works if Windows
headers are included before ours, which wasn't the case for psapi.h.

src/libstrongswan/utils/backtrace.c

index b93be1ed6f5c1d7be3e32a25bf39239458610455..30f19cb1569f207b76663ccf5ee995be7db3b27a 100644 (file)
  */
 
 #define _GNU_SOURCE
+#include <string.h>
 
 #ifdef HAVE_BACKTRACE
-# include <execinfo.h>
+#include <execinfo.h>
 #endif /* HAVE_BACKTRACE */
+
+#ifdef WIN32
+#include <winsock2.h>
+#include <windows.h>
 #ifdef HAVE_DBGHELP
-# include <winsock2.h>
-# include <windows.h>
-# include <dbghelp.h>
+#include <dbghelp.h>
 #endif /* HAVE_DBGHELP */
-#include <string.h>
-
-#include "backtrace.h"
 
-#include <utils/debug.h>
-
-#ifdef WIN32
-# include <psapi.h>
+#include <psapi.h>
 /* missing in MinGW */
 #ifdef WIN64
 #ifndef GetModuleInformation
@@ -47,6 +44,10 @@ DWORD K32GetModuleFileNameExA(HANDLE hProcess, HMODULE hModule,
 #endif /* WIN64 */
 #endif
 
+#include "backtrace.h"
+
+#include <utils/debug.h>
+
 typedef struct private_backtrace_t private_backtrace_t;
 
 /**