From f26e1e5a12880035cf1487618a80ee4908a1d1bb Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 4 Jun 2022 23:27:13 +0200 Subject: [PATCH] Fix issue in case of recursive call of INIT_WITH with conditionnal INIT_WITH --- m-core.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/m-core.h b/m-core.h index a8eac078..7c263851 100644 --- a/m-core.h +++ b/m-core.h @@ -4010,13 +4010,14 @@ m_core_parse2_enum (const char str[], const char **endptr) or with the user provided init_func */ #define M_EMPLACE_CALL_FUNC(prefix, init_func, oplist, dest, emplace_type) \ M_IF(M_KEYWORD_P(INIT_WITH, init_func)) \ - ( \ + (M_EMPLACE_CALL_FUNC_INIT_WITH, M_EMPLACE_CALL_FUNC_USER_PROVIDED) \ + (prefix, init_func, oplist, dest, emplace_type) +#define M_EMPLACE_CALL_FUNC_INIT_WITH(prefix, init_func, oplist, dest, emplace_type) \ /* If INIT_FUNC==INIT_WITH, classic use of INIT_WITH operator */ \ - M_CALL_INIT_WITH(oplist, dest M_EMPLACE_LIST_VAR(prefix, emplace_type) ) \ - , \ + M_CALL_INIT_WITH(oplist, dest M_EMPLACE_LIST_VAR(prefix, emplace_type) ) +#define M_EMPLACE_CALL_FUNC_USER_PROVIDED(prefix, init_func, oplist, dest, emplace_type) \ /* Use the user provided init_func instead (with API transformation) */ \ - M_APPLY_API(init_func, oplist, dest M_EMPLACE_LIST_VAR(prefix, emplace_type) ) \ - ) + M_APPLY_API(init_func, oplist, dest M_EMPLACE_LIST_VAR(prefix, emplace_type) ) /* Generate one or several definitions for the EMPLACE methods using the operator EMPLACE_TYPE to get the suitable user types