mirror of
https://github.com/ocornut/imgui.git
synced 2025-12-19 12:55:34 +00:00
Backends: fixed misc zealous Clang warnings.
This commit is contained in:
@@ -44,7 +44,7 @@ struct ImGui_ImplDX12_InitInfo
|
|||||||
D3D12_GPU_DESCRIPTOR_HANDLE LegacySingleSrvGpuDescriptor;
|
D3D12_GPU_DESCRIPTOR_HANDLE LegacySingleSrvGpuDescriptor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ImGui_ImplDX12_InitInfo() { memset((void*)this, 0, sizeof(*this)); }
|
ImGui_ImplDX12_InitInfo() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
|
// Follow "Getting Started" link and check examples/ folder to learn about using backends!
|
||||||
|
|||||||
@@ -101,8 +101,10 @@
|
|||||||
// Clang warnings with -Weverything
|
// Clang 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 "-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 is.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GLFW
|
// GLFW
|
||||||
@@ -957,8 +959,8 @@ static void ImGui_ImplGlfw_GetWindowSizeAndFramebufferScale(GLFWwindow* window,
|
|||||||
int display_w, display_h;
|
int display_w, display_h;
|
||||||
glfwGetWindowSize(window, &w, &h);
|
glfwGetWindowSize(window, &w, &h);
|
||||||
glfwGetFramebufferSize(window, &display_w, &display_h);
|
glfwGetFramebufferSize(window, &display_w, &display_h);
|
||||||
float fb_scale_x = (w > 0) ? (float)display_w / w : 1.0f;
|
float fb_scale_x = (w > 0) ? (float)display_w / (float)w : 1.0f;
|
||||||
float fb_scale_y = (h > 0) ? (float)display_h / h : 1.0f;
|
float fb_scale_y = (h > 0) ? (float)display_h / (float)h : 1.0f;
|
||||||
#if GLFW_HAS_X11_OR_WAYLAND
|
#if GLFW_HAS_X11_OR_WAYLAND
|
||||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData(window);
|
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData(window);
|
||||||
if (!bd->IsWayland)
|
if (!bd->IsWayland)
|
||||||
|
|||||||
@@ -17,6 +17,11 @@
|
|||||||
#ifndef IMGUI_DISABLE
|
#ifndef IMGUI_DISABLE
|
||||||
#include "imgui_impl_null.h"
|
#include "imgui_impl_null.h"
|
||||||
|
|
||||||
|
// Clang/GCC warnings with -Weverything
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wold-style-cast" // warning: use of old-style cast // yes, they are more terse.
|
||||||
|
#endif
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplNull_Init()
|
IMGUI_IMPL_API bool ImGui_ImplNull_Init()
|
||||||
{
|
{
|
||||||
ImGui_ImplNullPlatform_Init();
|
ImGui_ImplNullPlatform_Init();
|
||||||
@@ -75,7 +80,7 @@ IMGUI_IMPL_API void ImGui_ImplNullRender_NewFrame()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplNullRender_UpdateTexture(ImTextureData* tex)
|
static void ImGui_ImplNullRender_UpdateTexture(ImTextureData* tex)
|
||||||
{
|
{
|
||||||
if (tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantDestroy)
|
if (tex->Status == ImTextureStatus_WantCreate || tex->Status == ImTextureStatus_WantDestroy)
|
||||||
tex->SetStatus(ImTextureStatus_OK);
|
tex->SetStatus(ImTextureStatus_OK);
|
||||||
|
|||||||
@@ -819,8 +819,8 @@ static void ImGui_ImplSDL3_GetWindowSizeAndFramebufferScale(SDL_Window* window,
|
|||||||
#else
|
#else
|
||||||
int display_w, display_h;
|
int display_w, display_h;
|
||||||
SDL_GetWindowSizeInPixels(window, &display_w, &display_h);
|
SDL_GetWindowSizeInPixels(window, &display_w, &display_h);
|
||||||
float fb_scale_x = (w > 0) ? (float)display_w / w : 1.0f;
|
float fb_scale_x = (w > 0) ? (float)display_w / (float)w : 1.0f;
|
||||||
float fb_scale_y = (h > 0) ? (float)display_h / h : 1.0f;
|
float fb_scale_y = (h > 0) ? (float)display_h / (float)h : 1.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (out_size != nullptr)
|
if (out_size != nullptr)
|
||||||
|
|||||||
Reference in New Issue
Block a user