Skip to content

Commit 1505e61

Browse files
authored
Remove a lot of "unused parameter" warnings (#3075)
They might shadow some of the real issues, so better to keep the number of warnings as low as possible.
1 parent f56154e commit 1505e61

File tree

6 files changed

+167
-98
lines changed

6 files changed

+167
-98
lines changed

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

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,12 +473,16 @@ snprintf_wrapper(wasm_exec_env_t exec_env, char *str, uint32 size,
473473
static int
474474
puts_wrapper(wasm_exec_env_t exec_env, const char *str)
475475
{
476+
(void)exec_env;
477+
476478
return os_printf("%s\n", str);
477479
}
478480

479481
static int
480482
putchar_wrapper(wasm_exec_env_t exec_env, int c)
481483
{
484+
(void)exec_env;
485+
482486
os_printf("%c", c);
483487
return 1;
484488
}
@@ -585,6 +589,8 @@ strchr_wrapper(wasm_exec_env_t exec_env, const char *s, int32 c)
585589
static int32
586590
strcmp_wrapper(wasm_exec_env_t exec_env, const char *s1, const char *s2)
587591
{
592+
(void)exec_env;
593+
588594
/* s1 and s2 have been checked by runtime */
589595
return strcmp(s1, s2);
590596
}
@@ -641,6 +647,8 @@ strncpy_wrapper(wasm_exec_env_t exec_env, char *dst, const char *src,
641647
static uint32
642648
strlen_wrapper(wasm_exec_env_t exec_env, const char *s)
643649
{
650+
(void)exec_env;
651+
644652
/* s has been checked by runtime */
645653
return (uint32)strlen(s);
646654
}
@@ -693,6 +701,7 @@ free_wrapper(wasm_exec_env_t exec_env, void *ptr)
693701
static int32
694702
atoi_wrapper(wasm_exec_env_t exec_env, const char *s)
695703
{
704+
(void)exec_env;
696705
/* s has been checked by runtime */
697706
return atoi(s);
698707
}
@@ -757,20 +766,26 @@ static int32
757766
strncasecmp_wrapper(wasm_exec_env_t exec_env, const char *s1, const char *s2,
758767
uint32 n)
759768
{
769+
(void)exec_env;
770+
760771
/* s1 and s2 have been checked by runtime */
761772
return strncasecmp(s1, s2, n);
762773
}
763774

764775
static uint32
765776
strspn_wrapper(wasm_exec_env_t exec_env, const char *s, const char *accept)
766777
{
778+
(void)exec_env;
779+
767780
/* s and accept have been checked by runtime */
768781
return (uint32)strspn(s, accept);
769782
}
770783

771784
static uint32
772785
strcspn_wrapper(wasm_exec_env_t exec_env, const char *s, const char *reject)
773786
{
787+
(void)exec_env;
788+
774789
/* s and reject have been checked by runtime */
775790
return (uint32)strcspn(s, reject);
776791
}
@@ -787,60 +802,80 @@ strstr_wrapper(wasm_exec_env_t exec_env, const char *s, const char *find)
787802
static int32
788803
isupper_wrapper(wasm_exec_env_t exec_env, int32 c)
789804
{
805+
(void)exec_env;
806+
790807
return isupper(c);
791808
}
792809

793810
static int32
794811
isalpha_wrapper(wasm_exec_env_t exec_env, int32 c)
795812
{
813+
(void)exec_env;
814+
796815
return isalpha(c);
797816
}
798817

799818
static int32
800819
isspace_wrapper(wasm_exec_env_t exec_env, int32 c)
801820
{
821+
(void)exec_env;
822+
802823
return isspace(c);
803824
}
804825

805826
static int32
806827
isgraph_wrapper(wasm_exec_env_t exec_env, int32 c)
807828
{
829+
(void)exec_env;
830+
808831
return isgraph(c);
809832
}
810833

811834
static int32
812835
isprint_wrapper(wasm_exec_env_t exec_env, int32 c)
813836
{
837+
(void)exec_env;
838+
814839
return isprint(c);
815840
}
816841

817842
static int32
818843
isdigit_wrapper(wasm_exec_env_t exec_env, int32 c)
819844
{
845+
(void)exec_env;
846+
820847
return isdigit(c);
821848
}
822849

823850
static int32
824851
isxdigit_wrapper(wasm_exec_env_t exec_env, int32 c)
825852
{
853+
(void)exec_env;
854+
826855
return isxdigit(c);
827856
}
828857

829858
static int32
830859
tolower_wrapper(wasm_exec_env_t exec_env, int32 c)
831860
{
861+
(void)exec_env;
862+
832863
return tolower(c);
833864
}
834865

835866
static int32
836867
toupper_wrapper(wasm_exec_env_t exec_env, int32 c)
837868
{
869+
(void)exec_env;
870+
838871
return toupper(c);
839872
}
840873

841874
static int32
842875
isalnum_wrapper(wasm_exec_env_t exec_env, int32 c)
843876
{
877+
(void)exec_env;
878+
844879
return isalnum(c);
845880
}
846881

@@ -899,7 +934,10 @@ __cxa_allocate_exception_wrapper(wasm_exec_env_t exec_env, uint32 thrown_size)
899934

900935
static void
901936
__cxa_begin_catch_wrapper(wasm_exec_env_t exec_env, void *exception_object)
902-
{}
937+
{
938+
(void)exec_env;
939+
(void)exception_object;
940+
}
903941

904942
static void
905943
__cxa_throw_wrapper(wasm_exec_env_t exec_env, void *thrown_exception,
@@ -908,6 +946,10 @@ __cxa_throw_wrapper(wasm_exec_env_t exec_env, void *thrown_exception,
908946
wasm_module_inst_t module_inst = get_module_inst(exec_env);
909947
char buf[32];
910948

949+
(void)thrown_exception;
950+
(void)tinfo;
951+
(void)table_elem_idx;
952+
911953
snprintf(buf, sizeof(buf), "%s", "exception thrown by stdc++");
912954
wasm_runtime_set_exception(module_inst, buf);
913955
}
@@ -924,6 +966,8 @@ clock_gettime_wrapper(wasm_exec_env_t exec_env, uint32 clk_id,
924966
wasm_module_inst_t module_inst = get_module_inst(exec_env);
925967
uint64 time;
926968

969+
(void)clk_id;
970+
927971
if (!validate_native_addr(ts_app, sizeof(struct timespec_app)))
928972
return (uint32)-1;
929973

@@ -937,6 +981,8 @@ clock_gettime_wrapper(wasm_exec_env_t exec_env, uint32 clk_id,
937981
static uint64
938982
clock_wrapper(wasm_exec_env_t exec_env)
939983
{
984+
(void)exec_env;
985+
940986
/* Convert to nano seconds as CLOCKS_PER_SEC in wasi-sdk */
941987

942988
return os_time_get_boot_us() * 1000;

0 commit comments

Comments
 (0)