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:
1 parent
c3df69d011
commit
95b104ee48
17 files changed
+42
-29
No files matched your search
@@ -53,6 +53,11 @@ QUEUE_SPSC_DEF_AS(BufferDouble3, BufferDouble3, double, BUFFER_QUEUE)
|
||||
#define M_OPL_BufferDouble2() BUFFER_OPLIST(BufferDouble2, M_BASIC_OPLIST)
|
||||
#define M_OPL_BufferDouble3() BUFFER_OPLIST(BufferDouble3, M_BASIC_OPLIST)
|
||||
|
||||
// Define buffer with ENUM oplist (with API_1 usage)
|
||||
typedef enum { OK, KO } state_t;
|
||||
#define M_OPL_state_t() M_ENUM_OPLIST(state_t, OK)
|
||||
BUFFER_DEF(array_state, state_t, M_BUFFER_QUEUE, 0)
|
||||
|
||||
buffer_uint_t g_buff;
|
||||
buffer_uint_t g_buffB;
|
||||
|
||||
|
||||
+5
-1
@@ -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), \
|
||||
|
||||
Reference in new issue
Block a user