Cleanup output format warnings (#904)

Use `PRIxxx` related macros to format the output strings so as to clear
compile warnings, e.g. PRIu32, PRId32, PRIX32, PRIX64 and so on.
And add the related macro definitions in platform_common.h if they
are not defined, as some compilers might not support them.
This commit is contained in:
Huang Qi
2021-12-20 15:51:36 +08:00
committed by GitHub
parent a41c1ad85c
commit 4cc4625a2b
9 changed files with 74 additions and 26 deletions

View File

@ -769,7 +769,7 @@ exit_wrapper(wasm_exec_env_t exec_env, int32 status)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.exit(%i)", status);
snprintf(buf, sizeof(buf), "env.exit(%" PRId32 ")", status);
wasm_runtime_set_exception(module_inst, buf);
}
@ -1012,7 +1012,7 @@ abort_wrapper(wasm_exec_env_t exec_env, int32 code)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.abort(%i)", code);
snprintf(buf, sizeof(buf), "env.abort(%" PRId32 ")", code);
wasm_runtime_set_exception(module_inst, buf);
}
@ -1021,7 +1021,7 @@ abortStackOverflow_wrapper(wasm_exec_env_t exec_env, int32 code)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.abortStackOverflow(%i)", code);
snprintf(buf, sizeof(buf), "env.abortStackOverflow(%" PRId32 ")", code);
wasm_runtime_set_exception(module_inst, buf);
}
@ -1030,7 +1030,7 @@ nullFunc_X_wrapper(wasm_exec_env_t exec_env, int32 code)
{
wasm_module_inst_t module_inst = get_module_inst(exec_env);
char buf[32];
snprintf(buf, sizeof(buf), "env.nullFunc_X(%i)", code);
snprintf(buf, sizeof(buf), "env.nullFunc_X(%" PRId32 ")", code);
wasm_runtime_set_exception(module_inst, buf);
}