mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-09-15 06:46:16 -05:00
Suppress memcpy writing to an object with no trivial copy-assignment warnings
We need to copy padding in most of these cases, and the objects are trivially copyable; however, BitField prevents trivial copy-assignment.
This commit is contained in:
@@ -101,7 +101,14 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile* file,
|
||||
part_start = offset;
|
||||
// Copy cpmem now, because end_of_primitives isn't triggered until the first opcode after
|
||||
// primitive data, and the first opcode might update cpmem
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#endif
|
||||
std::memcpy(&cpmem, &analyzer.m_cpmem, sizeof(CPState));
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
if (analyzer.m_end_of_primitives)
|
||||
{
|
||||
|
||||
@@ -150,7 +150,14 @@ void Init()
|
||||
{
|
||||
auto& state = Core::System::GetInstance().GetMemoryInterfaceState().GetData();
|
||||
static_assert(std::is_trivially_copyable_v<MIMemStruct>);
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#endif
|
||||
std::memset(&state.mi_mem, 0, sizeof(MIMemStruct));
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
|
||||
@@ -136,7 +136,14 @@ static bool DeserializeExtensionState(DesiredWiimoteState* state,
|
||||
return false;
|
||||
auto& e = state->extension.data.emplace<T>();
|
||||
static_assert(std::is_trivially_copyable_v<T>);
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#endif
|
||||
std::memcpy(&e, &serialized.data[offset], sizeof(T));
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user