mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-28 04:00:05 +00:00
hle: ipc_helpers: Ignore -Wclass-memaccess
This warning is triggered by GCC when copying into non-trivially default constructible types, as it uses the more restrictive std::is_trivial (which includes std::is_trivially_default_constructible) to determine whether memcpy is safe instead of std::is_trivially_copyable.
This commit is contained in:
parent
ee0547e4c4
commit
f0340b8d22
@ -404,6 +404,11 @@ inline s32 RequestParser::Pop() {
|
|||||||
return static_cast<s32>(Pop<u32>());
|
return static_cast<s32>(Pop<u32>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ignore the -Wclass-memaccess warning on memcpy for non-trivially default constructible objects.
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||||
|
#endif
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void RequestParser::PopRaw(T& value) {
|
void RequestParser::PopRaw(T& value) {
|
||||||
static_assert(std::is_trivially_copyable_v<T>,
|
static_assert(std::is_trivially_copyable_v<T>,
|
||||||
@ -411,6 +416,9 @@ void RequestParser::PopRaw(T& value) {
|
|||||||
std::memcpy(&value, cmdbuf + index, sizeof(T));
|
std::memcpy(&value, cmdbuf + index, sizeof(T));
|
||||||
index += (sizeof(T) + 3) / 4; // round up to word length
|
index += (sizeof(T) + 3) / 4; // round up to word length
|
||||||
}
|
}
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T RequestParser::PopRaw() {
|
T RequestParser::PopRaw() {
|
||||||
|
Loading…
Reference in New Issue
Block a user