22#include <stddef.h>
33#include <stdint.h>
44
5+ #include "platform.h"
6+
57int read_u8 (const uint8_t * * pp , const uint8_t * ep , uint8_t * resultp );
68int read_u32 (const uint8_t * * pp , const uint8_t * ep , uint32_t * resultp );
79int read_u64 (const uint8_t * * pp , const uint8_t * ep , uint64_t * resultp );
@@ -21,14 +23,21 @@ int read_vec_with_ctx(const uint8_t **pp, const uint8_t *ep, size_t elem_size,
2123 void (* clear_elem )(void * elem ), void * ctx ,
2224 uint32_t * countp , void * * resultp );
2325
26+ #if defined(toywasm_typeof )
2427/* a version with non-standard checks */
2528#define read_vec_with_ctx2 (pp , ep , elem_size , read_elem , clear_elem , ctx , \
2629 countp , resultp ) \
2730 ({ \
2831 int (*_r)(const uint8_t **, const uint8_t *, uint32_t, \
29- __typeof__ (*resultp), void *) = read_elem; \
30- void (*_c)(__typeof__ (*resultp)) = clear_elem; \
32+ toywasm_typeof (*resultp), void *) = read_elem; \
33+ void (*_c)(toywasm_typeof (*resultp)) = clear_elem; \
3134 assert(sizeof(**resultp) == elem_size); \
3235 read_vec_with_ctx(pp, ep, elem_size, (void *)_r, (void *)_c, \
3336 ctx, countp, (void **)resultp); \
3437 })
38+ #else
39+ #define read_vec_with_ctx2 (pp , ep , elem_size , read_elem , clear_elem , ctx , \
40+ countp , resultp ) \
41+ read_vec_with_ctx(pp, ep, elem_size, (void *)read_elem, \
42+ (void *)clear_elem, ctx, countp, (void **)resultp)
43+ #endif
0 commit comments