@@ -31,8 +31,8 @@ get_func_size(const AOTModule *module, struct func_info *sorted_func_ptrs,
3131static int
3232compare_func_ptrs (const void * f1 , const void * f2 )
3333{
34- return (intptr_t )((struct func_info * )f1 )-> ptr
35- - (intptr_t )((struct func_info * )f2 )-> ptr ;
34+ return (int )(( intptr_t )((struct func_info * )f1 )-> ptr
35+ - (intptr_t )((struct func_info * )f2 )-> ptr ) ;
3636}
3737
3838static struct func_info *
@@ -45,8 +45,8 @@ sort_func_ptrs(const AOTModule *module, char *error_buf, uint32 error_buf_size)
4545 content_len = (uint64 )sizeof (struct func_info ) * module -> func_count ;
4646 sorted_func_ptrs = wasm_runtime_malloc (content_len );
4747 if (!sorted_func_ptrs ) {
48- snprintf (error_buf , error_buf_size ,
49- "allocate memory failed when creating perf map" );
48+ ( void ) snprintf (error_buf , error_buf_size ,
49+ "allocate memory failed when creating perf map" );
5050 return NULL ;
5151 }
5252
@@ -77,7 +77,8 @@ aot_create_perf_map(const AOTModule *module, char *error_buf,
7777 if (!sorted_func_ptrs )
7878 goto quit ;
7979
80- snprintf (perf_map_path , sizeof (perf_map_path ) - 1 , "/tmp/perf-%d.map" , pid );
80+ (void )snprintf (perf_map_path , sizeof (perf_map_path ) - 1 , "/tmp/perf-%d.map" ,
81+ pid );
8182 perf_map = fopen (perf_map_path , "a" );
8283 if (!perf_map ) {
8384 LOG_WARNING ("warning: can't create /tmp/perf-%d.map, because %s" , pid ,
@@ -88,19 +89,23 @@ aot_create_perf_map(const AOTModule *module, char *error_buf,
8889 const char * module_name = aot_get_module_name ((AOTModule * )module );
8990 for (i = 0 ; i < module -> func_count ; i ++ ) {
9091 memset (perf_map_info , 0 , 128 );
91- if (strlen (module_name ) > 0 )
92- snprintf (perf_map_info , 128 , PRIxPTR " %x [%s]#aot_func#%u\n" ,
93- (uintptr_t )sorted_func_ptrs [i ].ptr ,
94- get_func_size (module , sorted_func_ptrs , i ), module_name ,
95- sorted_func_ptrs [i ].idx );
96- else
97- snprintf (perf_map_info , 128 , PRIxPTR " %x aot_func#%u\n" ,
98- (uintptr_t )sorted_func_ptrs [i ].ptr ,
99- get_func_size (module , sorted_func_ptrs , i ),
100- sorted_func_ptrs [i ].idx );
92+ if (strlen (module_name ) > 0 ) {
93+ (void )snprintf (perf_map_info , 128 ,
94+ "%" PRIxPTR " %x [%s]#aot_func#%u\n" ,
95+ (uintptr_t )sorted_func_ptrs [i ].ptr ,
96+ get_func_size (module , sorted_func_ptrs , i ),
97+ module_name , sorted_func_ptrs [i ].idx );
98+ }
99+ else {
100+ (void )snprintf (perf_map_info , 128 ,
101+ "%" PRIxPTR " %x aot_func#%u\n" ,
102+ (uintptr_t )sorted_func_ptrs [i ].ptr ,
103+ get_func_size (module , sorted_func_ptrs , i ),
104+ sorted_func_ptrs [i ].idx );
105+ }
101106
102107 /* fwrite() is thread safe */
103- fwrite (perf_map_info , 1 , strlen (perf_map_info ), perf_map );
108+ ( void ) fwrite (perf_map_info , 1 , strlen (perf_map_info ), perf_map );
104109 }
105110
106111 LOG_VERBOSE ("write map information from %s into /tmp/perf-%d.map" ,
@@ -112,7 +117,7 @@ aot_create_perf_map(const AOTModule *module, char *error_buf,
112117 wasm_runtime_free (sorted_func_ptrs );
113118
114119 if (perf_map )
115- fclose (perf_map );
120+ ( void ) fclose (perf_map );
116121
117122 return ret ;
118123}
0 commit comments