From 2bf110d9f8c7736f60690cb7a6854a672abc8ea3 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 10 Nov 2022 13:44:21 +0100 Subject: [PATCH] backtrace: Fix build with newer MinGW versions 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 | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/libstrongswan/utils/backtrace.c b/src/libstrongswan/utils/backtrace.c index b93be1ed6..30f19cb15 100644 --- a/src/libstrongswan/utils/backtrace.c +++ b/src/libstrongswan/utils/backtrace.c @@ -15,23 +15,20 @@ */ #define _GNU_SOURCE - -#ifdef HAVE_BACKTRACE -# include -#endif /* HAVE_BACKTRACE */ -#ifdef HAVE_DBGHELP -# include -# include -# include -#endif /* HAVE_DBGHELP */ #include -#include "backtrace.h" - -#include +#ifdef HAVE_BACKTRACE +#include +#endif /* HAVE_BACKTRACE */ #ifdef WIN32 -# include +#include +#include +#ifdef HAVE_DBGHELP +#include +#endif /* HAVE_DBGHELP */ + +#include /* missing in MinGW */ #ifdef WIN64 #ifndef GetModuleInformation @@ -47,6 +44,10 @@ DWORD K32GetModuleFileNameExA(HANDLE hProcess, HMODULE hModule, #endif /* WIN64 */ #endif +#include "backtrace.h" + +#include + typedef struct private_backtrace_t private_backtrace_t; /**