Fix internal & subtil issue
when comparing two methods to check for their presence in an oplist, we may generate the name of an already existing macro. For example, in the oplist (SIZE()) when we expanded we get the macro M_ADD_SIZE to check if ADD is present, but M_ADD_SIZE is an already existing macro, which generates an error. To avoid this issue, define a prefix for the definition of the operators (M_X)
This commit is contained in:
1 parent
e7e29d913e
commit
0a8e336037
1 file changed
+81
-81
@@ -3370,88 +3370,88 @@ M_INLINE size_t m_core_cstr_hash(const char str[])
|
||||
|
||||
/* Helper internal macros to make M_GET_METHOD works.
|
||||
List of supported methods for an oplist */
|
||||
#define M_INIT_INIT(a) ,a,
|
||||
#define M_INIT_SET_INIT_SET(a) ,a,
|
||||
#define M_INIT_MOVE_INIT_MOVE(a) ,a,
|
||||
#define M_INIT_WITH_INIT_WITH(a) ,a,
|
||||
#define M_SWAP_SWAP(a) ,a,
|
||||
#define M_SET_SET(a) ,a,
|
||||
#define M_MOVE_MOVE(a) ,a,
|
||||
#define M_CLEAR_CLEAR(a) ,a,
|
||||
#define M_HASH_HASH(a) ,a,
|
||||
#define M_EQUAL_EQUAL(a) ,a,
|
||||
#define M_CMP_CMP(a) ,a,
|
||||
#define M_TYPE_TYPE(a) ,a,
|
||||
#define M_SUBTYPE_SUBTYPE(a) ,a,
|
||||
#define M_GENTYPE_GENTYPE(a) ,a,
|
||||
#define M_SUBTYPE_PTR_SUBTYPE_PTR(a) ,a,
|
||||
#define M_NAME_NAME(a) ,a,
|
||||
#define M_FIELD_FIELD(a) ,a,
|
||||
#define M_OPLIST_OPLIST(a) ,a,
|
||||
#define M_SORT_SORT(a) ,a,
|
||||
#define M_SPLICE_BACK_SPLICE_BACK(a) ,a,
|
||||
#define M_SPLICE_AT_SPLICE_AT(a) ,a,
|
||||
#define M_IT_TYPE_IT_TYPE(a) ,a,
|
||||
#define M_IT_FIRST_IT_FIRST(a) ,a,
|
||||
#define M_IT_LAST_IT_LAST(a) ,a,
|
||||
#define M_IT_END_IT_END(a) ,a,
|
||||
#define M_IT_SET_IT_SET(a) ,a,
|
||||
#define M_IT_END_P_IT_END_P(a) ,a,
|
||||
#define M_IT_LAST_P_IT_LAST_P(a) ,a,
|
||||
#define M_IT_EQUAL_P_IT_EQUAL_P(a) ,a,
|
||||
#define M_IT_NEXT_IT_NEXT(a) ,a,
|
||||
#define M_IT_PREVIOUS_IT_PREVIOUS(a) ,a,
|
||||
#define M_IT_REF_IT_REF(a) ,a,
|
||||
#define M_IT_CREF_IT_CREF(a) ,a,
|
||||
#define M_IT_REMOVE_IT_REMOVE(a) ,a,
|
||||
#define M_IT_INSERT_IT_INSERT(a) ,a,
|
||||
#define M_EMPTY_P_EMPTY_P(a) ,a,
|
||||
#define M_ADD_ADD(a) ,a,
|
||||
#define M_SUB_SUB(a) ,a,
|
||||
#define M_MUL_MUL(a) ,a,
|
||||
#define M_DIV_DIV(a) ,a,
|
||||
#define M_RESET_RESET(a) ,a,
|
||||
#define M_KEY_TYPE_KEY_TYPE(a) ,a,
|
||||
#define M_VALUE_TYPE_VALUE_TYPE(a) ,a,
|
||||
#define M_KEY_OPLIST_KEY_OPLIST(a) ,a,
|
||||
#define M_VALUE_OPLIST_VALUE_OPLIST(a) ,a,
|
||||
#define M_GET_KEY_GET_KEY(a) ,a,
|
||||
#define M_SET_KEY_SET_KEY(a) ,a,
|
||||
#define M_SAFE_GET_KEY_SAFE_GET_KEY(a) ,a,
|
||||
#define M_ERASE_KEY_ERASE_KEY(a) ,a,
|
||||
#define M_GET_SIZE_GET_SIZE(a) ,a,
|
||||
#define M_PUSH_PUSH(a) ,a,
|
||||
#define M_POP_POP(a) ,a,
|
||||
#define M_PUSH_MOVE_PUSH_MOVE(a) ,a,
|
||||
#define M_POP_MOVE_POP_MOVE(a) ,a,
|
||||
#define M_REVERSE_REVERSE(a) ,a,
|
||||
#define M_GET_STR_GET_STR(a) ,a,
|
||||
#define M_PARSE_STR_PARSE_STR(a) ,a,
|
||||
#define M_OUT_STR_OUT_STR(a) ,a,
|
||||
#define M_IN_STR_IN_STR(a) ,a,
|
||||
#define M_OUT_SERIAL_OUT_SERIAL(a) ,a,
|
||||
#define M_IN_SERIAL_IN_SERIAL(a) ,a,
|
||||
#define M_SEPARATOR_SEPARATOR(a) ,a,
|
||||
#define M_EXT_ALGO_EXT_ALGO(a) ,a,
|
||||
#define M_INC_ALLOC_INC_ALLOC(a) ,a,
|
||||
#define M_OOR_SET_OOR_SET(a) ,a,
|
||||
#define M_OOR_EQUAL_OOR_EQUAL(a) ,a,
|
||||
#define M_LIMITS_LIMITS(a) ,a,
|
||||
#define M_PROPERTIES_PROPERTIES(a) ,a,
|
||||
#define M_EMPLACE_TYPE_EMPLACE_TYPE(a) ,a,
|
||||
#define M_X_INIT_INIT(a) ,a,
|
||||
#define M_X_INIT_SET_INIT_SET(a) ,a,
|
||||
#define M_X_INIT_MOVE_INIT_MOVE(a) ,a,
|
||||
#define M_X_INIT_WITH_INIT_WITH(a) ,a,
|
||||
#define M_X_SWAP_SWAP(a) ,a,
|
||||
#define M_X_SET_SET(a) ,a,
|
||||
#define M_X_MOVE_MOVE(a) ,a,
|
||||
#define M_X_CLEAR_CLEAR(a) ,a,
|
||||
#define M_X_HASH_HASH(a) ,a,
|
||||
#define M_X_EQUAL_EQUAL(a) ,a,
|
||||
#define M_X_CMP_CMP(a) ,a,
|
||||
#define M_X_TYPE_TYPE(a) ,a,
|
||||
#define M_X_SUBTYPE_SUBTYPE(a) ,a,
|
||||
#define M_X_GENTYPE_GENTYPE(a) ,a,
|
||||
#define M_X_SUBTYPE_PTR_SUBTYPE_PTR(a) ,a,
|
||||
#define M_X_NAME_NAME(a) ,a,
|
||||
#define M_X_FIELD_FIELD(a) ,a,
|
||||
#define M_X_OPLIST_OPLIST(a) ,a,
|
||||
#define M_X_SORT_SORT(a) ,a,
|
||||
#define M_X_SPLICE_BACK_SPLICE_BACK(a) ,a,
|
||||
#define M_X_SPLICE_AT_SPLICE_AT(a) ,a,
|
||||
#define M_X_IT_TYPE_IT_TYPE(a) ,a,
|
||||
#define M_X_IT_FIRST_IT_FIRST(a) ,a,
|
||||
#define M_X_IT_LAST_IT_LAST(a) ,a,
|
||||
#define M_X_IT_END_IT_END(a) ,a,
|
||||
#define M_X_IT_SET_IT_SET(a) ,a,
|
||||
#define M_X_IT_END_P_IT_END_P(a) ,a,
|
||||
#define M_X_IT_LAST_P_IT_LAST_P(a) ,a,
|
||||
#define M_X_IT_EQUAL_P_IT_EQUAL_P(a) ,a,
|
||||
#define M_X_IT_NEXT_IT_NEXT(a) ,a,
|
||||
#define M_X_IT_PREVIOUS_IT_PREVIOUS(a) ,a,
|
||||
#define M_X_IT_REF_IT_REF(a) ,a,
|
||||
#define M_X_IT_CREF_IT_CREF(a) ,a,
|
||||
#define M_X_IT_REMOVE_IT_REMOVE(a) ,a,
|
||||
#define M_X_IT_INSERT_IT_INSERT(a) ,a,
|
||||
#define M_X_EMPTY_P_EMPTY_P(a) ,a,
|
||||
#define M_X_ADD_ADD(a) ,a,
|
||||
#define M_X_SUB_SUB(a) ,a,
|
||||
#define M_X_MUL_MUL(a) ,a,
|
||||
#define M_X_DIV_DIV(a) ,a,
|
||||
#define M_X_RESET_RESET(a) ,a,
|
||||
#define M_X_KEY_TYPE_KEY_TYPE(a) ,a,
|
||||
#define M_X_VALUE_TYPE_VALUE_TYPE(a) ,a,
|
||||
#define M_X_KEY_OPLIST_KEY_OPLIST(a) ,a,
|
||||
#define M_X_VALUE_OPLIST_VALUE_OPLIST(a) ,a,
|
||||
#define M_X_GET_KEY_GET_KEY(a) ,a,
|
||||
#define M_X_SET_KEY_SET_KEY(a) ,a,
|
||||
#define M_X_SAFE_GET_KEY_SAFE_GET_KEY(a) ,a,
|
||||
#define M_X_ERASE_KEY_ERASE_KEY(a) ,a,
|
||||
#define M_X_GET_SIZE_GET_SIZE(a) ,a,
|
||||
#define M_X_PUSH_PUSH(a) ,a,
|
||||
#define M_X_POP_POP(a) ,a,
|
||||
#define M_X_PUSH_MOVE_PUSH_MOVE(a) ,a,
|
||||
#define M_X_POP_MOVE_POP_MOVE(a) ,a,
|
||||
#define M_X_REVERSE_REVERSE(a) ,a,
|
||||
#define M_X_GET_STR_GET_STR(a) ,a,
|
||||
#define M_X_PARSE_STR_PARSE_STR(a) ,a,
|
||||
#define M_X_OUT_STR_OUT_STR(a) ,a,
|
||||
#define M_X_IN_STR_IN_STR(a) ,a,
|
||||
#define M_X_OUT_SERIAL_OUT_SERIAL(a) ,a,
|
||||
#define M_X_IN_SERIAL_IN_SERIAL(a) ,a,
|
||||
#define M_X_SEPARATOR_SEPARATOR(a) ,a,
|
||||
#define M_X_EXT_ALGO_EXT_ALGO(a) ,a,
|
||||
#define M_X_INC_ALLOC_INC_ALLOC(a) ,a,
|
||||
#define M_X_OOR_SET_OOR_SET(a) ,a,
|
||||
#define M_X_OOR_EQUAL_OOR_EQUAL(a) ,a,
|
||||
#define M_X_LIMITS_LIMITS(a) ,a,
|
||||
#define M_X_PROPERTIES_PROPERTIES(a) ,a,
|
||||
#define M_X_EMPLACE_TYPE_EMPLACE_TYPE(a) ,a,
|
||||
// As attribute customization
|
||||
#define M_NEW_NEW(a) ,a,
|
||||
#define M_DEL_DEL(a) ,a,
|
||||
#define M_REALLOC_REALLOC(a) ,a,
|
||||
#define M_FREE_FREE(a) ,a,
|
||||
#define M_MEMPOOL_MEMPOOL(a) ,a,
|
||||
#define M_MEMPOOL_LINKAGE_MEMPOOL_LINKAGE(a) ,a,
|
||||
#define M_SIZE_SIZE(a) ,a,
|
||||
#define M_CONTEXT_CONTEXT(a) ,a,
|
||||
#define M_POLICY_POLICY(a) ,a,
|
||||
#define M_X_NEW_NEW(a) ,a,
|
||||
#define M_X_DEL_DEL(a) ,a,
|
||||
#define M_X_REALLOC_REALLOC(a) ,a,
|
||||
#define M_X_FREE_FREE(a) ,a,
|
||||
#define M_X_MEMPOOL_MEMPOOL(a) ,a,
|
||||
#define M_X_MEMPOOL_LINKAGE_MEMPOOL_LINKAGE(a) ,a,
|
||||
#define M_X_SIZE_SIZE(a) ,a,
|
||||
#define M_X_CONTEXT_CONTEXT(a) ,a,
|
||||
#define M_X_POLICY_POLICY(a) ,a,
|
||||
// As properties only
|
||||
#define M_LET_AS_INIT_WITH_LET_AS_INIT_WITH(a) ,a,
|
||||
#define M_NOCLEAR_NOCLEAR(a) ,a,
|
||||
#define M_X_LET_AS_INIT_WITH_LET_AS_INIT_WITH(a) ,a,
|
||||
#define M_X_NOCLEAR_NOCLEAR(a) ,a,
|
||||
|
||||
/* From an oplist - an unorded list of methods : like "INIT(mpz_init),CLEAR(mpz_clear),SET(mpz_set)" -
|
||||
Return the given method in the oplist or the default method.
|
||||
@@ -3459,7 +3459,7 @@ M_INLINE size_t m_core_cstr_hash(const char str[])
|
||||
M_GET_METHOD(INIT, my_default, INIT(mpz_init),CLEAR(mpz_clear),SET(mpz_set)) --> mpz_init
|
||||
M_GET_METHOD(INIT, my_default, CLEAR(mpz_clear),SET(mpz_set)) --> my_default */
|
||||
#define M_GET_METHOD(method, method_default, ...) \
|
||||
M_RET_ARG2 (M_MAP2B(M_C, M_C3(M_, method, _), __VA_ARGS__), method_default,)
|
||||
M_RET_ARG2 (M_MAP2B(M_C, M_C3(M_X_, method, _), __VA_ARGS__), method_default,)
|
||||
|
||||
/* Get the given method */
|
||||
#define M_GET_INIT(...) M_GET_METHOD(INIT, M_INIT_DEFAULT, __VA_ARGS__)
|
||||
|
||||
Reference in new issue
Block a user