shithub: orca

Download patch

ref: 964846339260693996ac189db0c7f141d30c1b03
parent: cf8b94c188df502e3a58e4177eaa10cc9aa49341
author: cancel <cancel@cancel.fm>
date: Wed Nov 28 13:51:36 EST 2018

Clean up redundant argument decls in macros

--- a/sim.c
+++ b/sim.c
@@ -125,6 +125,15 @@
 #define ORCA_DECLARE_OPERATORS(_solo_defs, _dual_defs)                         \
   ORCA_DEFINE_OPER_CHARS(_solo_defs, _dual_defs)
 
+#define OPER_PHASE_COMMON_ARGS                                                 \
+  Gbuffer const gbuffer, Mbuffer const mbuffer, Usz const height,              \
+      Usz const width, Usz const y, Usz const x
+#define OPER_PHASE_0_COMMON_ARGS                                               \
+  OPER_PHASE_COMMON_ARGS, Oper_bank_write_params *const bank_params,           \
+      U8 const cell_flags
+#define OPER_PHASE_1_COMMON_ARGS                                               \
+  OPER_PHASE_COMMON_ARGS, Oper_bank_read_params* const bank_params
+
 #define OPER_IGNORE_COMMON_ARGS()                                              \
   (void)gbuffer;                                                               \
   (void)mbuffer;                                                               \
@@ -135,26 +144,17 @@
   (void)bank_params;
 
 #define BEGIN_SOLO_PHASE_0(_oper_name)                                         \
-  static inline void oper_phase0_##_oper_name(                                 \
-      Gbuffer const gbuffer, Mbuffer const mbuffer, Usz const height,          \
-      Usz const width, Usz const y, Usz const x,                               \
-      Oper_bank_write_params* bank_params, U8 const cell_flags) {              \
+  static inline void oper_phase0_##_oper_name(OPER_PHASE_0_COMMON_ARGS) {      \
     OPER_IGNORE_COMMON_ARGS()                                                  \
     (void)cell_flags;                                                          \
     enum { This_oper_char = Orca_oper_char_##_oper_name };
 #define BEGIN_SOLO_PHASE_1(_oper_name)                                         \
-  static inline void oper_phase1_##_oper_name(                                 \
-      Gbuffer const gbuffer, Mbuffer const mbuffer, Usz const height,          \
-      Usz const width, Usz const y, Usz const x,                               \
-      Oper_bank_read_params* bank_params) {                                    \
+  static inline void oper_phase1_##_oper_name(OPER_PHASE_1_COMMON_ARGS) {      \
     OPER_IGNORE_COMMON_ARGS()                                                  \
     enum { This_oper_char = Orca_oper_char_##_oper_name };
 #define BEGIN_DUAL_PHASE_0(_oper_name)                                         \
-  static inline void oper_phase0_##_oper_name(                                 \
-      Gbuffer const gbuffer, Mbuffer const mbuffer, Usz const height,          \
-      Usz const width, Usz const y, Usz const x,                               \
-      Oper_bank_write_params* bank_params, U8 const cell_flags,                \
-      Glyph const This_oper_char) {                                            \
+  static inline void oper_phase0_##_oper_name(OPER_PHASE_0_COMMON_ARGS,        \
+                                              Glyph const This_oper_char) {    \
     OPER_IGNORE_COMMON_ARGS()                                                  \
     (void)cell_flags;                                                          \
     bool const Dual_is_uppercase =                                             \
@@ -161,10 +161,8 @@
         Orca_oper_upper_char_##_oper_name == This_oper_char;                   \
     (void)Dual_is_uppercase;
 #define BEGIN_DUAL_PHASE_1(_oper_name)                                         \
-  static inline void oper_phase1_##_oper_name(                                 \
-      Gbuffer const gbuffer, Mbuffer const mbuffer, Usz const height,          \
-      Usz const width, Usz const y, Usz const x,                               \
-      Oper_bank_read_params* bank_params, Glyph const This_oper_char) {        \
+  static inline void oper_phase1_##_oper_name(OPER_PHASE_1_COMMON_ARGS,        \
+                                              Glyph const This_oper_char) {    \
     OPER_IGNORE_COMMON_ARGS()                                                  \
     bool const Dual_is_uppercase =                                             \
         Orca_oper_upper_char_##_oper_name == This_oper_char;                   \