From cfacf87e6a66325b258ca1f9c0c74cf1cfdec83a Mon Sep 17 00:00:00 2001 From: cancel Date: Sat, 1 Dec 2018 14:40:29 +0900 Subject: [PATCH] Add ORCA_OPT_MINSIZE macro --- base.h | 11 +++++++++++ sim.c | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/base.h b/base.h index 2a862b1..c9ebd9c 100644 --- a/base.h +++ b/base.h @@ -8,6 +8,17 @@ #include #include +// clang or gcc or msvc or other +#if defined(__clang__) +#define ORCA_OPT_MINSIZE __attribute__((minsize)) +#elif defined(__GNUC__) +#define ORCA_OPT_MINSIZE __attribute__(("Os")) +#elif defined(_MSC_VER) +#define ORCA_OPT_MINSIZE +#else +#define ORCA_OPT_MINSIZE +#endif + // (gcc / clang) or msvc or other #if defined(__GNUC__) || defined(__clang__) #define ORCA_FORCE_INLINE __attribute__((always_inline)) inline diff --git a/sim.c b/sim.c index 846320c..5645a25 100644 --- a/sim.c +++ b/sim.c @@ -186,7 +186,7 @@ Usz usz_clamp(Usz val, Usz min, Usz max) { (void)Tick_number; \ (void)bank_params; -#define OPER_PHASE_SPEC static ORCA_FORCE_NO_INLINE +#define OPER_PHASE_SPEC ORCA_FORCE_NO_INLINE static #define BEGIN_SOLO_PHASE_0(_oper_name) \ OPER_PHASE_SPEC void oper_phase0_##_oper_name(OPER_PHASE_0_COMMON_ARGS) { \