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:
Léo Lam
2020-12-16 15:01:20 +01:00
parent 5a5c22dc6c
commit eafe005672
5 changed files with 8 additions and 8 deletions

View File

@ -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