From 34d2bd05db00e8a7fca2b05f00c789a54011c91b Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 09:35:37 +0800 Subject: [PATCH 1/9] Fix some waring and enable Werror for NuttX Signed-off-by: Huang Qi --- .github/workflows/compilation_on_nuttx.yml | 2 +- core/iwasm/common/wasm_application.c | 2 +- core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c | 4 ++-- product-mini/platforms/posix/main.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compilation_on_nuttx.yml b/.github/workflows/compilation_on_nuttx.yml index 15758a32b7..8864491d43 100644 --- a/.github/workflows/compilation_on_nuttx.yml +++ b/.github/workflows/compilation_on_nuttx.yml @@ -123,4 +123,4 @@ jobs: run: | cd nuttx tools/configure.sh ${{ matrix.nuttx_board_config }} - make -j$(nproc) + make -j$(nproc) EXTRAFLAGS=-Werror diff --git a/core/iwasm/common/wasm_application.c b/core/iwasm/common/wasm_application.c index 8a19de8ee5..8445652f64 100644 --- a/core/iwasm/common/wasm_application.c +++ b/core/iwasm/common/wasm_application.c @@ -555,7 +555,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name, case VALUE_TYPE_FUNCREF: { if (argv1[k] != NULL_REF) - os_printf("%u:ref.func", argv1[k]); + os_printf("%" PRIu32 ":ref.func", argv1[k]); else os_printf("func:ref.null"); k++; diff --git a/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c b/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c index c24f789adc..55916deb46 100644 --- a/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c +++ b/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c @@ -952,13 +952,13 @@ print_wrapper(wasm_exec_env_t exec_env) static void print_i32_wrapper(wasm_exec_env_t exec_env, int32 i32) { - os_printf("in specttest.print_i32(%d)\n", i32); + os_printf("in specttest.print_i32(%" PRId32 ")\n", i32); } static void print_i32_f32_wrapper(wasm_exec_env_t exec_env, int32 i32, float f32) { - os_printf("in specttest.print_i32_f32(%d, %f)\n", i32, f32); + os_printf("in specttest.print_i32_f32(%" PRId32 ", %f)\n", i32, f32); } static void diff --git a/product-mini/platforms/posix/main.c b/product-mini/platforms/posix/main.c index 147e73866e..a0b3560b5a 100644 --- a/product-mini/platforms/posix/main.c +++ b/product-mini/platforms/posix/main.c @@ -78,7 +78,7 @@ print_help() } /* clang-format on */ -static void * +static const void * app_instance_main(wasm_module_inst_t module_inst) { const char *exception; @@ -89,7 +89,7 @@ app_instance_main(wasm_module_inst_t module_inst) return exception; } -static void * +static const void * app_instance_func(wasm_module_inst_t module_inst, const char *func_name) { wasm_application_execute_func(module_inst, func_name, app_argc - 1, From 4bdb9e288ea769ced7fc2f140c732161dab985f9 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 09:41:12 +0800 Subject: [PATCH 2/9] Fix warning in bh_log.c Signed-off-by: Huang Qi --- core/shared/utils/bh_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/shared/utils/bh_log.c b/core/shared/utils/bh_log.c index 5e3a5b0f44..759e102f25 100644 --- a/core/shared/utils/bh_log.c +++ b/core/shared/utils/bh_log.c @@ -102,6 +102,6 @@ void bh_log_proc_mem(const char *function, uint32 line) { char prompt[128] = { 0 }; - snprintf(prompt, sizeof(prompt), "[MEM] %s(...) L%u", function, line); + snprintf(prompt, sizeof(prompt), "[MEM] %s(...) L%"PRIu32, function, line); return bh_print_proc_mem(prompt); } \ No newline at end of file From c6cf7aae0c0d487ebbffecbe63698f1aeb7ea069 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 10:48:36 +0800 Subject: [PATCH 3/9] Fix warning in wasm_interp_classic.c Signed-off-by: Huang Qi --- .github/workflows/compilation_on_nuttx.yml | 2 -- core/iwasm/interpreter/wasm_interp_classic.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/compilation_on_nuttx.yml b/.github/workflows/compilation_on_nuttx.yml index 8864491d43..eeef21abfb 100644 --- a/.github/workflows/compilation_on_nuttx.yml +++ b/.github/workflows/compilation_on_nuttx.yml @@ -59,8 +59,6 @@ jobs: "boards/arm/stm32/stm32f4discovery/configs/nsh", # cortex-m7 "boards/arm/stm32h7/nucleo-h743zi/configs/nsh", - # cortex-a9 - "boards/arm/imx6/sabre-6quad/configs/nsh", # riscv32imac "boards/risc-v/qemu-rv/rv-virt/configs/nsh", # riscv64imac diff --git a/core/iwasm/interpreter/wasm_interp_classic.c b/core/iwasm/interpreter/wasm_interp_classic.c index 95417f53bf..7498f8ccc5 100644 --- a/core/iwasm/interpreter/wasm_interp_classic.c +++ b/core/iwasm/interpreter/wasm_interp_classic.c @@ -4094,7 +4094,7 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst, WASMExecEnv *exec_env, if (argc < function->param_cell_num) { char buf[128]; snprintf(buf, sizeof(buf), - "invalid argument count %u, must be no smaller than %u", argc, + "invalid argument count %"PRIu32", must be no smaller than %u", argc, function->param_cell_num); wasm_set_exception(module_inst, buf); return; From 7d241ea0b1464ef1b55e0d180537b7bf3f379922 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 10:49:53 +0800 Subject: [PATCH 4/9] Fix code style Signed-off-by: Huang Qi --- core/iwasm/interpreter/wasm_interp_classic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/iwasm/interpreter/wasm_interp_classic.c b/core/iwasm/interpreter/wasm_interp_classic.c index 7498f8ccc5..45ef4d567e 100644 --- a/core/iwasm/interpreter/wasm_interp_classic.c +++ b/core/iwasm/interpreter/wasm_interp_classic.c @@ -4094,8 +4094,9 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst, WASMExecEnv *exec_env, if (argc < function->param_cell_num) { char buf[128]; snprintf(buf, sizeof(buf), - "invalid argument count %"PRIu32", must be no smaller than %u", argc, - function->param_cell_num); + "invalid argument count %" PRIu32 + ", must be no smaller than %u", + argc, function->param_cell_num); wasm_set_exception(module_inst, buf); return; } From 8844796d8ac418862ae6d60f9836caf199f8ccd9 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 11:05:17 +0800 Subject: [PATCH 5/9] Fix code style Signed-off-by: Huang Qi --- core/shared/utils/bh_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/shared/utils/bh_log.c b/core/shared/utils/bh_log.c index 759e102f25..03dde4926f 100644 --- a/core/shared/utils/bh_log.c +++ b/core/shared/utils/bh_log.c @@ -102,6 +102,6 @@ void bh_log_proc_mem(const char *function, uint32 line) { char prompt[128] = { 0 }; - snprintf(prompt, sizeof(prompt), "[MEM] %s(...) L%"PRIu32, function, line); + snprintf(prompt, sizeof(prompt), "[MEM] %s(...) L%" PRIu32, function, line); return bh_print_proc_mem(prompt); } \ No newline at end of file From d7f72f179f72114491875e9eeb2210358cae7895 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 11:22:28 +0800 Subject: [PATCH 6/9] Fix warning in wasm_native Signed-off-by: Huang Qi --- core/iwasm/common/wasm_native.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/iwasm/common/wasm_native.c b/core/iwasm/common/wasm_native.c index 91b156d377..c7be95fcf0 100644 --- a/core/iwasm/common/wasm_native.c +++ b/core/iwasm/common/wasm_native.c @@ -379,8 +379,13 @@ wasm_native_unregister_natives(const char *module_name, bool wasm_native_init() { +#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \ + || WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \ + || WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \ + || WASM_ENABLE_APP_FRAMEWORK != 0 NativeSymbol *native_symbols; uint32 n_native_symbols; +#endif #if WASM_ENABLE_LIBC_BUILTIN != 0 n_native_symbols = get_libc_builtin_export_apis(&native_symbols); @@ -456,9 +461,14 @@ wasm_native_init() #endif return true; +#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \ + || WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \ + || WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \ + || WASM_ENABLE_APP_FRAMEWORK != 0 fail: wasm_native_destroy(); return false; +#endif } void From 7020dc548c3d2f6904530853b1f7591b75df226d Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 11:28:29 +0800 Subject: [PATCH 7/9] Change nuttx board to avoid warning from nuttx Signed-off-by: Huang Qi --- .github/workflows/compilation_on_nuttx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compilation_on_nuttx.yml b/.github/workflows/compilation_on_nuttx.yml index eeef21abfb..07cccaf79c 100644 --- a/.github/workflows/compilation_on_nuttx.yml +++ b/.github/workflows/compilation_on_nuttx.yml @@ -56,7 +56,7 @@ jobs: # cortex-m0 "boards/arm/rp2040/raspberrypi-pico/configs/nsh", # cortex-m4 - "boards/arm/stm32/stm32f4discovery/configs/nsh", + "boards/arm/kinetis/freedom-k66f/configs/nsh", # cortex-m7 "boards/arm/stm32h7/nucleo-h743zi/configs/nsh", # riscv32imac From 3a0262a5351912f1e78af17aaf3c9d7bcf32747b Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 11:36:34 +0800 Subject: [PATCH 8/9] Change board Signed-off-by: Huang Qi --- .github/workflows/compilation_on_nuttx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compilation_on_nuttx.yml b/.github/workflows/compilation_on_nuttx.yml index 07cccaf79c..9e8d6bb8ec 100644 --- a/.github/workflows/compilation_on_nuttx.yml +++ b/.github/workflows/compilation_on_nuttx.yml @@ -56,7 +56,7 @@ jobs: # cortex-m0 "boards/arm/rp2040/raspberrypi-pico/configs/nsh", # cortex-m4 - "boards/arm/kinetis/freedom-k66f/configs/nsh", + "boards/arm/stm32l4/nucleo-l432kc/configs/nsh", # cortex-m7 "boards/arm/stm32h7/nucleo-h743zi/configs/nsh", # riscv32imac From a242fab4987f0714651f96b583060e3e06da483b Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 26 Nov 2022 11:45:42 +0800 Subject: [PATCH 9/9] Change board Signed-off-by: Huang Qi --- .github/workflows/compilation_on_nuttx.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/compilation_on_nuttx.yml b/.github/workflows/compilation_on_nuttx.yml index 9e8d6bb8ec..7df9e87ee9 100644 --- a/.github/workflows/compilation_on_nuttx.yml +++ b/.github/workflows/compilation_on_nuttx.yml @@ -55,8 +55,6 @@ jobs: "boards/sim/sim/sim/configs/nsh", # cortex-m0 "boards/arm/rp2040/raspberrypi-pico/configs/nsh", - # cortex-m4 - "boards/arm/stm32l4/nucleo-l432kc/configs/nsh", # cortex-m7 "boards/arm/stm32h7/nucleo-h743zi/configs/nsh", # riscv32imac