diff --git a/example/ex11-use-pool.c b/example/ex11-use-pool.c index 3fa52735..6611ad55 100644 --- a/example/ex11-use-pool.c +++ b/example/ex11-use-pool.c @@ -35,7 +35,7 @@ static void my_free(void *ptr, size_t old, size_t base, context_t context) #include "m-bitset.h" #include "m-bstring.h" #include "m-genint.h" - +#include "m-algo.h" context_t my_pool = NULL; extern int f(string_t, bitset_t b, bstring_t y); @@ -59,7 +59,9 @@ int f(string_t x, bitset_t b, bstring_t y) #include "m-array.h" ARRAY_DEF(array, int) +ALGO_DEF(array, ARRAY_OPLIST(array, M_BASIC_OPLIST)) ARRAY_DEF(array_str, string_t) +ALGO_DEF(array_str, ARRAY_OPLIST(array_str, STRING_OPLIST)) #include "m-prioqueue.h" diff --git a/m-algo.h b/m-algo.h index a4b865e0..d1890de1 100644 --- a/m-algo.h +++ b/m-algo.h @@ -434,7 +434,7 @@ /* Compute the union of two ***sorted*** containers */ \ M_IF_METHOD(IT_INSERT, cont_oplist)( \ M_INLINE void \ - M_C3(name,sort_name,_union)(container_t dst, const container_t src cmp_param(name)) \ + M_C3(name,sort_name,_union)(M_P_EXPAND container_t dst, const container_t src cmp_param(name)) \ { \ it_t itSrc; \ it_t itDst; \ @@ -479,7 +479,7 @@ /* Compute the intersection of two ***sorted*** containers */ \ M_IF_METHOD(IT_REMOVE, cont_oplist)( \ M_INLINE void \ - M_C3(name,sort_name,_intersect)(container_t dst, const container_t src cmp_param(name)) \ + M_C3(name,sort_name,_intersect)(M_P_EXPAND container_t dst, const container_t src cmp_param(name)) \ { \ it_t itSrc; \ it_t itDst; \ @@ -688,9 +688,9 @@ #define M_ALG0_DEF_FILL(name, container_t, cont_oplist, type_t, type_oplist, it_t) \ \ /* Fill all the container with value (overwritten) */ \ - M_INLINE void \ - M_F(name, _fill) (container_t l, type_t const value) \ + M_P(void, name, _fill, container_t l, type_t const value) \ { \ + M_UNUSED_CONTEXT(); \ for M_EACH(item, l, cont_oplist) { \ M_CALL_SET(type_oplist, *item, value); \ } \ @@ -698,8 +698,7 @@ \ /* Fill the container with exactly 'n' occurrence of 'value' */ \ M_IF_METHOD(PUSH, cont_oplist)( \ - M_INLINE void \ - M_F(name, _fill_n) (container_t l, size_t n, type_t const value) \ + M_P(void, name, _fill_n, container_t l, size_t n, type_t const value) \ { \ M_CALL_RESET(cont_oplist, l); \ for(size_t i = 0; i < n; i++) { \ @@ -710,9 +709,9 @@ \ /* Fill the container with FOR('value'; 'value'+'inc') */ \ M_IF_METHOD(ADD, type_oplist)( \ - M_INLINE void \ - M_F(name, _fill_a) (container_t l, type_t const value, type_t const inc) \ + M_P(void, name, _fill_a, container_t l, type_t const value, type_t const inc) \ { \ + M_UNUSED_CONTEXT(); \ type_t tmp; \ M_CALL_INIT_SET(type_oplist, tmp, value); \ for M_EACH(item, l, cont_oplist) { \ @@ -724,9 +723,9 @@ \ /* Fill the container with n occurences of FOR('value'; 'value'+'inc') */ \ M_IF_METHOD(PUSH, cont_oplist)( \ - M_INLINE void \ - M_F(name, _fill_an) (container_t l, size_t n, type_t const value, type_t const inc) \ + M_P(void, name, _fill_an, container_t l, size_t n, type_t const value, type_t const inc) \ { \ + M_UNUSED_CONTEXT(); \ type_t tmp; \ M_CALL_INIT_SET(type_oplist, tmp, value); \ M_CALL_RESET(cont_oplist, l); \ @@ -756,10 +755,7 @@ M_IF_METHOD(PUSH_MOVE, cont_oplist)( \ \ /* Apply func for all elements of the container src and push the result in dst */ \ - M_INLINE void \ - M_F(name, _transform) (container_t dst, \ - container_t src, \ - M_F(name, _transform_cb_ct) func) \ + M_P(void, name, _transform, container_t dst, container_t src, M_F(name, _transform_cb_ct) func) \ { \ M_ASSERT(dst != src); \ M_CALL_RESET(cont_oplist, dst); \ @@ -775,10 +771,10 @@ \ /* Reduce all elements of the container in dst in function of func */ \ M_IF_METHOD(SET, type_oplist)( \ - M_INLINE void \ - M_F(name, _reduce) (type_t *dest, container_t const l, \ + M_P(void, name, _reduce, type_t *dest, container_t const l, \ M_F(name, _transform_cb_ct) func) \ { \ + M_UNUSED_CONTEXT(); \ bool initDone = false; \ for M_EACH(item, l, cont_oplist) { \ if (initDone) { \ @@ -793,12 +789,12 @@ \ /* Reduce all transformed elements of the container in dst in function of func */ \ M_IF_METHOD(INIT, type_oplist)( \ - M_INLINE \ - void M_F(name, _map_reduce) (type_t *dest, \ + M_P(void, name, _map_reduce, type_t *dest, \ const container_t l, \ M_F(name, _transform_cb_ct) redFunc, \ M_F(name, _transform_cb_ct) mapFunc) \ { \ + M_UNUSED_CONTEXT(); \ bool initDone = false; \ type_t tmp; \ M_CALL_INIT(type_oplist, tmp); \ @@ -905,8 +901,7 @@ /* Define functions based on remove method */ #define M_ALG0_DEF_REMOVE(name, container_t, cont_oplist, type_t, type_oplist, it_t) \ \ - M_INLINE void \ - M_F(name, _uniq)(container_t l) \ + M_P(void, name, _uniq, container_t l) \ { \ it_t it1; \ it_t it2; \ @@ -927,8 +922,7 @@ } \ } \ \ - M_INLINE void \ - M_F(name, _remove_val)(container_t l, type_t const val) \ + M_P(void, name, _remove_val, container_t l, type_t const val) \ { \ it_t it1; \ M_CALL_IT_FIRST(cont_oplist, it1, l); \ @@ -942,8 +936,7 @@ } \ } \ \ - M_INLINE void \ - M_F(name, _remove_if)(container_t l, M_F(name, _test_cb_ct) func) \ + M_P(void, name, _remove_if, container_t l, M_F(name, _test_cb_ct) func) \ { \ it_t it1; \ M_CALL_IT_FIRST(cont_oplist, it1, l); \ diff --git a/m-array.h b/m-array.h index 4c2bd6e6..01d42235 100644 --- a/m-array.h +++ b/m-array.h @@ -270,7 +270,7 @@ M_P(void, name, _reset, array_t v) \ { \ M_ARRA4_CONTRACT(v); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ for(size_t i = 0; i < v->size; i++) \ M_CALL_CLEAR(oplist, v->ptr[i]); \ v->size = 0; \ @@ -351,7 +351,7 @@ M_P(void, name, _set_at, array_t v, size_t i, type const x) \ { \ M_ARRA4_CONTRACT(v); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT(v->size > 0 && v->ptr != NULL); \ M_ASSERT_INDEX(i, v->size); \ M_CALL_SET(oplist, v->ptr[i], x); \ @@ -543,7 +543,7 @@ M_P(void, name, _pop_back, type *dest, array_t v) \ { \ M_ARRA4_CONTRACT(v); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT (v->ptr != NULL); \ M_ASSERT_INDEX(0, v->size); \ v->size--; \ @@ -602,7 +602,7 @@ M_P(void, name, _pop_at, type *dest, array_t v, size_t i) \ { \ M_ARRA4_CONTRACT(v); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT (v->size > 0 && v->ptr != NULL); \ M_ASSERT_INDEX(i, v->size); \ if (dest) \ @@ -661,7 +661,7 @@ M_P(void, name, _remove_v, array_t v, size_t i, size_t j) \ { \ M_ARRA4_CONTRACT(v); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT(i < j && v->ptr != NULL); \ M_ASSERT_INDEX(i, v->size); \ M_ASSERT_INDEX(j, v->size+1); \ diff --git a/m-bptree.h b/m-bptree.h index 8bf07115..8f198f65 100644 --- a/m-bptree.h +++ b/m-bptree.h @@ -706,7 +706,7 @@ M_IF(isMap)( M_DEFERRED_COMMA value_t const value,) ) \ { \ M_ASSERT (M_F(name, _is_leaf)(n)); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ int i, num = M_F(name, _get_num)(n); \ M_ASSERT (num <= N); \ /* Search for the key in the node n (a leaf) for insertion */ \ @@ -737,7 +737,7 @@ M_P(int, name, _i_search_and_insert_in_node, node_t n, node_t l, key_t key) \ { \ M_ASSERT (!M_F(name, _is_leaf)(n)); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ int i, num = M_F(name, _get_num)(n); \ M_ASSERT (num <= N); \ /* Search for the key in the node n (not a leaf) for insertion */ \ @@ -869,7 +869,7 @@ M_P(int, name, _i_search_and_remove_in_leaf, node_t n, key_t const key) \ { \ M_ASSERT(M_F(name, _is_leaf)(n)); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ const int num = M_F(name, _get_num)(n); \ for(int i = 0; i < num; i++) { \ const int cmp = M_CALL_CMP(key_oplist, key, n->key[i]); \ @@ -890,7 +890,7 @@ { \ M_ASSERT (parent != NULL && !M_F(name, _is_leaf)(parent)); \ M_ASSERT (0 <= k && k < M_F(name, _get_num)(parent)); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ node_t left = parent->kind.node[k]; \ node_t right = parent->kind.node[k+1]; \ M_ASSERT (left != NULL && right != NULL); \ @@ -926,7 +926,7 @@ { \ M_ASSERT (parent != NULL && !M_F(name, _is_leaf)(parent)); \ M_ASSERT (0 <= k && k < M_F(name, _get_num)(parent)); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ node_t left = parent->kind.node[k]; \ node_t right = parent->kind.node[k+1]; \ M_ASSERT (left != NULL && right != NULL); \ diff --git a/m-buffer.h b/m-buffer.h index 7398fec8..36112868 100644 --- a/m-buffer.h +++ b/m-buffer.h @@ -221,7 +221,7 @@ typedef enum { M_N(void, name, _init, buffer_t v, size_t size) \ { \ M_ASSERT(size <= UINT_MAX); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_BUFF3R_IF_CTE_SIZE(m_size)(M_ASSERT(size == m_size), v->capacity = size); \ v->idx_prod = v->idx_cons = v->overwrite = 0; \ atomic_init (&v->number[0], 0U); \ @@ -256,7 +256,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(void, name, _i_clear_obj, buffer_t v) \ { \ M_BUFF3R_CONTRACT(v,m_size); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ if (!M_BUFF3R_POLICY_P((policy), M_BUFFER_PUSH_INIT_POP_MOVE)) { \ for(size_t i = 0; i < M_BUFF3R_SIZE(m_size); i++) { \ M_CALL_CLEAR(oplist, v->data[i].x); \ @@ -280,7 +280,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(void, name, _clear, buffer_t v) \ { \ M_BUFF3R_CONTRACT(v,m_size); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name,_i_clear_obj)(v); \ M_BUFF3R_IF_CTE_SIZE(m_size)( , \ M_CALL_FREE(oplist, M_F(name, _el_ct), v->data, M_BUFF3R_SIZE(m_size)); \ @@ -296,7 +296,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(void, name, _reset, buffer_t v) \ { \ M_BUFF3R_CONTRACT(v,m_size); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ m_mutex_lock(v->mutexPush); \ m_mutex_lock(v->mutexPop); \ M_BUFF3R_PROTECTED_CONTRACT(policy, v, m_size); \ @@ -314,7 +314,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ \ M_N(void, name, _init_set, buffer_t dest, const buffer_t src) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ /* un-const 'src', so that we can lock it (semantically it is const) */ \ M_F(name, _uptr_ct) vu; \ vu.cptr = src; \ @@ -354,7 +354,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ \ M_N(void, name, _set, buffer_t dest, const buffer_t src) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ /* un-const 'src', so that we can lock it (semantically it is const) */ \ M_F(name, _uptr_ct) vu; \ vu.cptr = src; \ @@ -449,7 +449,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(bool, name, _push_blocking, buffer_t v, type const data, bool blocking) \ { \ M_BUFF3R_CONTRACT(v,m_size); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ /* Producer Mutex lock (mutex lock performs an acquire memory barrier) */ \ m_mutex_lock(v->mutexPush); \ while (!M_BUFF3R_POLICY_P((policy), M_BUFFER_PUSH_OVERWRITE) \ @@ -523,7 +523,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ { \ M_BUFF3R_CONTRACT(v,m_size); \ M_ASSERT (data != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ /* consumer lock (mutex lock performs an acquire memory barrier) */ \ m_mutex_lock(v->mutexPop); \ while (M_F(name, _empty_p)(v)) { \ @@ -714,7 +714,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(bool, name, _push, buffer_t table, type const x) \ { \ M_QU3UE_MPMC_CONTRACT(table); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int idx = atomic_load_explicit(&table->ProdIdx, \ memory_order_relaxed); \ const unsigned int i = idx & (table->size -1); \ @@ -749,7 +749,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ { \ M_QU3UE_MPMC_CONTRACT(table); \ M_ASSERT (ptr != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int iC = atomic_load_explicit(&table->ConsoIdx, \ memory_order_relaxed); \ const unsigned int i = (iC & (table->size -1)); \ @@ -779,7 +779,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_ASSERT (buffer != NULL); \ M_ASSERT( M_POWEROF2_P(size) && 0 < size && size <= UINT_MAX); \ M_ASSERT(((policy) & (M_BUFFER_STACK|M_BUFFER_PUSH_OVERWRITE)) == 0); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ atomic_init(&buffer->ProdIdx, (unsigned int) size); \ atomic_init(&buffer->ConsoIdx, (unsigned int) size); \ buffer->size = (unsigned int) size; \ @@ -799,7 +799,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(void, name, _clear, buffer_t buffer) \ { \ M_QU3UE_MPMC_CONTRACT(buffer); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ if (!M_BUFF3R_POLICY_P((policy), M_BUFFER_PUSH_INIT_POP_MOVE)) { \ for(unsigned int j = 0; j < buffer->size; j++) { \ M_CALL_CLEAR(oplist, buffer->Tab[j].x); \ @@ -939,7 +939,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(bool, name, _push, buffer_t table, type const x) \ { \ M_QU3UE_SPSC_CONTRACT(table); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int r = atomic_load_explicit(&table->consoIdx, \ memory_order_relaxed); \ unsigned int w = atomic_load_explicit(&table->prodIdx, \ @@ -960,7 +960,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(bool, name, _push_move, buffer_t table, type *x) \ { \ M_QU3UE_SPSC_CONTRACT(table); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int r = atomic_load_explicit(&table->consoIdx, \ memory_order_relaxed); \ unsigned int w = atomic_load_explicit(&table->prodIdx, \ @@ -982,7 +982,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ { \ M_QU3UE_SPSC_CONTRACT(table); \ M_ASSERT (ptr != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int w = atomic_load_explicit(&table->prodIdx, \ memory_order_relaxed); \ unsigned int r = atomic_load_explicit(&table->consoIdx, \ @@ -1005,7 +1005,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_QU3UE_SPSC_CONTRACT(table); \ M_ASSERT (x != NULL); \ M_ASSERT (n <= table->size); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int r = atomic_load_explicit(&table->consoIdx, \ memory_order_relaxed); \ unsigned int w = atomic_load_explicit(&table->prodIdx, \ @@ -1031,7 +1031,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_QU3UE_SPSC_CONTRACT(table); \ M_ASSERT (ptr != NULL); \ M_ASSERT (n <= table->size); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int w = atomic_load_explicit(&table->prodIdx, \ memory_order_relaxed); \ unsigned int r = atomic_load_explicit(&table->consoIdx, \ @@ -1055,7 +1055,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(void, name, _push_force, buffer_t table, type const x) \ { \ M_QU3UE_SPSC_CONTRACT(table); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ unsigned int r = atomic_load_explicit(&table->consoIdx, \ memory_order_relaxed); \ unsigned int w = atomic_load_explicit(&table->prodIdx, \ @@ -1119,7 +1119,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_ASSERT (buffer != NULL); \ M_ASSERT( M_POWEROF2_P(size) && 0 < size && size <= UINT_MAX); \ M_ASSERT(((policy) & (M_BUFFER_STACK|M_BUFFER_PUSH_OVERWRITE)) == 0); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ atomic_init(&buffer->prodIdx, (unsigned int) size); \ atomic_init(&buffer->consoIdx, (unsigned int) size); \ buffer->size = (unsigned int) size; \ @@ -1138,7 +1138,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(void, name, _clear, buffer_t buffer) \ { \ M_QU3UE_SPSC_CONTRACT(buffer); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ if (!M_BUFF3R_POLICY_P((policy), M_BUFFER_PUSH_INIT_POP_MOVE)) { \ for(unsigned int j = 0; j < buffer->size; j++) { \ M_CALL_CLEAR(oplist, buffer->Tab[j].x); \ @@ -1198,7 +1198,7 @@ M_N(void, name, _init, buffer_t v, size_t size) \ M_N(void, name, function_name, name_t v M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \ { \ M_GET_TYPE oplist data; \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_EMPLACE_CALL_FUNC(a, init_func, oplist, data, exp_emplace_type); \ M_F(name, _push)(v, data); \ M_CALL_CLEAR(oplist, data); \ diff --git a/m-deque.h b/m-deque.h index 9cbf9ad0..01c9b119 100644 --- a/m-deque.h +++ b/m-deque.h @@ -222,7 +222,7 @@ M_P(void, name, _reset, deque_t d) \ { \ M_D3QU3_CONTRACT(d); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ node_t *min_node = NULL; \ for(node_t *n = d->front->node; \ n != NULL ; \ @@ -365,7 +365,7 @@ { \ M_D3QU3_CONTRACT(d); \ M_ASSERT(d->count > 0); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ node_t *n = d->back->node; \ size_t index = d->back->index; \ index --; \ @@ -407,7 +407,7 @@ { \ M_D3QU3_CONTRACT(d); \ M_ASSERT(d->count > 0); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ node_t *n = d->front->node; \ size_t index = d->front->index; \ if (ptr != NULL) \ @@ -825,7 +825,7 @@ M_P(void, name, _set_at, deque_t d, size_t key, type const x) \ { \ M_D3QU3_CONTRACT(d); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT_INDEX (key, d->count); \ type *p = M_F(name, _get)(d, key); \ M_CALL_SET(oplist, *p, x); \ diff --git a/m-dict.h b/m-dict.h index 50ecae78..89d3369a 100644 --- a/m-dict.h +++ b/m-dict.h @@ -2078,7 +2078,7 @@ enum m_d1ct_oa_element_e { M_P(void, name, _bulk_get, unsigned n, value_type val[M_VLA(n)], dict_t dict, key_type const key[M_VLA(n)], value_type def) \ { \ M_D1CT_OA_CONTRACT (dict); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ size_t h[M_USE_MAX_PREFETCH]; \ M_F(name, _pair_ct) *data = dict->data; \ const size_t mask = dict->mask; \ diff --git a/m-queue.h b/m-queue.h index 1353b285..749f88f6 100644 --- a/m-queue.h +++ b/m-queue.h @@ -168,7 +168,7 @@ M_P(void, name, _init, queue_t v, size_t size) \ { \ M_ASSERT(size <= UINT_MAX); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_QUEU3_IF_CTE_SIZE(m_size)(M_ASSERT(size == m_size), v->capacity = (unsigned) size); \ v->idx_prod = v->idx_cons = v->number = 0; \ \ @@ -194,7 +194,7 @@ M_QUEU3_IF_CTE_SIZE(m_size)( \ M_P(void, name, _i_clear_obj, queue_t v) \ { \ M_QUEU3_CONTRACT(v,m_size); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ for(size_t i = 0; i < M_QUEU3_SIZE(v, m_size); i++) { \ M_CALL_CLEAR(oplist, v->data[i]); \ } \ @@ -205,7 +205,7 @@ M_QUEU3_IF_CTE_SIZE(m_size)( \ M_P(void, name, _clear, queue_t v) \ { \ M_QUEU3_CONTRACT(v,m_size); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_F(name,_i_clear_obj)M_R(v); \ M_QUEU3_IF_CTE_SIZE(m_size)( , \ M_CALL_FREE(oplist, type, v->data, M_QUEU3_SIZE(v, m_size)); \ @@ -264,7 +264,7 @@ M_QUEU3_IF_CTE_SIZE(m_size)( \ M_P(bool, name, _push, queue_t v, type const data) \ { \ M_QUEU3_CONTRACT(v,m_size); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ if (M_F(name, _full_p)(v)) \ return false; \ \ @@ -284,7 +284,7 @@ M_QUEU3_IF_CTE_SIZE(m_size)( \ { \ M_QUEU3_CONTRACT(v,m_size); \ M_ASSERT (data != NULL); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ if (M_F(name, _empty_p)(v)) \ return false; \ \ diff --git a/m-shared-ptr.h b/m-shared-ptr.h index 562d60ea..2caf0e05 100644 --- a/m-shared-ptr.h +++ b/m-shared-ptr.h @@ -613,7 +613,7 @@ extern shared_t *function_name(M_EMPLACE_LIST_TYPE_VAR_ALTER(a, exp_emplace_type M_IF_METHOD(INIT, oplist)( \ fattr shared_t *M_F(name, _new)(void) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ shared_t *out = M_CALL_NEW(oplist, shared_t); \ if (M_UNLIKELY_NOMEM( out == NULL)) { \ M_MEMORY_FULL(shared_t, 1); \ @@ -629,7 +629,7 @@ M_IF_METHOD(INIT_SET, oplist)( \ fattr shared_t *M_F(name, _clone)(const shared_t *src) \ { \ M_ASSERT(src != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ shared_t *out = M_CALL_NEW(oplist, shared_t); \ if (M_UNLIKELY_NOMEM( out == NULL)) { \ M_MEMORY_FULL(shared_t, 1); \ @@ -646,7 +646,7 @@ M_IF_METHOD(INIT_SET, oplist)( \ fattr shared_t *M_F(name, _new_from)(type const src); ) \ fattr shared_t *M_F(name, _new_from)(type const src) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ shared_t *out = M_CALL_NEW(oplist, shared_t); \ if (M_UNLIKELY_NOMEM( out == NULL)) { \ M_MEMORY_FULL(shared_t, 1); \ @@ -663,7 +663,7 @@ M_IF_METHOD(SET, oplist)( \ { \ M_ASSERT(out != NULL); \ M_ASSERT(src != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ if (M_UNLIKELY (out == src)) return; \ M_F(name, _write_read_lock)(out, src); \ M_ON_EXCEPTION( M_F(name, _write_read_unlock)(out, src) ) \ @@ -682,7 +682,7 @@ fattr shared_t *M_F(name, _acquire)(shared_t *out) \ \ fattr void M_F(name, _release)(shared_t *out) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ if (out != NULL && M_C3(m_shar3d_, name, _dec_owner)(out)) { \ M_CALL_CLEAR(oplist, out->data); \ M_F(name, _clear_lock)(out); \ @@ -706,7 +706,7 @@ M_EMPLACE_QUEUE_DEF( (name, fattr), shared_t, M_F(name, _make), oplist, M_SHAR3D #define M_SHAR3D_PTR_DEF_BASIC_MAKE(name_attr, shared_t, function_name, oplist, init_func, exp_emplace_type) \ M_PAIR_2 name_attr shared_t *function_name(M_EMPLACE_LIST_TYPE_VAR_ALTER(a, exp_emplace_type)) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ shared_t *out = M_CALL_NEW(oplist, shared_t); \ if (M_UNLIKELY_NOMEM( out == NULL)) { \ M_MEMORY_FULL(shared_t, 1); \ @@ -753,7 +753,7 @@ M_IF_METHOD(RESET, oplist)( \ fattr void M_F(name, _reset)(shared_t *out) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ /* RESET cannot throw exception */ \ M_CALL_RESET(oplist, out->data); \ @@ -866,7 +866,7 @@ M_IF_METHOD(ADD, oplist)( \ fattr void M_F(name, _add)(shared_t *out, const shared_t *src1, const shared_t *src2) \ { \ M_ASSERT(out != NULL && src1 != NULL && src2 != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_read2_lock)(out, src1, src2); \ M_ON_EXCEPTION( M_F(name, _write_read2_unlock)(out, src1, src2) ) \ M_CALL_ADD(oplist, out->data, src1->data, src2->data); \ @@ -878,7 +878,7 @@ M_IF_METHOD(SUB, oplist)( \ fattr void M_F(name, _sub)(shared_t *out, const shared_t *src1, const shared_t *src2) \ { \ M_ASSERT(out != NULL && src1 != NULL && src2 != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_read2_lock)(out, src1, src2); \ M_ON_EXCEPTION( M_F(name, _write_read2_unlock)(out, src1, src2) ) \ M_CALL_SUB(oplist, out->data, src1->data, src2->data); \ @@ -890,7 +890,7 @@ M_IF_METHOD(MUL, oplist)( \ fattr void M_F(name, _mul)(shared_t *out, const shared_t *src1, const shared_t *src2) \ { \ M_ASSERT(out != NULL && src1 != NULL && src2 != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_read2_lock)(out, src1, src2); \ M_ON_EXCEPTION( M_F(name, _write_read2_unlock)(out, src1, src2) ) \ M_CALL_MUL(oplist, out->data, src1->data, src2->data); \ @@ -902,7 +902,7 @@ M_IF_METHOD(DIV, oplist)( \ fattr void M_F(name, _div)(shared_t *out, const shared_t *src1, const shared_t *src2) \ { \ M_ASSERT(out != NULL && src1 != NULL && src2 != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_read2_lock)(out, src1, src2); \ M_ON_EXCEPTION( M_F(name, _write_read2_unlock)(out, src1, src2) ) \ M_CALL_DIV(oplist, out->data, src1->data, src2->data); \ @@ -914,7 +914,7 @@ M_IF_METHOD(SPLICE, oplist)( \ fattr void M_F(name, _splice)(shared_t *out, shared_t *src) \ { \ M_ASSERT(out != NULL && src != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ if (out < src) { \ M_F(name, _write_lock)(out); \ M_F(name, _write_lock)(src); \ @@ -944,7 +944,7 @@ M_IF_METHOD(GET_KEY, oplist)( \ { \ M_ASSERT (out != NULL); \ M_ASSERT (value != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _read_lock)(out); \ /* No exception */ \ value_type *p = M_CALL_GET_KEY(oplist, out->data, key); \ @@ -961,7 +961,7 @@ M_IF_METHOD(SAFE_GET_KEY, oplist)( \ { \ M_ASSERT (out != NULL); \ M_ASSERT (value != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ M_ON_EXCEPTION( M_F(name, _write_unlock)(out) ) { \ value_type *p = M_CALL_SAFE_GET_KEY(oplist, out->data, key); \ @@ -977,7 +977,7 @@ M_IF_METHOD(SET_KEY, oplist)( \ fattr void M_F(name, _set_at)(shared_t *out, key_type const key, value_type const value) \ { \ M_ASSERT (out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ M_ON_EXCEPTION( M_F(name, _write_unlock)(out) ) \ M_CALL_SET_KEY(oplist, out->data, key, value); \ @@ -990,7 +990,7 @@ M_IF_METHOD(ERASE_KEY, oplist)( \ fattr bool M_F(name, _erase)(shared_t *out, key_type const key) \ { \ M_ASSERT (out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ /* No exception */ \ bool r = M_CALL_ERASE_KEY(oplist, out->data, key); \ @@ -1021,7 +1021,7 @@ M_IF_METHOD(PUSH, oplist)( \ fattr void M_F(name, _push)(shared_t *out, sub_type const value) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ while (true) { \ if (M_CALL_FULL_P(oplist, out->data) == false) { \ @@ -1038,7 +1038,7 @@ M_IF_METHOD(PUSH, oplist)( \ fattr bool M_F(name, _try_push)(shared_t *out, sub_type const value) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ bool ret = false; \ M_F(name, _write_lock)(out); \ if (M_CALL_FULL_P(oplist, out->data) == false) { \ @@ -1055,7 +1055,7 @@ M_IF_METHOD(PUSH_MOVE, oplist)( \ fattr void M_F(name, _push_move)(shared_t *out, sub_type *value) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ while (true) { \ if (M_CALL_FULL_P(oplist, out->data) == false) { \ @@ -1072,7 +1072,7 @@ M_IF_METHOD(PUSH_MOVE, oplist)( \ fattr bool M_F(name, _try_push_move)(shared_t *out, sub_type *value) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ bool ret = false; \ M_F(name, _write_lock)(out); \ if (M_CALL_FULL_P(oplist, out->data) == false) { \ @@ -1094,7 +1094,7 @@ M_IF_METHOD(PUSH_MOVE, oplist)( \ fattr void function_name(shared_t *out M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type)) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ while (true) { \ if (M_CALL_FULL_P(oplist, out->data) == false) { \ @@ -1117,7 +1117,7 @@ fattr void function_name(shared_t *out M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_ty fattr bool function_name(shared_t *out M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type)) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ bool ret = false; \ M_F(name, _write_lock)(out); \ if (M_CALL_FULL_P(oplist, out->data) == false) { \ @@ -1146,7 +1146,7 @@ M_IF_METHOD(POP, oplist)( \ fattr void M_F(name, _pop)(sub_type *value, shared_t *out) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ while (true) { \ if (M_CALL_EMPTY_P(oplist, out->data) == false) { \ @@ -1163,7 +1163,7 @@ M_IF_METHOD(POP, oplist)( \ fattr bool M_F(name, _try_pop)(sub_type *value, shared_t *out) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ bool ret = false; \ M_F(name, _write_lock)(out); \ if (M_CALL_EMPTY_P(oplist, out->data) == false) { \ @@ -1180,7 +1180,7 @@ M_IF_METHOD(POP_MOVE, oplist)( \ fattr void M_F(name, _pop_move)(sub_type *value, shared_t *out) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ while (true) { \ if (M_CALL_EMPTY_P(oplist, out->data) == false) { \ @@ -1197,7 +1197,7 @@ M_IF_METHOD(POP_MOVE, oplist)( \ fattr bool M_F(name, _try_pop_move)(sub_type *value, shared_t *out) \ { \ M_ASSERT(out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ bool ret = false; \ M_F(name, _write_lock)(out); \ if (M_CALL_EMPTY_P(oplist, out->data) == false) { \ @@ -1326,7 +1326,7 @@ M_IF_METHOD(IN_STR, oplist)( \ fattr bool M_F(name, _in_str)(shared_t *out, FILE *file) \ { \ M_ASSERT (out != NULL && file != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ m_volatile bool r = false; \ M_ON_EXCEPTION( M_F(name, _write_unlock)(out) ) \ @@ -1341,7 +1341,7 @@ M_IF_METHOD(GET_STR, oplist)( \ fattr void M_F(name, _get_str)(m_string_t str, const shared_t *out, bool append) \ { \ M_ASSERT (out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _read_lock)(out); \ M_ON_EXCEPTION( M_F(name, _read_unlock)(out) ) \ M_CALL_GET_STR(oplist, str, out->data, append); \ @@ -1352,7 +1352,7 @@ M_IF_METHOD(PARSE_STR, oplist)( \ fattr bool M_F(name, _parse_str)(shared_t *out, const char str[], const char **endp) \ { \ M_ASSERT (out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ m_volatile bool r = false; \ M_ON_EXCEPTION( M_F(name, _write_unlock)(out) ) \ @@ -1379,7 +1379,7 @@ M_IF_METHOD(IN_SERIAL, oplist)( \ fattr m_serial_return_code_t M_F(name, _in_serial)(shared_t *out, m_serial_read_t serial) \ { \ M_ASSERT (out != NULL); \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_F(name, _write_lock)(out); \ m_volatile m_serial_return_code_t r = M_SERIAL_FAIL; \ M_ON_EXCEPTION( M_F(name, _write_unlock)(out) ) \ diff --git a/m-snapshot.h b/m-snapshot.h index 37d834d9..7e307811 100644 --- a/m-snapshot.h +++ b/m-snapshot.h @@ -201,7 +201,7 @@ M_BEGIN_PROTECTED_CODE M_P(void, name, _init, snapshot_t snap) \ { \ M_ASSERT(snap != NULL); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ for(int i = 0; i < M_SNAPSH0T_SPSC_MAX_BUFFER; i++) { \ M_CALL_INIT(oplist, snap->data[i].x); \ } \ @@ -212,7 +212,7 @@ M_BEGIN_PROTECTED_CODE M_P(void, name, _clear, snapshot_t snap) \ { \ M_SNAPSH0T_SPSC_CONTRACT(snap); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ for(int i = 0; i < M_SNAPSH0T_SPSC_MAX_BUFFER; i++) { \ M_CALL_CLEAR(oplist, snap->data[i].x); \ } \ @@ -222,7 +222,7 @@ M_BEGIN_PROTECTED_CODE M_P(void, name, _init_set, snapshot_t snap, snapshot_t org) \ { \ M_SNAPSH0T_SPSC_CONTRACT(org); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT(snap != NULL && snap != org); \ for(int i = 0; i < M_SNAPSH0T_SPSC_MAX_BUFFER; i++) { \ M_CALL_INIT_SET(oplist, snap->data[i].x, org->data[i].x); \ @@ -236,7 +236,7 @@ M_BEGIN_PROTECTED_CODE { \ M_SNAPSH0T_SPSC_CONTRACT(snap); \ M_SNAPSH0T_SPSC_CONTRACT(org); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ for(int i = 0; i < M_SNAPSH0T_SPSC_MAX_BUFFER; i++) { \ M_CALL_SET(oplist, snap->data[i].x, org->data[i].x); \ } \ @@ -264,7 +264,7 @@ M_BEGIN_PROTECTED_CODE { \ M_SNAPSH0T_SPSC_CONTRACT(snap); \ M_SNAPSH0T_SPSC_CONTRACT(org); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT(snap != org); \ for(int i = 0; i < M_SNAPSH0T_SPSC_MAX_BUFFER; i++) { \ M_CALL_MOVE(oplist, snap->data[i].x, org->data[i].x); \ diff --git a/m-string.h b/m-string.h index 8139550f..9d588a83 100644 --- a/m-string.h +++ b/m-string.h @@ -2018,8 +2018,7 @@ m_string_utf8_p(const m_string_t str) /* Define the split & the join functions in case of usage with the algorithm module */ #define M_STR1NG_SPLIT(name, oplist, type_oplist) \ - M_INLINE void M_F(name, _split)(M_GET_TYPE oplist cont, \ - const m_string_t str, const char sep) \ + M_P(void, name, _split, M_GET_TYPE oplist cont, const m_string_t str, const char sep) \ { \ size_t begin = 0; \ m_string_t tmp; \ @@ -2029,7 +2028,7 @@ m_string_utf8_p(const m_string_t str) for(size_t i = 0 ; i < size; i++) { \ char c = m_string_get_char(str, i); \ if (c == sep) { \ - m_string_set_cstrn(tmp, &m_string_get_cstr(str)[begin], i - begin); \ + m_string_set_cstrn M_R(tmp, &m_string_get_cstr(str)[begin], i - begin); \ /* If push move method is available, use it */ \ M_IF_METHOD(PUSH_MOVE,oplist)( \ M_CALL_PUSH_MOVE(oplist, cont, &tmp); \ @@ -2040,24 +2039,23 @@ m_string_utf8_p(const m_string_t str) begin = i + 1; \ } \ } \ - m_string_set_cstrn(tmp, &m_string_get_cstr(str)[begin], size - begin); \ + m_string_set_cstrn M_R(tmp, &m_string_get_cstr(str)[begin], size - begin); \ M_CALL_PUSH(oplist, cont, tmp); \ /* HACK: if method reverse is defined, it is likely that we have */ \ /* inserted the items in the wrong order (aka for a list) */ \ M_IF_METHOD(REVERSE, oplist) (M_CALL_REVERSE(oplist, cont);, ) \ - m_string_clear(tmp); \ + m_string_clear M_R(tmp); \ } \ \ - M_INLINE void M_F(name, _join)(m_string_t dst, M_GET_TYPE oplist cont, \ - const m_string_t str) \ + M_P(void, name, _join, m_string_t dst, M_GET_TYPE oplist cont, const m_string_t str) \ { \ bool init_done = false; \ m_string_reset (dst); \ for M_EACH(item, cont, oplist) { \ if (init_done) { \ - m_string_cat(dst, str); \ + m_string_cat M_R(dst, str); \ } \ - m_string_cat (dst, *item); \ + m_string_cat M_R(dst, *item); \ init_done = true; \ } \ } \ @@ -2287,7 +2285,16 @@ namespace m_lib { #endif /* Concatenate the string (or C string) b to the string a */ +#ifdef M_USE_CONTEXT +#define m_string_cat(p, a,b) \ + _Generic((b)+0, \ + char*: m_string_cat_cstr, \ + const char *: m_string_cat_cstr, \ + default : m_string_cat \ + )(p,a,b) +#else #define m_string_cat(a,b) M_STR1NG_SELECT2(m_string_cat, m_string_cat_cstr, a, b) +#endif /* Compare the string a to the string (or C string) b and return the sort order */ #define m_string_cmp(a,b) M_STR1NG_SELECT2(m_string_cmp, m_string_cmp_cstr, a, b) diff --git a/m-tree.h b/m-tree.h index 92b4e11c..6bd480c8 100644 --- a/m-tree.h +++ b/m-tree.h @@ -217,7 +217,7 @@ typedef int32_t m_tr33_index_t; \ M_P(void, name, _reset, tree_t tree) { \ M_TR33_CONTRACT(tree); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ if (tree->size > 0) { \ /* We don't scan recursively the node tree, but sequentially */ \ m_tr33_index_t free_index = tree->free_index; \ @@ -863,7 +863,7 @@ typedef int32_t m_tr33_index_t; \ M_P(bool, name, _remove, it_t it) { \ M_TR33_IT_CONTRACT(it, false); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ if (M_UNLIKELY(it.index < 0)) { return false; } \ type *ptr = M_F(name, _unlink)(it); \ M_CALL_CLEAR(oplist, *ptr); \ diff --git a/m-tuple.h b/m-tuple.h index a83df23d..6ba2d8cf 100644 --- a/m-tuple.h +++ b/m-tuple.h @@ -244,7 +244,7 @@ namespace m_lib { /* Define the INIT method calling the INIT method for all params */ #define M_TUPL3_DEFINE_INIT(name, ...) \ M_P(void, name, _init, M_F(name,_ct) my) { \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_INIT_FUNC , __VA_ARGS__) {} \ } @@ -255,7 +255,7 @@ namespace m_lib { #define M_TUPL3_DEFINE_INIT_SET(name, ...) \ M_P(void, name, _init_set, M_F(name,_ct) my , M_F(name,_ct) const org) { \ M_TUPL3_CONTRACT(org); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_INIT_SET_FUNC , __VA_ARGS__) {} \ } #define M_TUPL3_DEFINE_INIT_SET_FUNC(a) \ @@ -265,7 +265,7 @@ namespace m_lib { /* Define the INIT_WITH method calling the INIT_SET method for all params. */ #define M_TUPL3_DEFINE_INIT_SET2(name, ...) \ M_P(void, name, _init_emplace, M_F(name,_ct) my M_MAP(M_TUPL3_DEFINE_SET2_PROTO, __VA_ARGS__) ) { \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_INIT_SET2_FUNC , __VA_ARGS__) {} \ } @@ -279,7 +279,7 @@ namespace m_lib { M_P(void, name, _set, M_F(name,_ct) my, M_F(name,_ct) const org) { \ M_TUPL3_CONTRACT(my); \ M_TUPL3_CONTRACT(org); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_SET_FUNC , __VA_ARGS__) \ } @@ -291,7 +291,7 @@ namespace m_lib { #define M_TUPL3_DEFINE_SET2(name, ...) \ M_P(void, name, _emplace, M_F(name,_ct) my M_MAP(M_TUPL3_DEFINE_SET2_PROTO, __VA_ARGS__) ) { \ M_TUPL3_CONTRACT(my); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_SET2_FUNC , __VA_ARGS__) \ } #define M_TUPL3_DEFINE_SET2_PROTO(a) \ @@ -305,7 +305,7 @@ namespace m_lib { #define M_TUPL3_DEFINE_CLEAR(name, ...) \ M_P(void, name, _clear, M_F(name,_ct) my) { \ M_TUPL3_CONTRACT(my); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_CLEAR_FUNC , __VA_ARGS__) \ } @@ -343,7 +343,7 @@ namespace m_lib { M_INLINE void M_C3(name, _set_, M_TUPL3_GET_FIELD a) \ (M_P_EXPAND M_F(name,_ct) my, M_TUPL3_GET_TYPE a const M_TUPL3_GET_FIELD a) { \ M_TUPL3_CONTRACT(my); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_TUPL3_CALL_SET(a, my ->M_TUPL3_GET_FIELD a, M_TUPL3_GET_FIELD a); \ } @@ -362,7 +362,7 @@ namespace m_lib { function_name(M_P_EXPAND name_t v \ M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \ { \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_CALL_CLEAR(oplist, v->name); \ M_EMPLACE_CALL_FUNC(a, init_func, oplist, v->name, exp_emplace_type); \ } @@ -508,7 +508,7 @@ namespace m_lib { { \ bool comma = false; \ M_TUPL3_CONTRACT(el); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT (f != NULL); \ int c = fgetc(f); \ if (c != '(') return false; \ @@ -533,7 +533,7 @@ namespace m_lib { { \ M_TUPL3_CONTRACT(el); \ M_ASSERT (str != NULL); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ bool success = false; \ bool comma = false; \ int c = *str++; \ @@ -592,7 +592,7 @@ namespace m_lib { M_P(m_serial_return_code_t, name, _in_serial, M_F(name,_ct) el, m_serial_read_t f) \ { \ M_TUPL3_CONTRACT(el); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_ASSERT (f != NULL && f->m_interface != NULL); \ int index = -1; \ const int field_max = M_NARGS(__VA_ARGS__); \ @@ -637,7 +637,7 @@ namespace m_lib { #define M_TUPL3_DEFINE_MOVE(name, ...) \ M_P(void, name, _move, M_F(name,_ct) el, M_F(name,_ct) org) { \ M_TUPL3_CONTRACT(el); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_MOVE_FUNC , __VA_ARGS__) \ } @@ -661,7 +661,7 @@ namespace m_lib { #define M_TUPL3_DEFINE_RESET(name, ...) \ M_P(void, name, _reset, M_F(name,_ct) el1) { \ M_TUPL3_CONTRACT(el1); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ M_MAP(M_TUPL3_DEFINE_RESET_FUNC , __VA_ARGS__) \ } \ diff --git a/m-variant.h b/m-variant.h index 2349f18a..64cd1674 100644 --- a/m-variant.h +++ b/m-variant.h @@ -227,7 +227,7 @@ M_P(void, name, _init_set, M_F(name,_ct) my, M_F(name,_ct) const org) \ { \ M_VAR1ANT_CONTRACT(name, org); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ my->type = org->type; \ switch (org->type) { \ M_MAP2(M_VAR1ANT_DEFINE_INIT_SET_FUNC, name, __VA_ARGS__) \ @@ -278,7 +278,7 @@ M_P(void, name, _clear, M_F(name,_ct) my) \ { \ M_VAR1ANT_CONTRACT(name, my); \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ switch (my->type) { \ M_MAP2(M_VAR1ANT_DEFINE_CLEAR_FUNC, name, __VA_ARGS__) \ case M_F(name, _EMPTY): /* fallthrough */ \ @@ -322,7 +322,7 @@ M_INLINE void \ M_C3(name, _init_, M_VAR1ANT_GET_FIELD a)(M_P_EXPAND M_F(name,_ct) my) \ { \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ /* Reinit variable with the given value */ \ my->type = M_C4(name, _, M_VAR1ANT_GET_FIELD a, _value); \ M_VAR1ANT_CALL_INIT(a, my -> value. M_VAR1ANT_GET_FIELD a); \ @@ -337,7 +337,7 @@ M_INLINE void \ M_C3(name, _init_set_, M_VAR1ANT_GET_FIELD a)(M_P_EXPAND M_F(name,_ct) my, M_VAR1ANT_GET_TYPE a const M_VAR1ANT_GET_FIELD a) \ { \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ my->type = M_C4(name, _, M_VAR1ANT_GET_FIELD a, _value); \ M_VAR1ANT_CALL_INIT_SET(a, my -> value. M_VAR1ANT_GET_FIELD a, \ M_VAR1ANT_GET_FIELD a); \ @@ -345,7 +345,7 @@ M_INLINE void \ M_C4(m_var1ant_, name, _init_set_, num)(M_P_EXPAND M_F(name,_ct) my, M_VAR1ANT_GET_TYPE a const M_VAR1ANT_GET_FIELD a) \ { \ - M_UNUSED_CONTEXT(); \ + M_UNUSED_CONTEXT(); \ my->type = M_C4(name, _, M_VAR1ANT_GET_FIELD a, _value); \ M_VAR1ANT_CALL_INIT_SET(a, my -> value. M_VAR1ANT_GET_FIELD a, \ M_VAR1ANT_GET_FIELD a); \ diff --git a/m-worker.h b/m-worker.h index 436ee715..2bf0244f 100644 --- a/m-worker.h +++ b/m-worker.h @@ -234,7 +234,7 @@ typedef struct m_worker_sync_s { M_INLINE void \ M_C3(m_work3r_, name, _clear)(struct M_C3(m_worker_, name, _s) *p) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ M_MAP3(M_WORK3R_SPAWN_EXTEND_DEF_CALLBACK_CLEAR, data, __VA_ARGS__) \ /* TODO: Overload */ \ M_MEMORY_DEL(p); \ @@ -263,7 +263,7 @@ typedef struct m_worker_sync_s { M_MAP3_C(M_WORK3R_SPAWN_EXTEND_DEF_EMPLACE_FIELD, data, __VA_ARGS__) \ ) \ { \ - M_GLOBAL_CONTEXT(); \ + M_GLOBAL_CONTEXT(); \ if (!m_work3r_queue_full_p(block->worker->queue_g)) { \ struct M_C3(m_worker_, name, _s) *p = M_MEMORY_ALLOC ( struct M_C3(m_worker_, name, _s)); \ if (M_UNLIKELY_NOMEM(p == NULL)) { \