From 88e232739bc9da4c4070a9c912b7ebee0acc84f6 Mon Sep 17 00:00:00 2001 From: Maya Warrier <34803055+mayawarrier@users.noreply.github.com> Date: Tue, 5 Nov 2024 04:44:39 -0500 Subject: [PATCH] Ignore clang warning Wnontrivial-memaccess (#8129) Produced when memset(this, ..) is used on a non-trivially copyable type --- backends/imgui_impl_metal.mm | 7 +++++++ backends/imgui_impl_osx.mm | 7 +++++++ imgui_draw.cpp | 1 + imgui_internal.h | 1 + 4 files changed, 16 insertions(+) diff --git a/backends/imgui_impl_metal.mm b/backends/imgui_impl_metal.mm index b8f82a65d..102f6982a 100644 --- a/backends/imgui_impl_metal.mm +++ b/backends/imgui_impl_metal.mm @@ -38,6 +38,13 @@ #import #import +#if defined(__clang__) +#if __has_warning("-Wunknown-warning-option") +#pragma clang diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx' +#endif +#pragma clang diagnostic ignored "-Wnontrivial-memaccess" // warning: first argument in call to 'memset' is a pointer to non-trivially copyable type +#endif + #pragma mark - Support classes // A wrapper around a MTLBuffer object that knows the last time it was reused diff --git a/backends/imgui_impl_osx.mm b/backends/imgui_impl_osx.mm index de9b57408..6ff4f19a4 100644 --- a/backends/imgui_impl_osx.mm +++ b/backends/imgui_impl_osx.mm @@ -27,6 +27,13 @@ #import #import +#if defined(__clang__) +#if __has_warning("-Wunknown-warning-option") +#pragma clang diagnostic ignored "-Wunknown-warning-option" // warning: unknown warning group 'xxx' +#endif +#pragma clang diagnostic ignored "-Wnontrivial-memaccess" // warning: first argument in call to 'memset' is a pointer to non-trivially copyable type +#endif + // CHANGELOG // (minor and older changes stripped away, please see git history for details) // 2024-08-22: moved some OS/backend related function pointers from ImGuiIO to ImGuiPlatformIO: diff --git a/imgui_draw.cpp b/imgui_draw.cpp index d54c96bab..2385d2ed8 100644 --- a/imgui_draw.cpp +++ b/imgui_draw.cpp @@ -66,6 +66,7 @@ Index of this file: #pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision #pragma clang diagnostic ignored "-Wreserved-identifier" // warning: identifier '_Xxx' is reserved because it starts with '_' followed by a capital letter #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access +#pragma clang diagnostic ignored "-Wnontrivial-memaccess" // warning: first argument in call to 'memset' is a pointer to non-trivially copyable type #elif defined(__GNUC__) #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind #pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used diff --git a/imgui_internal.h b/imgui_internal.h index 18b146777..ad90e0309 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -91,6 +91,7 @@ Index of this file: #pragma clang diagnostic ignored "-Wmissing-noreturn" // warning: function 'xxx' could be declared with attribute 'noreturn' #pragma clang diagnostic ignored "-Wdeprecated-enum-enum-conversion"// warning: bitwise operation between different enumeration types ('XXXFlags_' and 'XXXFlagsPrivate_') is deprecated #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" // warning: 'xxx' is an unsafe pointer used for buffer access +#pragma clang diagnostic ignored "-Wnontrivial-memaccess" // warning: first argument in call to 'memset' is a pointer to non-trivially copyable type #elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind