Misc: Better GCC defs

Less warnings about fastcall being unsupported, proper __assume implementation
This commit is contained in:
TellowKrinkle 2021-08-29 16:00:55 -05:00 committed by tellowkrinkle
parent 8ab884a89e
commit e37fbfddc3
2 changed files with 8 additions and 4 deletions

View File

@ -155,8 +155,8 @@ extern pxDoAssertFnType* pxDoAssert;
#define pxAssertMsg(cond, msg) (likely(cond)) #define pxAssertMsg(cond, msg) (likely(cond))
#define pxAssertDev(cond, msg) (likely(cond)) #define pxAssertDev(cond, msg) (likely(cond))
#define pxAssumeMsg(cond, msg) (__assume(cond)) #define pxAssumeMsg(cond, msg) __assume(cond)
#define pxAssumeDev(cond, msg) (__assume(cond)) #define pxAssumeDev(cond, msg) __assume(cond)
#define pxFail(msg) \ #define pxFail(msg) \
do \ do \

View File

@ -146,7 +146,7 @@ static const int __pagesize = PCSX2_PAGESIZE;
#define __aligned32 __attribute__((aligned(32))) #define __aligned32 __attribute__((aligned(32)))
#define __pagealigned __attribute__((aligned(PCSX2_PAGESIZE))) #define __pagealigned __attribute__((aligned(PCSX2_PAGESIZE)))
#define __assume(cond) ((void)0) // GCC has no equivalent for __assume #define __assume(cond) do { if (!(cond)) __builtin_unreachable(); } while(0)
#define CALLBACK __attribute__((stdcall)) #define CALLBACK __attribute__((stdcall))
// Inlining note: GCC needs ((unused)) attributes defined on inlined functions to suppress // Inlining note: GCC needs ((unused)) attributes defined on inlined functions to suppress
@ -154,8 +154,12 @@ static const int __pagesize = PCSX2_PAGESIZE;
// happens *by design* like all the friggen time >_<) // happens *by design* like all the friggen time >_<)
#ifndef __fastcall #ifndef __fastcall
#ifndef _M_X86_32
#define __fastcall // Attribute not available, and x86_32 is pretty much the only cc that passes literally everything in registers
#else
#define __fastcall __attribute__((fastcall)) #define __fastcall __attribute__((fastcall))
#endif #endif
#endif
#define __vectorcall __fastcall #define __vectorcall __fastcall
#define _inline __inline__ __attribute__((unused)) #define _inline __inline__ __attribute__((unused))
#ifdef NDEBUG #ifdef NDEBUG