Merge pull request #12128 from Dentomologist/gcc_suppress_ppcstate_off_warning_spam
GCC: Suppress PPCSTATE_OFF invalid-offsetof warnings
This commit is contained in:
commit
dec2990053
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue