diff --git a/bank.h b/bank.h index 74c9ffe..3e80c8c 100644 --- a/bank.h +++ b/bank.h @@ -62,7 +62,7 @@ typedef struct { void oevent_list_init(Oevent_list *olist); void oevent_list_deinit(Oevent_list *olist); void oevent_list_clear(Oevent_list *olist); -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE void oevent_list_copy(Oevent_list const *src, Oevent_list *dest); -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE Oevent *oevent_list_alloc_item(Oevent_list *olist); diff --git a/base.h b/base.h index 525eef9..dcc6826 100644 --- a/base.h +++ b/base.h @@ -18,17 +18,14 @@ // (gcc / clang) or msvc or other #if defined(__GNUC__) || defined(__clang__) -#define ORCA_FORCE_INLINE __attribute__((always_inline)) inline -#define ORCA_FORCE_STATIC_INLINE __attribute__((always_inline)) static inline -#define ORCA_FORCE_NO_INLINE __attribute__((noinline)) +#define ORCA_FORCEINLINE __attribute__((always_inline)) inline +#define ORCA_NOINLINE __attribute__((noinline)) #elif defined(_MSC_VER) -#define ORCA_FORCE_INLINE __forceinline -#define ORCA_FORCE_STATIC_INLINE __forceinline static -#define ORCA_FORCE_NO_INLINE __declspec(noinline) +#define ORCA_FORCEINLINE __forceinline +#define ORCA_NOINLINE __declspec(noinline) #else -#define ORCA_FORCE_INLINE inline -#define ORCA_FORCE_STATIC_INLINE inline static -#define ORCA_FORCE_NO_INLINE +#define ORCA_FORCEINLINE inline +#define ORCA_NOINLINE #endif // (gcc / clang) or other @@ -79,7 +76,7 @@ typedef ssize_t Isz; typedef char Glyph; typedef U8 Mark; -ORCA_FORCE_STATIC_INLINE Usz orca_round_up_power2(Usz x) { +ORCA_FORCEINLINE static Usz orca_round_up_power2(Usz x) { assert(x <= SIZE_MAX / 2 + 1); x -= 1; x |= (x >> 1); diff --git a/gbuffer.h b/gbuffer.h index b4b062f..addd7b9 100644 --- a/gbuffer.h +++ b/gbuffer.h @@ -35,13 +35,13 @@ static inline void gbuffer_poke_relative(Glyph *gbuf, Usz height, Usz width, gbuf[(Usz)y0 * width + (Usz)x0] = g; } -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE void gbuffer_copy_subrect(Glyph *src, Glyph *dest, Usz src_grid_h, Usz src_grid_w, Usz dest_grid_h, Usz dest_grid_w, Usz src_y, Usz src_x, Usz dest_y, Usz dest_x, Usz height, Usz width); -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE void gbuffer_fill_subrect(Glyph *gbuf, Usz grid_h, Usz grid_w, Usz y, Usz x, Usz height, Usz width, Glyph fill_char); diff --git a/sim.c b/sim.c index 6043249..114ce43 100644 --- a/sim.c +++ b/sim.c @@ -126,7 +126,7 @@ static void oper_poke_and_stun(Glyph *restrict gbuffer, Mark *restrict mbuffer, mbuffer[offs] |= Mark_flag_sleep; } -#define OPER_FUNCTION_ATTRIBS ORCA_FORCE_NO_INLINE static void +#define OPER_FUNCTION_ATTRIBS ORCA_NOINLINE static void #define BEGIN_OPERATOR(_oper_name) \ OPER_FUNCTION_ATTRIBS oper_behavior_##_oper_name( \ diff --git a/sysmisc.c b/sysmisc.c index 69d7dc0..512bfa0 100644 --- a/sysmisc.c +++ b/sysmisc.c @@ -5,7 +5,7 @@ #include #include -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE Cboard_error cboard_copy(Glyph const *gbuffer, Usz field_height, Usz field_width, Usz rect_y, Usz rect_x, Usz rect_h, Usz rect_w) { @@ -28,7 +28,7 @@ Cboard_error cboard_copy(Glyph const *gbuffer, Usz field_height, return status ? Cboard_error_process_exit_error : Cboard_error_none; } -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE Cboard_error cboard_paste(Glyph *gbuffer, Usz height, Usz width, Usz y, Usz x, Usz *out_h, Usz *out_w) { FILE *fp = @@ -69,7 +69,7 @@ Cboard_error cboard_paste(Glyph *gbuffer, Usz height, Usz width, Usz y, Usz x, return status ? Cboard_error_process_exit_error : Cboard_error_none; } -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE Conf_read_result conf_read_line(FILE *file, char *buf, Usz bufsize, char **out_left, Usz *out_leftsize, char **out_right, Usz *out_rightsize) { diff --git a/term_util.c b/term_util.c index 42294ab..514a396 100644 --- a/term_util.c +++ b/term_util.c @@ -69,8 +69,7 @@ void qnav_deinit() { while (qnav_stack.count != 0) qnav_stack_pop(); } -static ORCA_FORCE_NO_INLINE void qnav_stack_push(Qblock *qb, int height, - int width) { +static ORCA_NOINLINE void qnav_stack_push(Qblock *qb, int height, int width) { #ifndef NDEBUG for (Usz i = 0; i < qnav_stack.count; ++i) { assert(qnav_stack.blocks[i] != qb); @@ -313,7 +312,7 @@ Qmenu *qmenu_create(int id) { } void qmenu_destroy(Qmenu *qm) { qmenu_free(qm); } int qmenu_id(Qmenu const *qm) { return qm->id; } -static ORCA_FORCE_NO_INLINE void +static ORCA_NOINLINE void qmenu_allocitems(Qmenu *qm, Usz count, Usz *out_idx, ITEM ***out_items, struct Qmenu_item_extra **out_extras) { Usz old_count = qm->items_count; @@ -349,16 +348,15 @@ qmenu_allocitems(Qmenu *qm, Usz count, Usz *out_idx, ITEM ***out_items, *out_extras = (struct Qmenu_item_extra *)((char *)items + extras_offset) + old_count; } -ORCA_FORCE_STATIC_INLINE struct Qmenu_item_extra * +ORCA_FORCEINLINE static struct Qmenu_item_extra * qmenu_item_extras_ptr(Qmenu *qm) { Usz offset = sizeof(ITEM *) * qm->items_cap; return (struct Qmenu_item_extra *)((char *)qm->ncurses_items + offset); } // Get the curses menu item user pointer out, turn it to an int, and use it as // an index into the 'extras' arrays. -ORCA_FORCE_STATIC_INLINE -struct Qmenu_item_extra *qmenu_itemextra(struct Qmenu_item_extra *extras, - ITEM *item) { +ORCA_FORCEINLINE static struct Qmenu_item_extra * +qmenu_itemextra(struct Qmenu_item_extra *extras, ITEM *item) { return extras + (int)(intptr_t)(item_userptr(item)); } void qmenu_set_title(Qmenu *qm, char const *title) { @@ -520,7 +518,7 @@ void qmenu_free(Qmenu *qm) { free(qm); } -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE static void qmenu_drive_upordown(Qmenu *qm, int req_up_or_down) { struct Qmenu_item_extra *extras = qmenu_item_extras_ptr(qm); ITEM *starting = current_item(qm->ncurses_menu); diff --git a/term_util.h b/term_util.h index 9e0735d..a8e7f1a 100644 --- a/term_util.h +++ b/term_util.h @@ -43,8 +43,8 @@ typedef enum { A_reverse = A_REVERSE, } Term_attr; -static ORCA_FORCE_INLINE ORCA_OK_IF_UNUSED attr_t fg_bg(Color_name fg, - Color_name bg) { +static ORCA_FORCEINLINE ORCA_OK_IF_UNUSED attr_t fg_bg(Color_name fg, + Color_name bg) { return COLOR_PAIR(1 + fg * Colors_count + bg); } diff --git a/tui_main.c b/tui_main.c index b364dd7..747ace2 100644 --- a/tui_main.c +++ b/tui_main.c @@ -958,7 +958,7 @@ void ged_set_midi_mode(Ged *a, Midi_mode const *midi_mode) { a->midi_mode = midi_mode; } -static ORCA_FORCE_NO_INLINE void // +static ORCA_NOINLINE void // send_midi_chan_msg(Oosc_dev *oosc_dev, Midi_mode const *midi_mode, int type /*0..15*/, int chan /*0.. 15*/, int byte1 /*0..127*/, int byte2 /*0..127*/) { @@ -996,7 +996,7 @@ send_midi_chan_msg(Oosc_dev *oosc_dev, Midi_mode const *midi_mode, } } -static ORCA_FORCE_NO_INLINE void // +static ORCA_NOINLINE void // send_midi_note_offs(Oosc_dev *oosc_dev, Midi_mode const *midi_mode, Susnote const *start, Susnote const *end) { for (; start != end; ++start) { @@ -2512,7 +2512,7 @@ enum { char const *const prefval_plain = "plain"; char const *const prefval_fancy = "fancy"; -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE bool plainorfancy(char const *val, bool *out) { if (strcmp(val, prefval_plain) == 0) { *out = false; @@ -2525,7 +2525,7 @@ bool plainorfancy(char const *val, bool *out) { return false; } -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE bool conf_read_boolish(char const *val, bool *out) { static char const *const trues[] = {"1", "true", "yes"}; static char const *const falses[] = {"0", "false", "no"}; @@ -2544,7 +2544,7 @@ bool conf_read_boolish(char const *val, bool *out) { return false; } -ORCA_FORCE_NO_INLINE +ORCA_NOINLINE Prefs_load_error prefs_load_from_conf_file(Prefs *p) { Ezconf_r ez; for (ezconf_r_start(&ez); ezconf_r_step(&ez, confopts, Confoptslen);) {