cpp test fix

extensions
Steven Massey 4 years ago
parent c45fecf107
commit e673b5fa15

@ -7,9 +7,9 @@ int sum(int a, int b)
return a + b; return a + b;
} }
void ext_memcpy(void* dst, const void* arg, int64_t size) void * ext_memcpy (void* dst, const void* arg, int32_t size)
{ {
memcpy(dst, arg, (size_t) size); return memcpy(dst, arg, (size_t) size);
} }
int main(void) int main(void)

@ -8,6 +8,7 @@
#include "m3_exec.h" #include "m3_exec.h"
#include "m3_env.h" #include "m3_env.h"
#include "m3_exception.h" #include "m3_exception.h"
#include "m3_info.h"
u8 ConvertTypeCharToTypeId (char i_code) u8 ConvertTypeCharToTypeId (char i_code)
@ -81,6 +82,8 @@ _ (AllocFuncType (& funcType, (u32) maxNumArgs));
// M3FuncType doesn't speak 'void' // M3FuncType doesn't speak 'void'
if (type == c_m3Type_void) if (type == c_m3Type_void)
type = c_m3Type_none; type = c_m3Type_none;
if (type == c_m3Type_ptr)
type = c_m3Type_i32;
funcType->returnType = type; funcType->returnType = type;
} }
@ -121,7 +124,12 @@ M3Result ValidateSignature (IM3Function i_function, ccstr_t i_linkingSignature
_ (SignatureToFuncType (& ftype, i_linkingSignature)); _ (SignatureToFuncType (& ftype, i_linkingSignature));
if (not AreFuncTypesEqual (ftype, i_function->funcType)) if (not AreFuncTypesEqual (ftype, i_function->funcType))
{
m3log (module, "expected: %s", SPrintFuncTypeSignature (ftype));
m3log (module, " found: %s", SPrintFuncTypeSignature (i_function->funcType));
_throw ("function signature mismatch"); _throw ("function signature mismatch");
}
_catch: _catch:

@ -82,7 +82,7 @@ _ (ReadLEB_u7 /* u1 in spec */ (& returnCount, & i_bytes, i_end));
i8 returnType; i8 returnType;
_ (ReadLEB_i7 (& returnType, & i_bytes, i_end)); _ (ReadLEB_i7 (& returnType, & i_bytes, i_end));
_ (NormalizeType (& ftype->returnType, returnType)); _ (NormalizeType (& ftype->returnType, returnType));
} m3log (parse, " type %2d: %s", i, SPrintFuncTypeSignature (& ftype)); } m3log (parse, " type %2d: %s", i, SPrintFuncTypeSignature (ftype));
Environment_AddFuncType (io_module->environment, & ftype); Environment_AddFuncType (io_module->environment, & ftype);
io_module->funcTypes [i] = ftype; io_module->funcTypes [i] = ftype;

Loading…
Cancel
Save