diff --git a/m-core.h b/m-core.h index d7577677..423004fe 100644 --- a/m-core.h +++ b/m-core.h @@ -449,6 +449,48 @@ M_BEGIN_PROTECTED_CODE #define M_UNLIKELY_NOMEM(cond) M_UNLIKELY(cond) +/***************************************************************/ +/****************** Function Generation Macro ******************/ +/***************************************************************/ + +/* + * Define the expansion logic to define a public / private / type function + * for inline expansion + */ +#define M_EXPAND_FUNC_INLINE(proto, ...) \ + static inline proto __VA_ARGS__ + +#define M_EXPAND_FUNC_INLINE_PRIVATE(...) \ + __VA_ARGS__ + +#define M_EXPAND_FUNC_INLINE_TYPE(...) \ + __VA_ARGS__ + +/* + * Define the expansion logic to define a public / private / type function + * for inline expansion + */ +#define M_EXPAND_FUNC_DECL(proto, ...) \ + extern proto; + +#define M_EXPAND_FUNC_DECL_PRIVATE(...) + +#define M_EXPAND_FUNC_DECL_TYPE(...) \ + __VA_ARGS__ + +/* + * Define the expansion logic to define a public / private / type function + * for inline expansion + */ +#define M_EXPAND_FUNC_BODY(proto, ...) \ + proto __VA_ARGS__ + +#define M_EXPAND_FUNC_BODY_PRIVATE(...) \ + __VA_ARGS__ + +#define M_EXPAND_FUNC_BODY_TYPE(...) + + /***************************************************************/ /****************** Preprocessing Times Macro ******************/ /***************************************************************/ diff --git a/m-i-list.h b/m-i-list.h index d45bc608..16f2342e 100644 --- a/m-i-list.h +++ b/m-i-list.h @@ -26,7 +26,7 @@ #define MSTARLIB_I_LIST_H #include "m-core.h" -#include "m-list.h" // For M_L1ST_ITBASE_DEF +#include "m-list.h" // For M_L1ST_DEF_ITBASE /* Interface to add to a structure to enable intrusive doubly-linked support. name: name of the intrusive list. @@ -169,7 +169,7 @@ typedef struct m_il1st_head_s { M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \ M_IL1ST_DEF_CORE(name, type, oplist, list_t, it_t) \ /* Used of internal macro from m-list */ \ - M_L1ST_ITBASE_DEF(name, type, oplist, list_t, it_t) + M_L1ST_DEF_ITBASE(M_EXPAND_FUNC_INLINE, name, type, oplist, list_t, it_t) /* Define the type of an intrusive list */ #define M_IL1ST_DEF_TYPE(name, type, oplist, list_t, it_t) \ diff --git a/m-list.h b/m-list.h index 26fdcc84..73af0a19 100644 --- a/m-list.h +++ b/m-list.h @@ -30,34 +30,34 @@ /* Define a singly linked list of a given type. USAGE: LIST_DEF(name, type [, oplist_of_the_type]) */ #define M_LIST_DEF(name, ...) \ - M_LIST_DEF_AS(name, M_F(name, _t), M_F(name, _it_t), __VA_ARGS__) + M_LIST_DEF_AS(INLINE, name, M_F(name, _t), M_F(name, _it_t), __VA_ARGS__) /* Define a singly linked list of a given type as the provided type name_t with the iterator named it_t - USAGE: LIST_DEF_AS(name, name_t, it_t, type [, oplist_of_the_type]) */ -#define M_LIST_DEF_AS(name, name_t, it_t, ...) \ + USAGE: LIST_DEF_AS(level, name, name_t, it_t, type [, oplist_of_the_type]) */ +#define M_LIST_DEF_AS(level, name, name_t, it_t, ...) \ M_BEGIN_PROTECTED_CODE \ M_L1ST_DEF_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \ - ((name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), name_t, it_t ), \ - (name, __VA_ARGS__, name_t, it_t ))) \ + ((M_C(M_EXPAND_FUNC_, level), name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), name_t, it_t ), \ + (M_C(M_EXPAND_FUNC_, level), name, __VA_ARGS__, name_t, it_t ))) \ M_END_PROTECTED_CODE /* Define a singly linked list of a given type allowing both push. USAGE: LIST_DUAL_PUSH_DEF_AS(name, name_t, type [, oplist_of_the_type]) */ #define M_LIST_DUAL_PUSH_DEF(name, ...) \ - M_LIST_DUAL_PUSH_DEF_AS(name, M_F(name,_t), M_F(name, _it_t), __VA_ARGS__) + M_LIST_DUAL_PUSH_DEF_AS(INLINE, name, M_F(name,_t), M_F(name, _it_t), __VA_ARGS__) /* Define a singly linked list of a given type allowing both push. as the provided type name_t with the iterator named it_t USAGE: LIST_DUAL_PUSH_DEF(name, type [, oplist_of_the_type]) */ -#define M_LIST_DUAL_PUSH_DEF_AS(name, name_t, it_t, ...) \ +#define M_LIST_DUAL_PUSH_DEF_AS(level, name, name_t, it_t, ...) \ M_BEGIN_PROTECTED_CODE \ M_L1ST_DUAL_PUSH_DEF_P1(M_IF_NARGS_EQ1(__VA_ARGS__) \ - ((name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), name_t, it_t ), \ - (name, __VA_ARGS__, name_t, it_t ))) \ + ((M_C(M_EXPAND_FUNC_, level), name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), name_t, it_t ), \ + (M_C(M_EXPAND_FUNC_, level), name, __VA_ARGS__, name_t, it_t ))) \ M_END_PROTECTED_CODE @@ -151,38 +151,15 @@ #define M_L1ST_DEF_P1(arg) M_ID( M_L1ST_DEF_P2 arg ) /* Validate the oplist before going further */ -#define M_L1ST_DEF_P2(name, type, oplist, list_t, it_t) \ - M_IF_OPLIST(oplist)(M_L1ST_DEF_P3, M_L1ST_DEF_FAILURE)(name, type, oplist, list_t, it_t) +#define M_L1ST_DEF_P2(F, name, type, oplist, list_t, it_t) \ + M_IF_OPLIST(oplist)(M_L1ST_DEF_P3, M_L1ST_DEF_FAILURE)(F, name, type, oplist, list_t, it_t) /* Stop processing with a compilation failure */ -#define M_L1ST_DEF_FAILURE(name, type, oplist, list_t, it_t) \ +#define M_L1ST_DEF_FAILURE(F, name, type, oplist, list_t, it_t) \ M_STATIC_FAILURE(M_LIB_NOT_AN_OPLIST, "(LIST_DEF): the given argument is not a valid oplist: " #oplist) -/* Define allocation functions. If MEMPOOL, we need to define it */ -#define M_L1ST_MEMPOOL_DEF(name, type, oplist, list_t, list_it_t) \ - M_IF_METHOD(MEMPOOL, oplist)( \ - \ - MEMPOOL_DEF(M_F(name, _mempool), struct M_F(name, _s)) \ - M_GET_MEMPOOL_LINKAGE oplist M_F(name, _mempool_t) M_GET_MEMPOOL oplist; \ - static inline struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \ - return M_F(name, _mempool_alloc)(M_GET_MEMPOOL oplist); \ - } \ - static inline void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \ - M_F(name, _mempool_free)(M_GET_MEMPOOL oplist, ptr); \ - } \ - \ - , /* No mempool allocation */ \ - \ - static inline struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \ - return M_CALL_NEW(oplist, struct M_F(name, _s)); \ - } \ - static inline void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \ - M_CALL_DEL(oplist, ptr); \ - } \ - ) \ - - /* Internal list definition + - F: Function Generation Macro - name: prefix to be used - type: type of the elements of the list - oplist: oplist of the type of the elements of the container @@ -190,8 +167,16 @@ - it_t: alias for M_F(name, _it_t) [ iterator of the container ] - node_t: alias for M_F(name, _node_t) [ node ] */ -#define M_L1ST_DEF_P3(name, type, oplist, list_t, it_t) \ - \ +#define M_L1ST_DEF_P3(F, name, type, oplist, list_t, it_t) \ + M_C(F, _TYPE)(M_L1ST_DEF_TYPE(name, type, oplist, list_t, it_t)) \ + M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \ + M_C(F, _PRIVATE)(M_L1ST_MEMPOOL_DEF(name, type, oplist, list_t, it_t)) \ + M_L1ST_DEF_CORE(F, name, type, oplist, list_t, it_t) \ + M_L1ST_DEF_ITBASE(F, name, type, oplist, list_t, it_t) + + +/* Definition of the type of a list */ +#define M_L1ST_DEF_TYPE(name, type, oplist, list_t, it_t) \ /* Define the node of a list, and the list as a pointer to a node */ \ typedef struct M_F(name, _s) { \ struct M_F(name, _s) *next; /* Next node or NULL if final node */ \ @@ -210,12 +195,6 @@ typedef list_t M_F(name, _ct); \ typedef it_t M_F(name, _it_ct); \ typedef type M_F(name, _subtype_ct); \ - \ - M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \ - \ - M_L1ST_MEMPOOL_DEF(name, type, oplist, list_t, it_t) \ - M_L1ST_DEF_P4(name, type, oplist, list_t, it_t) \ - M_L1ST_ITBASE_DEF(name, type, oplist, list_t, it_t) /* Define the internal contract of a list @@ -225,24 +204,47 @@ } while (0) +/* Define allocation functions. If MEMPOOL, we need to define it */ +#define M_L1ST_MEMPOOL_DEF(name, type, oplist, list_t, list_it_t) \ + M_IF_METHOD(MEMPOOL, oplist)( \ + \ + MEMPOOL_DEF(M_F(name, _mempool), struct M_F(name, _s)) \ + M_GET_MEMPOOL_LINKAGE oplist M_F(name, _mempool_t) M_GET_MEMPOOL oplist; \ + static inline struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \ + return M_F(name, _mempool_alloc)(M_GET_MEMPOOL oplist); \ + } \ + static inline void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \ + M_F(name, _mempool_free)(M_GET_MEMPOOL oplist, ptr); \ + } \ + \ + , /* No mempool allocation */ \ + \ + static inline struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \ + return M_CALL_NEW(oplist, struct M_F(name, _s)); \ + } \ + static inline void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \ + M_CALL_DEL(oplist, ptr); \ + } \ + ) \ + + /* Internal list function definition + - F: Function Generation Macro - name: prefix to be used - type: type of the elements of the list - oplist: oplist of the type of the elements of the container - list_t: alias for type of the container - it_t: alias for iterator of the container */ -#define M_L1ST_DEF_P4(name, type, oplist, list_t, it_t) \ +#define M_L1ST_DEF_CORE(F, name, type, oplist, list_t, it_t) \ \ - static inline void \ - M_F(name, _init)(list_t v) \ + F(void M_F(name, _init)(list_t v), \ { \ M_ASSERT (v != NULL); \ *v = NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _reset)(list_t v) \ + F(void M_F(name, _reset)(list_t v), \ { \ M_L1ST_CONTRACT(v); \ struct M_F(name, _s) *it = *v; \ @@ -254,29 +256,26 @@ it = next; \ } \ M_L1ST_CONTRACT(v); \ - } \ + }) \ \ - static inline void \ - M_F(name, _clear)(list_t v) \ + F(void M_F(name, _clear)(list_t v), \ { \ M_F(name, _reset)(v); \ - } \ + }) \ \ - static inline type * \ - M_F(name, _back)(const list_t v) \ + F(type *M_F(name, _back)(const list_t v), \ { \ M_L1ST_CONTRACT(v); \ M_ASSERT(*v != NULL); \ return &((*v)->data); \ - } \ + }) \ \ - static inline type * \ - M_F(name, _push_raw)(list_t v) \ + F(type *M_F(name, _push_raw)(list_t v), \ { \ M_L1ST_CONTRACT(v); \ struct M_F(name, _s) *next; \ next = M_C3(m_l1st_,name,_new)(); \ - if (M_UNLIKELY_NOMEM (next == NULL)) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_F(name, _s))); \ return NULL; \ } \ @@ -285,31 +284,28 @@ *v = next; \ M_L1ST_CONTRACT(v); \ return ret; \ - } \ + }) \ \ - static inline void \ - M_F(name, _push_back)(list_t v, type const x) \ + F(void M_F(name, _push_back)(list_t v, type const x), \ { \ type *data = M_F(name, _push_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return; \ M_CALL_INIT_SET(oplist, *data, x); \ - } \ + }) \ \ M_IF_METHOD(INIT, oplist)( \ - static inline type * \ - M_F(name, _push_new)(list_t v) \ + F(type *M_F(name, _push_new)(list_t v), \ { \ type *data = M_F(name, _push_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return NULL; \ M_CALL_INIT(oplist, *data); \ return data; \ - } \ + }) \ , /* No INIT */) \ \ - static inline void \ - M_F(name, _pop_back)(type *data, list_t v) \ + F(void M_F(name, _pop_back)(type *data, list_t v), \ { \ M_L1ST_CONTRACT(v); \ M_ASSERT(*v != NULL); \ @@ -322,20 +318,18 @@ *v = (*v)->next; \ M_C3(m_l1st_,name,_del)(tofree); \ M_L1ST_CONTRACT(v); \ - } \ + }) \ \ - static inline void \ - M_F(name, _push_move)(list_t v, type *x) \ + F(void M_F(name, _push_move)(list_t v, type *x), \ { \ M_ASSERT (x != NULL); \ type *data = M_F(name, _push_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return; \ M_DO_INIT_MOVE (oplist, *data, *x); \ - } \ + }) \ \ - static inline void \ - M_F(name, _pop_move)(type *data, list_t v) \ + F(void M_F(name, _pop_move)(type *data, list_t v), \ { \ M_L1ST_CONTRACT(v); \ M_ASSERT(*v != NULL && data != NULL); \ @@ -344,97 +338,85 @@ *v = (*v)->next; \ M_C3(m_l1st_,name,_del)(tofree); \ M_L1ST_CONTRACT(v); \ - } \ + }) \ \ - static inline bool \ - M_F(name, _empty_p)(const list_t v) \ + F(bool M_F(name, _empty_p)(const list_t v), \ { \ M_L1ST_CONTRACT(v); \ return *v == NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _swap)(list_t l, list_t v) \ + F(void M_F(name, _swap)(list_t l, list_t v), \ { \ M_L1ST_CONTRACT(l); \ M_L1ST_CONTRACT(v); \ M_SWAP(struct M_F(name, _s) *, *l, *v); \ M_L1ST_CONTRACT(l); \ M_L1ST_CONTRACT(v); \ - } \ + }) \ \ - static inline void \ - M_F(name, _it)(it_t it, const list_t v) \ + F(void M_F(name, _it)(it_t it, const list_t v), \ { \ M_L1ST_CONTRACT(v); \ M_ASSERT (it != NULL); \ it->current = *v; \ it->previous = NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _it_set)(it_t it1, const it_t it2) \ + F(void M_F(name, _it_set)(it_t it1, const it_t it2), \ { \ M_ASSERT (it1 != NULL && it2 != NULL); \ it1->current = it2->current; \ it1->previous = it2->previous; \ - } \ + }) \ \ - static inline void \ - M_F(name, _it_end)(it_t it1, const list_t v) \ + F(void M_F(name, _it_end)(it_t it1, const list_t v), \ { \ M_L1ST_CONTRACT(v); \ M_ASSERT (it1 != NULL); \ (void)v; /* unused */ \ it1->current = NULL; \ it1->previous = NULL; \ - } \ + }) \ \ - static inline bool \ - M_F(name, _end_p)(const it_t it) \ + F(bool M_F(name, _end_p)(const it_t it), \ { \ M_ASSERT (it != NULL); \ return it->current == NULL; \ - } \ + }) \ \ - static inline bool \ - M_F(name, _last_p)(const it_t it) \ + F(bool M_F(name, _last_p)(const it_t it), \ { \ M_ASSERT (it != NULL); \ return it->current == NULL || it->current->next == NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _next)(it_t it) \ + F(void M_F(name, _next)(it_t it), \ { \ M_ASSERT(it != NULL && it->current != NULL); \ it->previous = it->current; \ it->current = it->current->next; \ - } \ + }) \ \ - static inline bool \ - M_F(name, _it_equal_p)(const it_t it1, const it_t it2) \ + F(bool M_F(name, _it_equal_p)(const it_t it1, const it_t it2), \ { \ M_ASSERT(it1 != NULL && it2 != NULL); \ return it1->current == it2->current; \ - } \ + }) \ \ - static inline type * \ - M_F(name, _ref)(const it_t it) \ + F(type *M_F(name, _ref)(const it_t it), \ { \ M_ASSERT(it != NULL && it->current != NULL); \ return &(it->current->data); \ - } \ + }) \ \ - static inline type const * \ - M_F(name, _cref)(const it_t it) \ + F(type const *M_F(name, _cref)(const it_t it), \ { \ M_ASSERT(it != NULL && it->current != NULL); \ return M_CONST_CAST(type, &(it->current->data)); \ - } \ + }) \ \ - static inline size_t \ - M_F(name, _size)(const list_t list) \ + F(size_t M_F(name, _size)(const list_t list), \ { \ M_L1ST_CONTRACT(list); \ size_t size = 0; \ @@ -444,10 +426,9 @@ it = it->next; \ } \ return size; \ - } \ + }) \ \ - static inline bool \ - M_F(name, _sublist_p)(const list_t list, const it_t itsub) \ + F(bool M_F(name, _sublist_p)(const list_t list, const it_t itsub), \ { \ M_L1ST_CONTRACT(list); \ M_ASSERT (itsub != NULL); \ @@ -458,10 +439,9 @@ } \ /* Not found. Check if search item is NULL */ \ return (itsub->current == NULL); \ - } \ + }) \ \ - static inline type * \ - M_F(name, _get)(const list_t list, size_t i) \ + F(type *M_F(name, _get)(const list_t list, size_t i), \ { \ M_L1ST_CONTRACT(list); \ struct M_F(name, _s) *it = *list; \ @@ -475,23 +455,20 @@ it = it->next; \ j--; \ } \ - } \ + }) \ \ - static inline type const * \ - M_F(name, _cget)(const list_t l, size_t i) \ + F(type const *M_F(name, _cget)(const list_t l, size_t i), \ { \ return M_CONST_CAST(type, M_F(name, _get)(l,i)); \ - } \ + }) \ \ - static inline void \ - M_F(name, _insert)(list_t list, it_t insertion_point, \ - type const x) \ + F(void M_F(name, _insert)(list_t list, it_t insertion_point, type const x), \ { \ M_L1ST_CONTRACT(list); \ M_ASSERT (insertion_point != NULL); \ M_ASSERT(M_F(name, _sublist_p)(list, insertion_point)); \ struct M_F(name, _s) *next = M_C3(m_l1st_,name,_new)(); \ - if (M_UNLIKELY_NOMEM (next == NULL)) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_F(name, _s))); \ return; \ } \ @@ -507,10 +484,9 @@ /* Update insertion_point to this element */ \ insertion_point->current = next; \ M_L1ST_CONTRACT(list); \ - } \ + }) \ \ - static inline void \ - M_F(name, _remove)(list_t list, it_t removing_point) \ + F(void M_F(name, _remove)(list_t list, it_t removing_point), \ { \ M_L1ST_CONTRACT(list); \ M_ASSERT (removing_point != NULL); \ @@ -526,10 +502,9 @@ M_C3(m_l1st_,name,_del) (removing_point->current); \ removing_point->current = next; \ M_L1ST_CONTRACT(list); \ - } \ + }) \ \ - static inline void \ - M_F(name, _init_set)(list_t list, const list_t org) \ + F(void M_F(name, _init_set)(list_t list, const list_t org), \ { \ M_L1ST_CONTRACT(org); \ struct M_F(name, _s) *next, *it_org; \ @@ -539,7 +514,7 @@ while (it_org != NULL) { \ next = M_C3(m_l1st_,name,_new)(); \ *update_list = next; \ - if (M_UNLIKELY_NOMEM (next == NULL)) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_F(name, _s))); \ /* FIXME: Partialy initialized list. What to do? */ \ return; \ @@ -550,35 +525,31 @@ } \ *update_list = NULL; \ M_L1ST_CONTRACT(list); \ - } \ + }) \ \ - static inline void \ - M_F(name, _set)(list_t list, const list_t org) \ + F(void M_F(name, _set)(list_t list, const list_t org), \ { \ if (M_UNLIKELY (list == org)) return; \ M_F(name, _clear)(list); \ M_F(name, _init_set)(list, org); \ - } \ + }) \ \ - static inline void \ - M_F(name, _init_move)(list_t list, list_t org) \ + F(void M_F(name, _init_move)(list_t list, list_t org), \ { \ M_L1ST_CONTRACT(org); \ M_ASSERT (list != NULL && list != org); \ *list = *org; \ *org = NULL; /* safer */ \ - } \ + }) \ \ - static inline void \ - M_F(name, _move)(list_t list, list_t org) \ + F(void M_F(name, _move)(list_t list, list_t org), \ { \ M_ASSERT (list != org); \ M_F(name, _clear)(list); \ M_F(name, _init_move)(list, org); \ - } \ + }) \ \ - static inline void \ - M_F(name, _splice_back)(list_t nv, list_t ov, it_t it) \ + F(void M_F(name, _splice_back)(list_t nv, list_t ov, it_t it), \ { \ M_L1ST_CONTRACT(nv); \ M_L1ST_CONTRACT(ov); \ @@ -599,11 +570,10 @@ /* Push back extracted 'current' in the list 'nv' */ \ current->next = *nv; \ *nv = current; \ - } \ + }) \ \ - static inline void \ - M_F(name, _splice_at)(list_t nlist, it_t npos, \ - list_t olist, it_t opos) \ + F(void M_F(name, _splice_at)(list_t nlist, it_t npos, \ + list_t olist, it_t opos), \ { \ M_L1ST_CONTRACT(nlist); \ M_L1ST_CONTRACT(olist); \ @@ -613,8 +583,6 @@ M_ASSERT (M_F(name, _sublist_p)(olist, opos)); \ /* Remove the item 'opos' from the list 'olist' */ \ struct M_F(name, _s) *current = opos->current; \ - /* current shall reference a valid element of the list */ \ - M_ASSERT (current != NULL); \ struct M_F(name, _s) *next = current->next; \ if (opos->previous == NULL) { \ *olist = next; \ @@ -637,10 +605,9 @@ npos->current = current; \ M_L1ST_CONTRACT(nlist); \ M_L1ST_CONTRACT(olist); \ - } \ + }) \ \ - static inline void \ - M_F(name, _splice)(list_t list1, list_t list2) \ + F(void M_F(name, _splice)(list_t list1, list_t list2), \ { \ M_L1ST_CONTRACT(list1); \ M_L1ST_CONTRACT(list2); \ @@ -653,10 +620,9 @@ } \ *update_list = *list2; \ *list2 = NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _reverse)(list_t list) \ + F(void M_F(name, _reverse)(list_t list), \ { \ M_L1ST_CONTRACT(list); \ struct M_F(name, _s) *previous = NULL, *it = *list, *next; \ @@ -667,7 +633,7 @@ it = next; \ } \ *list = previous; \ - } \ + }) \ \ M_EMPLACE_QUEUE_DEF(name, list_t, M_F(name, _emplace_back), oplist, M_L1ST_EMPLACE_DEF) @@ -676,18 +642,17 @@ which is common for all kind of lists. It shall therefore only used the public interface of a list and no contract can be checked at this level. + - F: Function Generation Macro - name: prefix to be used - type: type of the elements of the list - oplist: oplist of the type of the elements of the container - list_t: alias for M_F(name, _t) [ type of the container ] - it_t: alias for M_F(name, _it_t) [ iterator of the container ] */ -#define M_L1ST_ITBASE_DEF(name, type, oplist, list_t, it_t) \ +#define M_L1ST_DEF_ITBASE(F, name, type, oplist, list_t, it_t) \ \ M_IF_METHOD(GET_STR, oplist)( \ - static inline void \ - M_F(name, _get_str)(m_string_t str, const list_t list, \ - bool append) \ + F(void M_F(name, _get_str)(m_string_t str, const list_t list, bool append), \ { \ M_ASSERT (str != NULL && list != NULL); \ (append ? m_string_cat_cstr : m_string_set_cstr) (str, "["); \ @@ -701,12 +666,11 @@ m_string_push_back (str, M_GET_SEPARATOR oplist); \ } \ m_string_push_back (str, ']'); \ - } \ + }) \ , /* no str */ ) \ \ M_IF_METHOD(OUT_STR, oplist)( \ - static inline void \ - M_F(name, _out_str)(FILE *file, const list_t list) \ + F(void M_F(name, _out_str)(FILE *file, const list_t list), \ { \ M_ASSERT (file != NULL && list != NULL); \ fputc ('[', file); \ @@ -720,12 +684,11 @@ fputc (M_GET_SEPARATOR oplist, file); \ } \ fputc (']', file); \ - } \ + }) \ , /* no out_str */ ) \ \ M_IF_METHOD2(PARSE_STR, INIT, oplist)( \ - static inline bool \ - M_F(name, _parse_str)(list_t list, const char str[], const char **endp) \ + F(bool M_F(name, _parse_str)(list_t list, const char str[], const char **endp), \ { \ M_ASSERT (str != NULL && list != NULL); \ M_F(name,_reset)(list); \ @@ -751,12 +714,11 @@ exit: \ if (endp) *endp = str; \ return success; \ - } \ + }) \ , /* no PARSE_STR & INIT */ ) \ \ M_IF_METHOD2(IN_STR, INIT, oplist)( \ - static inline bool \ - M_F(name, _in_str)(list_t list, FILE *file) \ + F(bool M_F(name, _in_str)(list_t list, FILE *file), \ { \ M_ASSERT (file != NULL && list != NULL); \ M_F(name,_reset)(list); \ @@ -777,12 +739,11 @@ M_CALL_CLEAR(oplist, item); \ M_F(name, _reverse)(list); \ return c == ']'; \ - } \ + }) \ , /* no IN_STR & INIT */ ) \ \ M_IF_METHOD(OUT_SERIAL, oplist)( \ - static inline m_serial_return_code_t \ - M_F(name, _out_serial)(m_serial_write_t f, const list_t list) \ + F(m_serial_return_code_t M_F(name, _out_serial)(m_serial_write_t f, const list_t list), \ { \ M_ASSERT (list != NULL); \ M_ASSERT (f != NULL && f->m_interface != NULL); \ @@ -802,12 +763,11 @@ } \ ret |= f->m_interface->write_array_end(local, f); \ return ret & M_SERIAL_FAIL; \ - } \ + }) \ , /* no OUT_SERIAL */ ) \ \ M_IF_METHOD2(IN_SERIAL, INIT, oplist)( \ - static inline m_serial_return_code_t \ - M_F(name, _in_serial)(list_t list, m_serial_read_t f) \ + F(m_serial_return_code_t M_F(name, _in_serial)(list_t list, m_serial_read_t f), \ { \ M_ASSERT (list != NULL); \ M_ASSERT (f != NULL && f->m_interface != NULL); \ @@ -828,12 +788,11 @@ M_CALL_CLEAR(oplist, item); \ M_F(name, _reverse)(list); \ return ret; \ - } \ + }) \ , /* no IN_SERIAL & INIT */ ) \ \ M_IF_METHOD(EQUAL, oplist)( \ - static inline bool \ - M_F(name, _equal_p)(const list_t list1, const list_t list2) \ + F(bool M_F(name, _equal_p)(const list_t list1, const list_t list2), \ { \ M_ASSERT (list1 != NULL && list2 != NULL); \ it_t it1; \ @@ -852,12 +811,11 @@ } \ return M_F(name, _end_p)(it1) \ && M_F(name, _end_p)(it2); \ - } \ + }) \ , /* no equal */ ) \ \ M_IF_METHOD(HASH, oplist)( \ - static inline size_t \ - M_F(name, _hash)(const list_t list) \ + F(size_t M_F(name, _hash)(const list_t list), \ { \ M_ASSERT (list != NULL); \ M_HASH_DECL(hash); \ @@ -870,11 +828,12 @@ M_HASH_UP(hash, hi); \ } \ return M_HASH_FINAL (hash); \ - } \ + }) \ , /* no hash */ ) \ /* Definition of the emplace_back function for single list */ +// TODO: Support Function Generation Macro #define M_L1ST_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \ static inline void \ function_name(name_t v \ @@ -918,22 +877,30 @@ #define M_L1ST_DUAL_PUSH_DEF_P1(arg) M_ID( M_L1ST_DUAL_PUSH_DEF_P2 arg ) /* Validate the oplist before going further */ -#define M_L1ST_DUAL_PUSH_DEF_P2(name, type, oplist, list_t, it_t) \ - M_IF_OPLIST(oplist)(M_L1ST_DUAL_PUSH_DEF_P3, M_L1ST_DUAL_PUSH_DEF_FAILURE)(name, type, oplist, list_t, it_t) +#define M_L1ST_DUAL_PUSH_DEF_P2(F, name, type, oplist, list_t, it_t) \ + M_IF_OPLIST(oplist)(M_L1ST_DUAL_PUSH_DEF_P3, M_L1ST_DUAL_PUSH_DEF_FAILURE)(F, name, type, oplist, list_t, it_t) /* Stop processing with a compilation failure */ -#define M_L1ST_DUAL_PUSH_DEF_FAILURE(name, type, oplist, list_t, it_t) \ +#define M_L1ST_DUAL_PUSH_DEF_FAILURE(F, name, type, oplist, list_t, it_t) \ M_STATIC_FAILURE(M_LIB_NOT_AN_OPLIST, "(LIST_DUAL_PUSH_DEF): the given argument is not a valid oplist: " #oplist) /* Internal dual-push list definition + - F: Function Generation Macro - name: prefix to be used - type: type of the elements of the array - oplist: oplist of the type of the elements of the container - list_t: alias for M_F(name, _t) [ type of the container ] - it_t: alias for M_F(name, _it_t) [ iterator of the container ] */ -#define M_L1ST_DUAL_PUSH_DEF_P3(name, type, oplist, list_t, it_t) \ - \ +#define M_L1ST_DUAL_PUSH_DEF_P3(F, name, type, oplist, list_t, it_t) \ + M_C(F, _TYPE)(M_L1ST_DUAL_PUSH_DEF_TYPE(name, type, oplist, list_t, it_t)) \ + M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \ + M_C(F, _PRIVATE)(M_L1ST_MEMPOOL_DEF(name, type, oplist, list_t, it_t)) \ + M_L1ST_DUAL_PUSH_DEF_CORE(F, name, type, oplist, list_t, it_t) \ + M_L1ST_DEF_ITBASE(F, name, type, oplist, list_t, it_t) + + +#define M_L1ST_DUAL_PUSH_DEF_TYPE(name, type, oplist, list_t, it_t) \ /* Node of a list (it is liked the singly linked list) */ \ struct M_F(name, _s) { \ struct M_F(name, _s) *next; \ @@ -962,13 +929,6 @@ typedef list_t M_F(name, _ct); \ typedef it_t M_F(name, _it_ct); \ typedef type M_F(name, _subtype_ct); \ - \ - M_CHECK_COMPATIBLE_OPLIST(name, 1, type, oplist) \ - \ - M_L1ST_MEMPOOL_DEF(name, type, oplist, list_t, it_t) \ - M_L1ST_DUAL_PUSH_DEF_P4(name, type, oplist, list_t, it_t) \ - M_L1ST_ITBASE_DEF(name, type, oplist, list_t, it_t) - /* Define the internal contract of an dual-push list */ #define M_L1ST_DUAL_PUSH_CONTRACT(l) do { \ @@ -978,25 +938,24 @@ } while (0) /* Internal dual-push list definition + - F: Function Generation Macro - name: prefix to be used - type: type of the elements of the array - oplist: oplist of the type of the elements of the container - list_t: alias for type of the container - it_t: alias for iterator of the container */ -#define M_L1ST_DUAL_PUSH_DEF_P4(name, type, oplist, list_t, it_t) \ +#define M_L1ST_DUAL_PUSH_DEF_CORE(F, name, type, oplist, list_t, it_t) \ \ - static inline void \ - M_F(name, _init)(list_t v) \ + F(void M_F(name, _init)(list_t v), \ { \ M_ASSERT( v != NULL); \ v->front = NULL; \ v->back = NULL; \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ - } \ + }) \ \ - static inline void \ - M_F(name, _reset)(list_t v) \ + F(void M_F(name, _reset)(list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ struct M_F(name, _s) *it = v->back; \ @@ -1009,28 +968,25 @@ v->front = NULL; \ v->back = NULL; \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ - } \ + }) \ \ - static inline void \ - M_F(name, _clear)(list_t v) \ + F(void M_F(name, _clear)(list_t v), \ { \ M_F(name, _reset)(v); \ - } \ + }) \ \ - static inline type * \ - M_F(name, _back)(const list_t v) \ + F(type *M_F(name, _back)(const list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ M_ASSERT (v->back != NULL); \ return &(v->back->data); \ - } \ + }) \ \ - static inline type * \ - M_F(name, _push_back_raw)(list_t v) \ + F(type *M_F(name, _push_back_raw)(list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ struct M_F(name, _s) *next = M_C3(m_l1st_,name,_new)(); \ - if (M_UNLIKELY_NOMEM (next == NULL)) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_F(name, _s))); \ return NULL; \ } \ @@ -1044,54 +1000,48 @@ v->front = front; \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ return ret; \ - } \ + }) \ \ /* Internal, for INIT_WITH */ \ - static inline type * \ - M_F(name, _push_raw)(list_t d) \ + F(type *M_F(name, _push_raw)(list_t d), \ { \ return M_F(name, _push_back_raw)(d); \ - } \ + }) \ \ - static inline void \ - M_F(name, _push_back)(list_t v, type const x) \ + F(void M_F(name, _push_back)(list_t v, type const x), \ { \ type *data = M_F(name, _push_back_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return; \ M_CALL_INIT_SET(oplist, *data, x); \ - } \ + }) \ \ M_IF_METHOD(INIT, oplist)( \ - static inline type * \ - M_F(name, _push_back_new)(list_t v) \ + F(type *M_F(name, _push_back_new)(list_t v), \ { \ type *data = M_F(name, _push_back_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return NULL; \ M_CALL_INIT(oplist, *data); \ return data; \ - } \ + }) \ , /* No INIT */ ) \ \ - static inline void \ - M_F(name, _push_back_move)(list_t v, type *x) \ + F(void M_F(name, _push_back_move)(list_t v, type *x), \ { \ M_ASSERT (x != NULL); \ type *data = M_F(name, _push_back_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return; \ M_DO_INIT_MOVE (oplist, *data, *x); \ - } \ + }) \ \ - static inline void \ - M_F(name, _push_move)(list_t v, type *x) \ + F(void M_F(name, _push_move)(list_t v, type *x), \ { \ M_F(name, _push_back_move)(v, x); \ - } \ + }) \ \ - static inline void \ - M_F(name, _pop_back)(type *data, list_t v) \ + F(void M_F(name, _pop_back)(type *data, list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ M_ASSERT (v->back != NULL); \ @@ -1109,10 +1059,9 @@ front = (front == tofree) ? NULL : front; \ v->front = front; \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ - } \ + }) \ \ - static inline void \ - M_F(name, _pop_move)(type *data, list_t v) \ + F(void M_F(name, _pop_move)(type *data, list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ M_ASSERT (v->back != NULL); \ @@ -1127,22 +1076,20 @@ front = (front == tofree) ? NULL : front; \ v->front = front; \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ - } \ + }) \ \ - static inline type * \ - M_F(name, _front)(list_t v) \ + F(type *M_F(name, _front)(list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ M_ASSERT (v->front != NULL); \ return &(v->front->data); \ - } \ + }) \ \ - static inline type * \ - M_F(name, _push_front_raw)(list_t v) \ + F(type *M_F(name, _push_front_raw)(list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ struct M_F(name, _s) *next = M_C3(m_l1st_,name,_new)(); \ - if (M_UNLIKELY_NOMEM (next == NULL)) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_F(name, _s))); \ return NULL; \ } \ @@ -1157,127 +1104,112 @@ v->front = next; \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ return ret; \ - } \ + }) \ \ - static inline void \ - M_F(name, _push_front)(list_t v, type const x) \ + F(void M_F(name, _push_front)(list_t v, type const x), \ { \ type *data = M_F(name, _push_front_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return; \ M_CALL_INIT_SET(oplist, *data, x); \ - } \ + }) \ \ - static inline void \ - M_F(name, _push_front_move)(list_t v, type *x) \ + F(void M_F(name, _push_front_move)(list_t v, type *x), \ { \ M_ASSERT (x != NULL); \ type *data = M_F(name, _push_front_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return; \ M_DO_INIT_MOVE (oplist, *data, *x); \ - } \ + }) \ \ M_IF_METHOD(INIT, oplist)( \ - static inline type * \ - M_F(name, _push_front_new)(list_t v) \ + F(type *M_F(name, _push_front_new)(list_t v), \ { \ type *data = M_F(name, _push_back_raw)(v); \ if (M_UNLIKELY (data == NULL)) \ return NULL; \ M_CALL_INIT(oplist, *data); \ return data; \ - } \ + }) \ , /* No INIT */) \ \ - static inline bool \ - M_F(name, _empty_p)(const list_t v) \ + F(bool M_F(name, _empty_p)(const list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ return v->back == NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _swap)(list_t l, list_t v) \ + F(void M_F(name, _swap)(list_t l, list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(l); \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ M_SWAP(struct M_F(name, _s) *, l->front, v->front); \ M_SWAP(struct M_F(name, _s) *, l->back, v->back); \ - } \ + }) \ \ - static inline void \ - M_F(name, _it)(it_t it, const list_t v) \ + F(void M_F(name, _it)(it_t it, const list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ M_ASSERT (it != NULL); \ it->current = v->back; \ it->previous = NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _it_set)(it_t it1, const it_t it2) \ + F(void M_F(name, _it_set)(it_t it1, const it_t it2), \ { \ M_ASSERT (it1 != NULL && it2 != NULL); \ it1->current = it2->current; \ it1->previous = it2->previous; \ - } \ + }) \ \ - static inline void \ - M_F(name, _it_end)(it_t it1, const list_t v) \ + F(void M_F(name, _it_end)(it_t it1, const list_t v), \ { \ M_ASSERT (it1 != NULL); \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ (void)v; /* unused */ \ it1->current = NULL; \ it1->previous = NULL; \ - } \ + }) \ \ - static inline bool \ - M_F(name, _end_p)(const it_t it) \ + F(bool M_F(name, _end_p)(const it_t it), \ { \ M_ASSERT (it != NULL); \ return it->current == NULL; \ - } \ + }) \ \ - static inline bool \ - M_F(name, _last_p)(const it_t it) \ + F(bool M_F(name, _last_p)(const it_t it), \ { \ M_ASSERT (it != NULL); \ return it->current == NULL || it->current->next == NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _next)(it_t it) \ + F(void M_F(name, _next)(it_t it), \ { \ M_ASSERT(it != NULL && it->current != NULL); \ it->previous = it->current; \ it->current = it->current->next; \ - } \ + }) \ \ - static inline bool \ - M_F(name, _it_equal_p)(const it_t it1, const it_t it2) \ + F(bool M_F(name, _it_equal_p)(const it_t it1, const it_t it2), \ { \ M_ASSERT(it1 != NULL && it2 != NULL); \ return it1->current == it2->current; \ - } \ + }) \ \ - static inline type * \ - M_F(name, _ref)(const it_t it) \ + F(type *M_F(name, _ref)(const it_t it), \ { \ M_ASSERT(it != NULL && it->current != NULL); \ return &(it->current->data); \ - } \ + }) \ \ - static inline type const * \ - M_F(name, _cref)(const it_t it) \ + F(type const *M_F(name, _cref)(const it_t it), \ { \ M_ASSERT(it != NULL && it->current != NULL); \ return M_CONST_CAST(type, &(it->current->data)); \ - } \ + }) \ \ - static inline size_t \ - M_F(name, _size)(const list_t v) \ + F(size_t M_F(name, _size)(const list_t v), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(v); \ size_t size = 0; \ @@ -1287,16 +1219,14 @@ it = it->next; \ } \ return size; \ - } \ + }) \ \ - static inline void \ - M_F(name, _insert)(list_t list, it_t insertion_point, \ - type const x) \ + F(void M_F(name, _insert)(list_t list, it_t insertion_point, type const x), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(list); \ M_ASSERT (insertion_point != NULL); \ struct M_F(name, _s) *next = M_C3(m_l1st_,name,_new)(); \ - if (M_UNLIKELY_NOMEM (next == NULL)) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_F(name, _s))); \ return; \ } \ @@ -1316,10 +1246,9 @@ front = (front == insertion_point->current) ? next : front; \ list->front = front; \ } \ - } \ + }) \ \ - static inline void \ - M_F(name, _remove)(list_t list, it_t removing_point) \ + F(void M_F(name, _remove)(list_t list, it_t removing_point), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(list); \ M_ASSERT (removing_point != NULL); \ @@ -1339,10 +1268,9 @@ M_CALL_CLEAR(oplist, removing_point->current->data); \ M_C3(m_l1st_,name,_del) (removing_point->current); \ removing_point->current = next; \ - } \ + }) \ \ - static inline void \ - M_F(name, _set)(list_t list, const list_t org) \ + F(void M_F(name, _set)(list_t list, const list_t org), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(list); \ M_L1ST_DUAL_PUSH_CONTRACT(org); \ @@ -1356,7 +1284,7 @@ while (it_org != NULL) { \ next = M_C3(m_l1st_,name,_new)(); \ *update_list = next; \ - if (M_UNLIKELY_NOMEM (next == NULL)) { \ + if (M_UNLIKELY (next == NULL)) { \ M_MEMORY_FULL(sizeof (struct M_F(name, _s))); \ return; \ } \ @@ -1366,35 +1294,31 @@ } \ list->front = next; \ *update_list = NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _init_set)(list_t list, const list_t org) \ + F(void M_F(name, _init_set)(list_t list, const list_t org), \ { \ M_ASSERT (list != org); \ M_F(name, _init)(list); \ M_F(name, _set)(list, org); \ - } \ + }) \ \ - static inline void \ - M_F(name, _init_move)(list_t list, list_t org) \ + F(void M_F(name, _init_move)(list_t list, list_t org), \ { \ M_ASSERT (list != org); \ list->back = org->back; \ list->front = org->front; \ org->back = NULL; \ org->front = NULL; \ - } \ + }) \ \ - static inline void \ - M_F(name, _move)(list_t list, list_t org) \ + F(void M_F(name, _move)(list_t list, list_t org), \ { \ M_F(name, _clear)(list); \ M_F(name, _init_move)(list, org); \ - } \ + }) \ \ - static inline void \ - M_F(name, _splice_back)(list_t list1, list_t list2, it_t it) \ + F(void M_F(name, _splice_back)(list_t list1, list_t list2, it_t it), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(list1); \ M_L1ST_DUAL_PUSH_CONTRACT(list2); \ @@ -1423,19 +1347,15 @@ list1->front = front; \ M_L1ST_DUAL_PUSH_CONTRACT(list1); \ M_L1ST_DUAL_PUSH_CONTRACT(list2); \ - } \ + }) \ \ - static inline void \ - M_F(name, _splice_at)(list_t nlist, it_t npos, \ - list_t olist, it_t opos) \ + F(void M_F(name, _splice_at)(list_t nlist, it_t npos, list_t olist, it_t opos), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(nlist); \ M_L1ST_DUAL_PUSH_CONTRACT(olist); \ M_ASSERT (npos != NULL && opos != NULL); \ /* First remove the item 'opos' from the list 'olist' */ \ struct M_F(name, _s) *current = opos->current; \ - /* It shall refer a valid argument in the list */ \ - M_ASSERT(current != NULL); \ struct M_F(name, _s) *next = current->next; \ if (opos->previous == NULL) { \ olist->back = next; \ @@ -1471,10 +1391,9 @@ npos->current = current; \ M_L1ST_DUAL_PUSH_CONTRACT(nlist); \ M_L1ST_DUAL_PUSH_CONTRACT(olist); \ - } \ + }) \ \ - static inline void \ - M_F(name, _splice)(list_t list1, list_t list2) \ + F(void M_F(name, _splice)(list_t list1, list_t list2), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(list1); \ M_L1ST_DUAL_PUSH_CONTRACT(list2); \ @@ -1491,10 +1410,9 @@ list2->front = NULL; \ M_L1ST_DUAL_PUSH_CONTRACT(list1); \ M_L1ST_DUAL_PUSH_CONTRACT(list2); \ - } \ + }) \ \ - static inline void \ - M_F(name, _reverse)(list_t list) \ + F(void M_F(name, _reverse)(list_t list), \ { \ M_L1ST_DUAL_PUSH_CONTRACT(list); \ list->front = list->back; \ @@ -1507,16 +1425,16 @@ } \ list->back = previous; \ M_L1ST_DUAL_PUSH_CONTRACT(list); \ - } \ + }) \ \ M_EMPLACE_QUEUE_DEF(name, list_t, M_F(name, _emplace_back), oplist, M_L1ST_EMPLACE_BACK_DEF) \ M_EMPLACE_QUEUE_DEF(name, list_t, M_F(name, _emplace_front), oplist, M_L1ST_EMPLACE_FRONT_DEF) #if M_USE_SMALL_NAME #define LIST_DEF M_LIST_DEF -#define LIST_DEF_AS M_LIST_DEF_AS +#define LIST_DEF_AS(...) M_LIST_DEF_AS(INLINE, __VA_ARGS__) #define LIST_DUAL_PUSH_DEF M_LIST_DUAL_PUSH_DEF -#define LIST_DUAL_PUSH_DEF_AS M_LIST_DUAL_PUSH_DEF_AS +#define LIST_DUAL_PUSH_DEF_AS(...) M_LIST_DUAL_PUSH_DEF_AS(INLINE, __VA_ARGS__) #define LIST_OPLIST M_LIST_OPLIST #define LIST_INIT_VALUE M_LIST_INIT_VALUE #define LIST_DUAL_PUSH_INIT_VALUE M_LIST_DUAL_PUSH_INIT_VALUE