From 23d2e0627cefa0732b21ff6722e750125bb6a2aa Mon Sep 17 00:00:00 2001 From: Wenyong Huang Date: Sat, 13 Jan 2024 08:56:39 +0800 Subject: [PATCH] Clear compilation warning and dead code (#3002) --- core/iwasm/compilation/aot_emit_aot_file.c | 6 ++++++ core/iwasm/interpreter/wasm_loader.c | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/core/iwasm/compilation/aot_emit_aot_file.c b/core/iwasm/compilation/aot_emit_aot_file.c index 66304339..9b5fa47e 100644 --- a/core/iwasm/compilation/aot_emit_aot_file.c +++ b/core/iwasm/compilation/aot_emit_aot_file.c @@ -25,6 +25,7 @@ } \ } while (0) +#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 static bool check_utf8_str(const uint8 *str, uint32 len) { @@ -89,6 +90,7 @@ check_utf8_str(const uint8 *str, uint32 len) } return (p == p_end); } +#endif /* end of WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 */ /* Internal function in object file */ typedef struct AOTObjectFunc { @@ -1111,6 +1113,7 @@ static union { EMIT_BUF(s, str_len); \ } while (0) +#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 static bool read_leb(uint8 **p_buf, const uint8 *buf_end, uint32 maxbits, bool sign, uint64 *p_result) @@ -1309,6 +1312,7 @@ get_name_section_size(AOTCompData *comp_data) fail: return 0; } +#endif /* end of WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 */ static uint32 get_custom_sections_size(AOTCompContext *comp_ctx, AOTCompData *comp_data) @@ -2065,6 +2069,7 @@ aot_emit_native_symbol(uint8 *buf, uint8 *buf_end, uint32 *p_offset, return true; } +#if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0 static bool aot_emit_name_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset, AOTCompData *comp_data, AOTCompContext *comp_ctx) @@ -2090,6 +2095,7 @@ aot_emit_name_section(uint8 *buf, uint8 *buf_end, uint32 *p_offset, LOG_DEBUG("emit name section"); return true; } +#endif static bool aot_emit_custom_sections(uint8 *buf, uint8 *buf_end, uint32 *p_offset, diff --git a/core/iwasm/interpreter/wasm_loader.c b/core/iwasm/interpreter/wasm_loader.c index 1fc9805b..f02f23d8 100644 --- a/core/iwasm/interpreter/wasm_loader.c +++ b/core/iwasm/interpreter/wasm_loader.c @@ -4046,15 +4046,6 @@ check_wasi_abi_compatibility(const WASMModule *module, * according to the assumption, they should be all wasi compatiable */ - /* always can not have both at the same time */ - if (start && initialize) { - set_error_buf( - error_buf, error_buf_size, - "neither a command nor a reactor can both have _start function " - "and _initialize function at the same time"); - return false; - } - #if WASM_ENABLE_MULTI_MODULE != 0 /* filter out commands (with `_start`) cases */ if (start && !main_module) {