diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-08-26 14:22:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-26 14:22:04 +0200 |
| commit | dec299005363dcad47a58c73f05daadf5591c36b (patch) | |
| tree | 09179c716ae3ca80cef5c180005774e3885eb3fe /Source/Core | |
| parent | e876045e5653cc768160e32ec9bf2a41629bcda6 (diff) | |
| parent | 58ab94c30c4283e3e4e9179a5b565208143b76fb (diff) | |
Merge pull request #12128 from Dentomologist/gcc_suppress_ppcstate_off_warning_spam
GCC: Suppress PPCSTATE_OFF invalid-offsetof warnings
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Jit64Common/Jit64PowerPCState.h | 15 | ||||
| -rw-r--r-- | Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h | 13 |
2 files changed, 28 insertions, 0 deletions
diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64PowerPCState.h b/Source/Core/Core/PowerPC/Jit64Common/Jit64PowerPCState.h index f534c853c8..692129e0ab 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/Jit64PowerPCState.h +++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64PowerPCState.h @@ -11,11 +11,26 @@ // We offset by 0x80 because the range of one byte memory offsets is // -0x80..0x7f. +#ifdef __GNUC__ +#define PPCSTATE_OFF(i) \ + ([]() consteval { \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") return static_cast<int>( \ + offsetof(PowerPC::PowerPCState, i)) - \ + 0x80; \ + _Pragma("GCC diagnostic pop") \ + }()) + +#define PPCSTATE_OFF_ARRAY(elem, i) \ + (PPCSTATE_OFF(elem[0]) + static_cast<int>(sizeof(PowerPC::PowerPCState::elem[0]) * (i))) +#else #define PPCSTATE_OFF(i) (static_cast<int>(offsetof(PowerPC::PowerPCState, i)) - 0x80) + #define PPCSTATE_OFF_ARRAY(elem, i) \ (static_cast<int>(offsetof(PowerPC::PowerPCState, elem[0]) + \ sizeof(PowerPC::PowerPCState::elem[0]) * (i)) - \ 0x80) +#endif #define PPCSTATE_OFF_GPR(i) PPCSTATE_OFF_ARRAY(gpr, i) #define PPCSTATE_OFF_CR(i) PPCSTATE_OFF_ARRAY(cr.fields, i) diff --git a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h index a8e63eb006..01339184ea 100644 --- a/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h +++ b/Source/Core/Core/PowerPC/JitArm64/JitArm64_RegCache.h @@ -25,10 +25,23 @@ constexpr Arm64Gen::ARM64Reg PPC_REG = Arm64Gen::ARM64Reg::X29; // PC register when calling the dispatcher constexpr Arm64Gen::ARM64Reg DISPATCHER_PC = Arm64Gen::ARM64Reg::W26; +#ifdef __GNUC__ +#define PPCSTATE_OFF(elem) \ + ([]() consteval { \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"") return offsetof( \ + PowerPC::PowerPCState, elem); \ + _Pragma("GCC diagnostic pop") \ + }()) + +#define PPCSTATE_OFF_ARRAY(elem, i) \ + (PPCSTATE_OFF(elem[0]) + sizeof(PowerPC::PowerPCState::elem[0]) * (i)) +#else #define PPCSTATE_OFF(elem) (offsetof(PowerPC::PowerPCState, elem)) #define PPCSTATE_OFF_ARRAY(elem, i) \ (offsetof(PowerPC::PowerPCState, elem[0]) + sizeof(PowerPC::PowerPCState::elem[0]) * (i)) +#endif #define PPCSTATE_OFF_GPR(i) PPCSTATE_OFF_ARRAY(gpr, i) #define PPCSTATE_OFF_CR(i) PPCSTATE_OFF_ARRAY(cr.fields, i) |
