mirror of
https://github.com/encounter/ogws-dtk.git
synced 2026-03-30 11:33:39 -07:00
48 lines
1.8 KiB
C
48 lines
1.8 KiB
C
/**
|
|
* Codewarrior tricks for matching decomp
|
|
* (Macros generate prototypes to satisfy -requireprotos)
|
|
*/
|
|
|
|
#ifndef DECOMP_H
|
|
#define DECOMP_H
|
|
|
|
#define __CONCAT(x, y) x##y
|
|
#define CONCAT(x, y) __CONCAT(x, y)
|
|
|
|
// Compile without matching hacks.
|
|
#ifdef __DECOMP_NON_MATCHING
|
|
#define DECOMP_FORCEACTIVE(module, ...)
|
|
#define DECOMP_FORCELITERAL(module, x)
|
|
#define DECOMP_FORCEACTIVE_DTOR(module, cls)
|
|
#define DECOMP_INLINE
|
|
#define DECOMP_DONT_INLINE
|
|
// Compile with matching hacks.
|
|
// (This version of CW does not support pragmas inside macros.)
|
|
#else
|
|
// Force reference specific data
|
|
#define DECOMP_FORCEACTIVE(module, ...) \
|
|
void fake_function(...); \
|
|
void CONCAT(FORCEACTIVE##module, __LINE__)(void); \
|
|
void CONCAT(FORCEACTIVE##module, __LINE__)(void) { \
|
|
fake_function(__VA_ARGS__); \
|
|
}
|
|
|
|
// Force literal ordering, such as floats in sdata2
|
|
#define DECOMP_FORCELITERAL(module, ...) \
|
|
void CONCAT(FORCELITERAL##module, __LINE__)(void); \
|
|
void CONCAT(FORCELITERAL##module, __LINE__)(void) { \
|
|
(__VA_ARGS__); \
|
|
}
|
|
|
|
// Force reference destructor
|
|
#define DECOMP_FORCEACTIVE_DTOR(module, cls) \
|
|
void CONCAT(FORCEDTOR##module##cls, __LINE__)(void) { \
|
|
cls dummy; \
|
|
dummy.~cls(); \
|
|
}
|
|
#define DECOMP_INLINE inline
|
|
#define DECOMP_DONT_INLINE __attribute__((never_inline))
|
|
#endif
|
|
|
|
#endif
|