Issue in generation of functions:

if the method in the oplist uses API_* transformation,
if this method is a macro itself,
it may delay the expansion too much and
the macro may not be expanded at all in the final code generation.

Fix issue by adding a supplementary evaluation in the macro expansion.
Add test cases
This commit is contained in:
Patrick Pelissier committed 2022-05-06 01:10:31 +02:00
1 parent c3df69d011
commit 95b104ee48
17 files changed
+42 -29

No files matched your search

+5 -1
View File
@@ -163,11 +163,15 @@ static inline void testobj_str(string_t str, const testobj_t z, bool append)
else string_printf (str, "%u", z->ptr[0]);
}
// Go through a macro that forward to the right function.
// This enables testing good macro expansion in OPLIST usage
#define testobj_clear_indirect(op, x) testobj_clear(x)
#define TESTOBJ_OPLIST \
(INIT(testobj_init), \
INIT_SET(testobj_init_set), \
SET(testobj_set), \
CLEAR(testobj_clear), \
CLEAR(API_1(testobj_clear_indirect)), \
TYPE(testobj_t), \
OUT_STR(testobj_out_str), \
IN_STR(testobj_in_str), \