From acdaaef625193f10292e9055cb7c901d186c9500 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 16 Feb 2026 16:45:08 +0100 Subject: [PATCH] Backends: further zealous warning fixes. (#9247) --- backends/imgui_impl_dx12.h | 10 ++++++++++ backends/imgui_impl_vulkan.cpp | 8 ++++++++ backends/imgui_impl_vulkan.h | 10 ++++++++++ 3 files changed, 28 insertions(+) diff --git a/backends/imgui_impl_dx12.h b/backends/imgui_impl_dx12.h index 27ede2b21..b8be8db22 100644 --- a/backends/imgui_impl_dx12.h +++ b/backends/imgui_impl_dx12.h @@ -24,6 +24,12 @@ #include // DXGI_FORMAT #include // D3D12_CPU_DESCRIPTOR_HANDLE +// Clang/GCC warnings with -Weverything +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast +#endif + // Initialization data, for ImGui_ImplDX12_Init() struct ImGui_ImplDX12_InitInfo { @@ -76,4 +82,8 @@ struct ImGui_ImplDX12_RenderState ID3D12GraphicsCommandList* CommandList; }; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + #endif // #ifndef IMGUI_DISABLE diff --git a/backends/imgui_impl_vulkan.cpp b/backends/imgui_impl_vulkan.cpp index 8f4bd5a62..c3a304989 100644 --- a/backends/imgui_impl_vulkan.cpp +++ b/backends/imgui_impl_vulkan.cpp @@ -116,6 +116,14 @@ #pragma warning (disable: 4127) // condition expression is constant #endif +// Clang/GCC warnings with -Weverything +#if defined(__clang__) +#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 "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision +#pragma clang diagnostic ignored "-Wcast-function-type" // warning: cast between incompatible function types (for loader) +#endif + // Forward Declarations struct ImGui_ImplVulkan_FrameRenderBuffers; struct ImGui_ImplVulkan_WindowRenderBuffers; diff --git a/backends/imgui_impl_vulkan.h b/backends/imgui_impl_vulkan.h index 4ad33b8f3..5b3baf00c 100644 --- a/backends/imgui_impl_vulkan.h +++ b/backends/imgui_impl_vulkan.h @@ -50,6 +50,12 @@ //#define IMGUI_IMPL_VULKAN_VOLK_FILENAME // Default // Reminder: make those changes in your imconfig.h file, not here! +// Clang/GCC warnings with -Weverything +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast +#endif + #if defined(IMGUI_IMPL_VULKAN_NO_PROTOTYPES) && !defined(VK_NO_PROTOTYPES) #define VK_NO_PROTOTYPES #endif @@ -261,4 +267,8 @@ struct ImGui_ImplVulkanH_Window } }; +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + #endif // #ifndef IMGUI_DISABLE