Skip to content

Commit e895c58

Browse files
no1wudiwenyongh
authored andcommitted
Clear some warnings and enable -Werror for NuttX (#1756)
1 parent dcf56e4 commit e895c58

File tree

7 files changed

+20
-13
lines changed

7 files changed

+20
-13
lines changed

.github/workflows/compilation_on_nuttx.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,8 @@ jobs:
5555
"boards/sim/sim/sim/configs/nsh",
5656
# cortex-m0
5757
"boards/arm/rp2040/raspberrypi-pico/configs/nsh",
58-
# cortex-m4
59-
"boards/arm/stm32/stm32f4discovery/configs/nsh",
6058
# cortex-m7
6159
"boards/arm/stm32h7/nucleo-h743zi/configs/nsh",
62-
# cortex-a9
63-
"boards/arm/imx6/sabre-6quad/configs/nsh",
6460
# riscv32imac
6561
"boards/risc-v/qemu-rv/rv-virt/configs/nsh",
6662
# riscv64imac
@@ -123,4 +119,4 @@ jobs:
123119
run: |
124120
cd nuttx
125121
tools/configure.sh ${{ matrix.nuttx_board_config }}
126-
make -j$(nproc)
122+
make -j$(nproc) EXTRAFLAGS=-Werror

core/iwasm/common/wasm_application.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ execute_func(WASMModuleInstanceCommon *module_inst, const char *name,
555555
case VALUE_TYPE_FUNCREF:
556556
{
557557
if (argv1[k] != NULL_REF)
558-
os_printf("%u:ref.func", argv1[k]);
558+
os_printf("%" PRIu32 ":ref.func", argv1[k]);
559559
else
560560
os_printf("func:ref.null");
561561
k++;

core/iwasm/common/wasm_native.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,13 @@ wasm_native_unregister_natives(const char *module_name,
379379
bool
380380
wasm_native_init()
381381
{
382+
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
383+
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
384+
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
385+
|| WASM_ENABLE_APP_FRAMEWORK != 0
382386
NativeSymbol *native_symbols;
383387
uint32 n_native_symbols;
388+
#endif
384389

385390
#if WASM_ENABLE_LIBC_BUILTIN != 0
386391
n_native_symbols = get_libc_builtin_export_apis(&native_symbols);
@@ -456,9 +461,14 @@ wasm_native_init()
456461
#endif
457462

458463
return true;
464+
#if WASM_ENABLE_SPEC_TEST != 0 || WASM_ENABLE_LIBC_BUILTIN != 0 \
465+
|| WASM_ENABLE_BASE_LIB != 0 || WASM_ENABLE_LIBC_EMCC != 0 \
466+
|| WASM_ENABLE_LIB_RATS != 0 || WASM_ENABLE_WASI_NN != 0 \
467+
|| WASM_ENABLE_APP_FRAMEWORK != 0
459468
fail:
460469
wasm_native_destroy();
461470
return false;
471+
#endif
462472
}
463473

464474
void

core/iwasm/interpreter/wasm_interp_classic.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4094,8 +4094,9 @@ wasm_interp_call_wasm(WASMModuleInstance *module_inst, WASMExecEnv *exec_env,
40944094
if (argc < function->param_cell_num) {
40954095
char buf[128];
40964096
snprintf(buf, sizeof(buf),
4097-
"invalid argument count %u, must be no smaller than %u", argc,
4098-
function->param_cell_num);
4097+
"invalid argument count %" PRIu32
4098+
", must be no smaller than %u",
4099+
argc, function->param_cell_num);
40994100
wasm_set_exception(module_inst, buf);
41004101
return;
41014102
}

core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,13 +952,13 @@ print_wrapper(wasm_exec_env_t exec_env)
952952
static void
953953
print_i32_wrapper(wasm_exec_env_t exec_env, int32 i32)
954954
{
955-
os_printf("in specttest.print_i32(%d)\n", i32);
955+
os_printf("in specttest.print_i32(%" PRId32 ")\n", i32);
956956
}
957957

958958
static void
959959
print_i32_f32_wrapper(wasm_exec_env_t exec_env, int32 i32, float f32)
960960
{
961-
os_printf("in specttest.print_i32_f32(%d, %f)\n", i32, f32);
961+
os_printf("in specttest.print_i32_f32(%" PRId32 ", %f)\n", i32, f32);
962962
}
963963

964964
static void

core/shared/utils/bh_log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ void
102102
bh_log_proc_mem(const char *function, uint32 line)
103103
{
104104
char prompt[128] = { 0 };
105-
snprintf(prompt, sizeof(prompt), "[MEM] %s(...) L%u", function, line);
105+
snprintf(prompt, sizeof(prompt), "[MEM] %s(...) L%" PRIu32, function, line);
106106
return bh_print_proc_mem(prompt);
107107
}

product-mini/platforms/posix/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ print_help()
7878
}
7979
/* clang-format on */
8080

81-
static void *
81+
static const void *
8282
app_instance_main(wasm_module_inst_t module_inst)
8383
{
8484
const char *exception;
@@ -89,7 +89,7 @@ app_instance_main(wasm_module_inst_t module_inst)
8989
return exception;
9090
}
9191

92-
static void *
92+
static const void *
9393
app_instance_func(wasm_module_inst_t module_inst, const char *func_name)
9494
{
9595
wasm_application_execute_func(module_inst, func_name, app_argc - 1,

0 commit comments

Comments
 (0)