Fix issue with INIT_WITH of array/list/....

combined with tuple:
_push_back_raw was used within an expanded macro
and as a consequence was expanded multiple times,
resulting in adding a new term in the sequence
for each field of the tuple.
This commit is contained in:
Patrick Pelissier committed 2021-07-04 00:01:00 +02:00
1 parent ca8d4aa97a
commit 7f79abec3f
2 files changed
+21 -2

No files matched your search

+7 -2
View File
@@ -3655,9 +3655,14 @@ m_core_parse2_enum (const char str[], const char **endptr)
#define M_INIT_WITH_VAI22_FUNC(pair, a) \
M_INIT_WITH_VAI23_FUNC(M_PAIR_1 pair, M_PAIR_2 pair, a)
/* We first push a raw new item, and then we get back its pointer using _back.
_back (contrary to _push_raw) has no side effect, and so is safe to be used
in a macro */
#define M_INIT_WITH_VAI23_FUNC(d, op, a) \
M_IF(M_PARENTHESIS_P( a ))(M_CALL_INIT_WITH, M_CALL_INIT_SET)(M_GET_OPLIST op, *M_C( M_GET_NAME op , _push_raw)(d), M_REMOVE_PARENTHESIS (a))
( \
(void) M_C(M_GET_NAME op, _push_raw)(d), \
M_IF(M_PARENTHESIS_P( a ))(M_CALL_INIT_WITH, M_CALL_INIT_SET)(M_GET_OPLIST op, *M_C( M_GET_NAME op , _back)(d), M_REMOVE_PARENTHESIS (a)) \
)
/* Initialize the container 'dest' as per 'oplist' INIT operator
and fill it with the given VA argument