Backends: Fixes zealous warnings (#5760)

This commit is contained in:
ocornut 2023-03-23 18:17:45 +01:00
parent 7dcf129b3b
commit 8a6911b894
5 changed files with 47 additions and 2 deletions

View File

@ -44,6 +44,13 @@
#include <stdint.h> // intptr_t #include <stdint.h> // intptr_t
#endif #endif
// Clang/GCC warnings with -Weverything
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-macros" // warning: macro is not used
#pragma clang diagnostic ignored "-Wnonportable-system-include-path"
#endif
// Include OpenGL header (without an OpenGL loader) requires a bit of fiddling // Include OpenGL header (without an OpenGL loader) requires a bit of fiddling
#if defined(_WIN32) && !defined(APIENTRY) #if defined(_WIN32) && !defined(APIENTRY)
#define APIENTRY __stdcall // It is customary to use APIENTRY for OpenGL function pointer declarations on all platforms. Additionally, the Windows OpenGL header needs APIENTRY. #define APIENTRY __stdcall // It is customary to use APIENTRY for OpenGL function pointer declarations on all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
@ -285,3 +292,7 @@ void ImGui_ImplOpenGL2_DestroyDeviceObjects()
{ {
ImGui_ImplOpenGL2_DestroyFontsTexture(); ImGui_ImplOpenGL2_DestroyFontsTexture();
} }
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@ -107,17 +107,20 @@
#include <TargetConditionals.h> #include <TargetConditionals.h>
#endif #endif
// Clang warnings with -Weverything // Clang/GCC warnings with -Weverything
#if defined(__clang__) #if defined(__clang__)
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast #pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast
#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness #pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness
#pragma clang diagnostic ignored "-Wunused-macros" // warning: macro is not used
#pragma clang diagnostic ignored "-Wnonportable-system-include-path"
#pragma clang diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types (for loader)
#endif #endif
#if defined(__GNUC__) #if defined(__GNUC__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
#pragma GCC diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx' #pragma GCC diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx'
#pragma GCC diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types #pragma GCC diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types (for loader)
#endif #endif
// GL includes // GL includes

View File

@ -72,6 +72,12 @@
#include "imgui.h" #include "imgui.h"
#include "imgui_impl_sdl2.h" #include "imgui_impl_sdl2.h"
// Clang warnings with -Weverything
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
#endif
// SDL // SDL
#include <SDL.h> #include <SDL.h>
#include <SDL_syswm.h> #include <SDL_syswm.h>
@ -632,3 +638,7 @@ void ImGui_ImplSDL2_NewFrame()
// Update game controllers (if enabled and available) // Update game controllers (if enabled and available)
ImGui_ImplSDL2_UpdateGamepads(); ImGui_ImplSDL2_UpdateGamepads();
} }
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@ -24,6 +24,12 @@
#include "imgui.h" #include "imgui.h"
#include "imgui_impl_sdl3.h" #include "imgui_impl_sdl3.h"
// Clang warnings with -Weverything
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
#endif
// SDL // SDL
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <SDL3/SDL_syswm.h> #include <SDL3/SDL_syswm.h>
@ -565,3 +571,8 @@ void ImGui_ImplSDL3_NewFrame()
// Update game controllers (if enabled and available) // Update game controllers (if enabled and available)
ImGui_ImplSDL3_UpdateGamepads(); ImGui_ImplSDL3_UpdateGamepads();
} }
#if defined(__clang__)
#pragma clang diagnostic pop
#endif

View File

@ -31,6 +31,12 @@
#include <stdint.h> // intptr_t #include <stdint.h> // intptr_t
#endif #endif
// Clang warnings with -Weverything
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsign-conversion" // warning: implicit conversion changes signedness
#endif
// SDL // SDL
#include <SDL.h> #include <SDL.h>
#if !SDL_VERSION_ATLEAST(2,0,17) #if !SDL_VERSION_ATLEAST(2,0,17)
@ -248,3 +254,7 @@ void ImGui_ImplSDLRenderer_DestroyDeviceObjects()
{ {
ImGui_ImplSDLRenderer_DestroyFontsTexture(); ImGui_ImplSDLRenderer_DestroyFontsTexture();
} }
#if defined(__clang__)
#pragma clang diagnostic pop
#endif