From 9269a72c54e0faab981aa8710b65858e2eb1f59c Mon Sep 17 00:00:00 2001 From: Pavol Gono <28236775+gpalino@users.noreply.github.com> Date: Sun, 27 Oct 2024 16:30:36 +0100 Subject: [PATCH] Fixed compiler warnings and errors under MSYS2+MINGW64 platform. (#186) Fixed compiler warnings and errors under MSYS2+MINGW64 platform. --- src/binary/object.cpp | 5 ++++- src/binary/pe.cpp | 4 +++- src/demangle/demangle_with_winapi.cpp | 4 +++- src/from_current.cpp | 4 +++- src/platform/dbghelp_syminit_manager.cpp | 4 +++- src/platform/path.hpp | 4 +++- src/platform/program_name.hpp | 4 +++- src/symbols/symbols_with_dbghelp.cpp | 4 +++- src/unwind/unwind_with_winapi.cpp | 4 +++- src/utils/utils.cpp | 4 +++- 10 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/binary/object.cpp b/src/binary/object.cpp index 0920e42..7f4d524 100644 --- a/src/binary/object.cpp +++ b/src/binary/object.cpp @@ -5,6 +5,7 @@ #include "binary/module_base.hpp" #include +#include #include #include #include @@ -16,7 +17,9 @@ #include // needed for dladdr1's link_map info #endif #elif IS_WINDOWS - #define WIN32_LEAN_AND_MEAN + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #endif diff --git a/src/binary/pe.cpp b/src/binary/pe.cpp index 107084a..dc0b728 100644 --- a/src/binary/pe.cpp +++ b/src/binary/pe.cpp @@ -10,7 +10,9 @@ #include #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include namespace cpptrace { diff --git a/src/demangle/demangle_with_winapi.cpp b/src/demangle/demangle_with_winapi.cpp index 6bfd576..5d702c4 100644 --- a/src/demangle/demangle_with_winapi.cpp +++ b/src/demangle/demangle_with_winapi.cpp @@ -4,7 +4,9 @@ #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #include diff --git a/src/from_current.cpp b/src/from_current.cpp index d45c551..d099a76 100644 --- a/src/from_current.cpp +++ b/src/from_current.cpp @@ -11,7 +11,9 @@ #ifndef _MSC_VER #include #if IS_WINDOWS - #define WIN32_LEAN_AND_MEAN + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #else #include diff --git a/src/platform/dbghelp_syminit_manager.cpp b/src/platform/dbghelp_syminit_manager.cpp index 774db78..e11f866 100644 --- a/src/platform/dbghelp_syminit_manager.cpp +++ b/src/platform/dbghelp_syminit_manager.cpp @@ -9,7 +9,9 @@ #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #include diff --git a/src/platform/path.hpp b/src/platform/path.hpp index afb6775..849ad66 100644 --- a/src/platform/path.hpp +++ b/src/platform/path.hpp @@ -7,7 +7,9 @@ #include #if IS_WINDOWS -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #endif diff --git a/src/platform/program_name.hpp b/src/platform/program_name.hpp index 7d22cda..e5dafac 100644 --- a/src/platform/program_name.hpp +++ b/src/platform/program_name.hpp @@ -7,7 +7,9 @@ #include "platform/platform.hpp" #if IS_WINDOWS -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #define CPPTRACE_MAX_PATH MAX_PATH diff --git a/src/symbols/symbols_with_dbghelp.cpp b/src/symbols/symbols_with_dbghelp.cpp index 7bb05e2..0e665a9 100644 --- a/src/symbols/symbols_with_dbghelp.cpp +++ b/src/symbols/symbols_with_dbghelp.cpp @@ -12,7 +12,9 @@ #include #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include #include diff --git a/src/unwind/unwind_with_winapi.cpp b/src/unwind/unwind_with_winapi.cpp index 75ec5a1..2dd59b3 100644 --- a/src/unwind/unwind_with_winapi.cpp +++ b/src/unwind/unwind_with_winapi.cpp @@ -9,7 +9,9 @@ #include #include -#define WIN32_LEAN_AND_MEAN +#ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN +#endif #include // Fucking windows headers diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 80de344..4a2061e 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -2,7 +2,9 @@ #if IS_WINDOWS #include - #define WIN32_LEAN_AND_MEAN + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include #else #include