Make M*LIB stricter for INIT_MOVE operator:

* either the default INIT_MOVE operator works ('=')
* either an INIT_MOVE method is defined
* or it is disabled.
As a consequence, fix usage of testobj_t and mpz_t in the repository

The emulation layer of INIT_MOVE using INIT_SET+CLEAR is removed:
it wasn't working correctly with the local memory context
(INIT_MOVE doesn't need any local memory context to work,
 whereas INIT_SET/CLEAR does)
Remove macro M_DO_INIT_MOVE as it is now useless and uses M_CALL_INIT_MOVE.

The INIT_MOVE default method no longer sets the old 'src' to '0':
it was useless (it doesn't catch any error) and complicates compiler parsing.

Fix POD & A1 & CSTR & classic oplists definition (missing INIT_MOVE operators).
This commit is contained in:
Patrick Pelissier committed 2025-05-07 21:02:24 +02:00
1 parent 3a39ce5a4a
commit d548117538
19 files changed
+126 -157

No files matched your search

+5 -5
View File
@@ -476,7 +476,7 @@ typedef int32_t m_tr33_index_t;
\
M_P(it_t, name, _move_up, it_t pos, type *data) { \
it_t it = M_F(name, _insert_up_raw)M_R(pos); \
M_DO_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_CALL_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_TR33_IT_CONTRACT(it, true); \
return it; \
} \
@@ -510,7 +510,7 @@ typedef int32_t m_tr33_index_t;
\
M_P(it_t, name, _move_down, it_t pos, type *data) { \
it_t it = M_F(name, _insert_down_raw)M_R(pos); \
M_DO_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_CALL_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_TR33_IT_CONTRACT(it, true); \
return it; \
} \
@@ -544,7 +544,7 @@ typedef int32_t m_tr33_index_t;
\
M_P(it_t, name, _move_child, it_t pos, type *data) { \
it_t it = M_F(name, _insert_child_raw)M_R(pos); \
M_DO_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_CALL_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_TR33_IT_CONTRACT(it, true); \
return it; \
} \
@@ -581,7 +581,7 @@ typedef int32_t m_tr33_index_t;
\
M_P(it_t, name, _move_left, it_t pos, type *data) { \
it_t it = M_F(name, _insert_left_raw)M_R(pos); \
M_DO_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_CALL_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_TR33_IT_CONTRACT(it, true); \
return it; \
} \
@@ -612,7 +612,7 @@ typedef int32_t m_tr33_index_t;
\
M_P(it_t, name, _move_right, it_t pos, type *data) { \
it_t it = M_F(name, _insert_right_raw)M_R(pos); \
M_DO_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_CALL_INIT_MOVE(oplist, it.tree->tab[it.index].data, *data); \
M_TR33_IT_CONTRACT(it, true); \
return it; \
} \