Resolve [-Wclass-memaccess]

This commit is contained in:
Minty-Meeo
2023-03-23 12:49:09 -05:00
committed by get
parent 2bb619a508
commit 678c93589a
6 changed files with 22 additions and 56 deletions

View File

@ -8,6 +8,7 @@
#include <memory>
#include <mutex>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
@ -153,14 +154,8 @@ NativeVertexFormat* GetUberVertexFormat(const PortableVertexDeclaration& decl)
// The padding in the structs can cause the memcmp() in the map to create duplicates.
// Avoid this by initializing the padding to zero.
PortableVertexDeclaration new_decl;
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
std::memset(&new_decl, 0, sizeof(new_decl));
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
static_assert(std::is_trivially_copyable_v<PortableVertexDeclaration>);
std::memset(static_cast<void*>(&new_decl), 0, sizeof(new_decl));
new_decl.stride = decl.stride;
auto MakeDummyAttribute = [](AttributeFormat& attr, ComponentFormat type, int components,