From 7ec77598dd5c62eafdbe03eca883bc42781f097e Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sun, 11 Jun 2023 11:30:25 +0800 Subject: [PATCH] Fix format warning by PRIu32 in [wasm|aot] dump call stack (#2251) --- .gitignore | 1 + core/iwasm/aot/aot_runtime.c | 10 ++++++---- core/iwasm/interpreter/wasm_runtime.c | 10 ++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index a4889fb7f..99f1a502e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .cache +.clangd .vs .vscode .venv diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index ca0a4ff1d..0a9c6144d 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -2797,12 +2797,14 @@ aot_dump_call_stack(WASMExecEnv *exec_env, bool print, char *buf, uint32 len) /* function name not exported, print number instead */ if (frame.func_name_wp == NULL) { - line_length = snprintf(line_buf, sizeof(line_buf), "#%02d $f%d\n", - n, frame.func_index); + line_length = + snprintf(line_buf, sizeof(line_buf), + "#%02" PRIu32 " $f%" PRIu32 "\n", n, frame.func_index); } else { - line_length = snprintf(line_buf, sizeof(line_buf), "#%02d %s\n", n, - frame.func_name_wp); + line_length = + snprintf(line_buf, sizeof(line_buf), "#%02" PRIu32 " %s\n", n, + frame.func_name_wp); } if (line_length >= sizeof(line_buf)) { diff --git a/core/iwasm/interpreter/wasm_runtime.c b/core/iwasm/interpreter/wasm_runtime.c index 29365024d..ef0128dbe 100644 --- a/core/iwasm/interpreter/wasm_runtime.c +++ b/core/iwasm/interpreter/wasm_runtime.c @@ -3048,12 +3048,14 @@ wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env, bool print, char *buf, /* function name not exported, print number instead */ if (frame.func_name_wp == NULL) { - line_length = snprintf(line_buf, sizeof(line_buf), "#%02d $f%d\n", - n, frame.func_index); + line_length = + snprintf(line_buf, sizeof(line_buf), + "#%02" PRIu32 " $f%" PRIu32 "\n", n, frame.func_index); } else { - line_length = snprintf(line_buf, sizeof(line_buf), "#%02d %s\n", n, - frame.func_name_wp); + line_length = + snprintf(line_buf, sizeof(line_buf), "#%02" PRIu32 " %s\n", n, + frame.func_name_wp); } if (line_length >= sizeof(line_buf)) {