From 0eaeb9e50cb6114b0808ee140326ab015c533cee Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 10 Mar 2017 02:29:25 +0300 Subject: Fix compilation warnings with mingw. --- src/enums/gui/chattabtype.h | 9 +++++++++ src/enums/gui/npcactionstate.h | 7 ++++++- src/fs/files.cpp | 2 +- src/gui/windowmanager.cpp | 7 +++++-- src/localconsts.h | 8 ++++++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/enums/gui/chattabtype.h b/src/enums/gui/chattabtype.h index 8b032a1f4..f37a98db6 100644 --- a/src/enums/gui/chattabtype.h +++ b/src/enums/gui/chattabtype.h @@ -23,6 +23,13 @@ #include "enums/simpletypes/enumdefines.h" +#ifdef INPUT +#undef INPUT +#endif // INPUT + +PRAGMAMINGW(GCC diagnostic push) +PRAGMAMINGW(GCC diagnostic ignored "-Wshadow") + enumStart(ChatTabType) { UNKNOWN = 0, @@ -39,4 +46,6 @@ enumStart(ChatTabType) } enumEnd(ChatTabType); +PRAGMAMINGW(GCC diagnostic pop) + #endif // ENUMS_GUI_CHATTABTYPE_H diff --git a/src/enums/gui/npcactionstate.h b/src/enums/gui/npcactionstate.h index c044d74aa..d541b3013 100644 --- a/src/enums/gui/npcactionstate.h +++ b/src/enums/gui/npcactionstate.h @@ -26,9 +26,12 @@ #include "enums/simpletypes/enumdefines.h" #ifdef INPUT -#undef +#undef INPUT #endif // INPUT +PRAGMAMINGW(GCC diagnostic push) +PRAGMAMINGW(GCC diagnostic ignored "-Wshadow") + enumStart(NpcActionState) { WAIT = 0, @@ -38,4 +41,6 @@ enumStart(NpcActionState) } enumEnd(NpcActionState); +PRAGMAMINGW(GCC diagnostic pop) + #endif // ENUMS_GUI_NPCACTIONSTATE_H diff --git a/src/fs/files.cpp b/src/fs/files.cpp index ab40a7d8f..6c4792270 100644 --- a/src/fs/files.cpp +++ b/src/fs/files.cpp @@ -293,7 +293,7 @@ void Files::deleteFilesInDirectory(std::string path) void Files::enumFiles(StringVect &files, std::string path, - const bool skipSymlinks) + const bool skipSymlinks A_WIN_UNUSED) { if (findLast(path, "/") == false) path += "/"; diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index ce0b0132d..e578a21c9 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -374,8 +374,11 @@ void WindowManager::setIcon() else SDL::getWindowWMInfo(nullptr, &pInfo); // Attempt to load icon from .ico file - HICON icon = (HICON) LoadImage(nullptr, iconFile.c_str(), - IMAGE_ICON, 64, 64, LR_LOADFROMFILE); + HICON icon = static_cast(LoadImage(nullptr, + iconFile.c_str(), + IMAGE_ICON, + 64, 64, + LR_LOADFROMFILE)); // If it's failing, we load the default resource file. if (!icon) { diff --git a/src/localconsts.h b/src/localconsts.h index 4734ebd50..08b64e0d9 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -351,6 +351,14 @@ PRAGMA45(GCC diagnostic pop) #define USE_FILE_FOPEN 1 +#ifdef __MINGW32__ +#define PRAGMAMINGW(str) _Pragma(#str) +#define A_WIN_UNUSED __attribute__ ((unused)) +#else // __MINGW32__ +#define PRAGMAMINGW(str) +#define A_WIN_UNUSED +#endif // __MINGW32__ + #ifdef DYECMD #undef USE_FUZZER #endif // DYECMD -- cgit v1.2.3-60-g2f50