From f22b6e1e09229161a703e31aef88ce9631b4dd65 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 4 May 2016 23:28:16 +0200 Subject: [PATCH] Fixed/silenced various absurd GCC warnings from outer space (#626) --- imgui.cpp | 4 ++-- imgui_draw.cpp | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 153375b9c..ae44ef98c 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -613,12 +613,12 @@ #pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals. #pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it. #pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness // -#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning : function xx could be declared with attribute 'noreturn' warning // GetDefaultFontData() asserts which some implementation makes it never return. -#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' +#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int' // #endif #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size +#pragma GCC diagnostic ignored "-Wformat" // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*' #endif //------------------------------------------------------------------------- diff --git a/imgui_draw.cpp b/imgui_draw.cpp index 4531f8afc..8bfdaa787 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -58,7 +58,7 @@ namespace IMGUI_STB_NAMESPACE #ifdef _MSC_VER #pragma warning (push) -#pragma warning (disable: 4456) // declaration of 'xx' hides previous local declaration +#pragma warning (disable: 4456) // declaration of 'xx' hides previous local declaration #endif #ifdef __clang__ @@ -68,6 +68,11 @@ namespace IMGUI_STB_NAMESPACE #pragma clang diagnostic ignored "-Wmissing-prototypes" #endif +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" // warning: comparison is always true due to limited range of data type [-Wtype-limits] +#endif + #define STBRP_ASSERT(x) IM_ASSERT(x) #ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION #define STBRP_STATIC @@ -86,6 +91,10 @@ namespace IMGUI_STB_NAMESPACE #endif #include "stb_truetype.h" +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + #ifdef __clang__ #pragma clang diagnostic pop #endif