From 307209981bb26d3472f5eea98b4174278a1ada0e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 28 Mar 2022 07:18:19 -0700 Subject: Simplify definition of variadic macros. --- cppawk-include/case-priv.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'cppawk-include/case-priv.h') diff --git a/cppawk-include/case-priv.h b/cppawk-include/case-priv.h index 863fd00..e0572ba 100644 --- a/cppawk-include/case-priv.h +++ b/cppawk-include/case-priv.h @@ -42,10 +42,8 @@ #define __case_temps __ign #define __case(expr) switch (expr) -#define __of(...) __xcat(__rep_, __narg(__VA_ARGS__))(__casx, \ - __VA_ARGS__) {{{ -#define __matching(...) __xcat(__rep_, __narg(__VA_ARGS__))(__casx, \ - __VA_ARGS__) {{{ +#define __of(...) __varexpand_simple(__casx, __VA_ARGS__) {{{ +#define __matching(...) __varexpand_simple(__casx, __VA_ARGS__) {{{ #define __cbreak break; }}} #define __cfall }}} #define __cret(val) return val; }}} @@ -63,10 +61,10 @@ #define __case(expr) for ((__once = 1) && (__pass = 0) || (__val = expr); \ __once; \ __once = 0) -#define __of(...) __clause(__xcat(__repi_, __narg(__VA_ARGS__)) \ - (__of_first, __of_next, __VA_ARGS__)) {{{ -#define __matching(...) __clause(__xcat(__repi_, __narg(__VA_ARGS__)) \ - (__mtch_first, __mtch_next, __VA_ARGS__)) {{{ +#define __of(...) __clause(__varexpand_infix(__of_first, __of_next, \ + __VA_ARGS__)) {{{ +#define __matching(...) __clause(__varexpand_infix(__mtch_first, mtch_next, \ + __VA_ARGS__)) {{{ #define __cbreak break; }}} #define __creturn(val) return val; }}} #define __cfall }}} -- cgit v1.2.3