mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Fix -Wclass-memaccess warnings
We want to clear/memset the padding bytes, not just each member, so using assignment or {} initialization is not an option. To silence the warnings, cast the object pointer to u8* (which is not undefined behavior) to make it explicit to the compiler that we want to fill the object representation.
This commit is contained in:
@ -43,7 +43,7 @@ static const float s_gammaLUT[] = {1.0f, 1.7f, 2.2f, 1.0f};
|
||||
|
||||
void BPInit()
|
||||
{
|
||||
memset(&bpmem, 0, sizeof(bpmem));
|
||||
memset(reinterpret_cast<u8*>(&bpmem), 0, sizeof(bpmem));
|
||||
bpmem.bpMask = 0xFFFFFF;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ template <typename SerializedUidType, typename UidType>
|
||||
static void SerializePipelineUid(const UidType& uid, SerializedUidType& serialized_uid)
|
||||
{
|
||||
// Convert to disk format. Ensure all padding bytes are zero.
|
||||
std::memset(&serialized_uid, 0, sizeof(serialized_uid));
|
||||
std::memset(reinterpret_cast<u8*>(&serialized_uid), 0, sizeof(serialized_uid));
|
||||
serialized_uid.vertex_decl = uid.vertex_format->GetVertexDeclaration();
|
||||
serialized_uid.vs_uid = uid.vs_uid;
|
||||
serialized_uid.gs_uid = uid.gs_uid;
|
||||
|
@ -295,8 +295,8 @@ void VideoBackendBase::DoState(PointerWrap& p)
|
||||
|
||||
void VideoBackendBase::InitializeShared()
|
||||
{
|
||||
memset(&g_main_cp_state, 0, sizeof(g_main_cp_state));
|
||||
memset(&g_preprocess_cp_state, 0, sizeof(g_preprocess_cp_state));
|
||||
memset(reinterpret_cast<u8*>(&g_main_cp_state), 0, sizeof(g_main_cp_state));
|
||||
memset(reinterpret_cast<u8*>(&g_preprocess_cp_state), 0, sizeof(g_preprocess_cp_state));
|
||||
memset(texMem, 0, TMEM_SIZE);
|
||||
|
||||
// do not initialize again for the config window
|
||||
|
Reference in New Issue
Block a user