Add support for INIT_WITH in M_LET in C99 mode.
This commit is contained in:
1 parent
d95a11365a
commit
b894d64063
2 files changed
+11
-4
No files matched your search
@@ -2143,10 +2143,11 @@ m_core_hash (const void *str, size_t length)
|
||||
// 5b. Define with arguments ==> use INIT_SET (INIT_WITH support pending)
|
||||
#define M_LETI_SINGLE2_SET(cont, oplist, name, ...) \
|
||||
for(M_GET_TYPE oplist name; \
|
||||
cont && (M_GET_INIT_SET oplist (name, __VA_ARGS__), true); \
|
||||
cont && (M_LETI_SINGLE2_INIT(oplist, name, __VA_ARGS__), true); \
|
||||
(M_GET_CLEAR oplist (name), cont = false)) \
|
||||
for(;cont;cont = false)
|
||||
|
||||
#define M_LETI_SINGLE2_INIT(oplist, name, ...) \
|
||||
M_IF_METHOD(INIT_WITH,oplist)(M_GET_INIT_WITH oplist (name, __VA_ARGS__), M_GET_INIT_SET oplist (name, __VA_ARGS__))
|
||||
|
||||
/* Transform the va list by adding their number as the first argument of
|
||||
the list.
|
||||
|
||||
+8
-2
@@ -171,14 +171,20 @@ static void test_map(void)
|
||||
|
||||
static void test_let(void)
|
||||
{
|
||||
bool b = false;
|
||||
M_LET(z, M_CLASSIC_OPLIST(testobj)) {
|
||||
testobj_add(z,z,z);
|
||||
testobj_set_ui(z, 12);
|
||||
M_LET((zz,z), M_CLASSIC_OPLIST(testobj)) {
|
||||
testobj_add(zz,zz,z);
|
||||
assert( testobj_cmp_ui(zz, 12) == 0);
|
||||
}
|
||||
M_LET((zz,42), M_OPEXTEND(M_CLASSIC_OPLIST(testobj), INIT_WITH(testobj_init_set_ui))) {
|
||||
assert( testobj_cmp_ui(zz, 42) == 0);
|
||||
}
|
||||
b = true;
|
||||
break;
|
||||
assert(0);
|
||||
}
|
||||
assert(b);
|
||||
}
|
||||
|
||||
static void test_va(void)
|
||||
|
||||
Reference in new issue
Block a user