From fafaaafdbf44cea61ef54800898ce58efdd2d498 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Thu, 22 Dec 2022 14:05:46 +0100 Subject: [PATCH] Avoid warning for M_RET_ARG if there is the exact number of argument. Add internal M_TRIPLE_* macros (TBC) --- m-core.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/m-core.h b/m-core.h index 604f2ced..3962f8ba 100644 --- a/m-core.h +++ b/m-core.h @@ -809,7 +809,7 @@ M_BEGIN_PROTECTED_CODE Generated by: for i in $(seq 1 53 ) ; do printf "#define M_RETI_ARG%d(" $i; for j in $(seq 1 $i) ; do printf "_%d, " $j ; done ; printf "...) _%d\n#define M_RET_ARG%d(...) M_RETI_ARG%d(__VA_ARGS__,)\n\n" $i $i $i ; done */ -#define M_RET_ARG(n, ...) M_C(M_RET_ARG, n)(__VA_ARGS__) +#define M_RET_ARG(n, ...) M_C(M_RET_ARG, n)(__VA_ARGS__, ) #define M_RETI_ARG1(_1, ...) _1 #define M_RET_ARG1(...) M_RETI_ARG1(__VA_ARGS__,) @@ -1053,6 +1053,10 @@ M_BEGIN_PROTECTED_CODE #define M_PAIR_1(a,b) a #define M_PAIR_2(a,b) b +/* Same for triple */ +#define M_TRIPLE_1(a,b,c) a +#define M_TRIPLE_2(a,b,c) b +#define M_TRIPLE_3(a,b,c) c /* Skip the Nth first arguments of a VA_ARGS Generated by: