From c4b08fb1832695007a5f96f24d4ee5ca1a00d5de Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 14 Oct 2013 23:52:24 +0200 Subject: Silence warnings about different buffer types in erl_memory erl_memory.c:861:19: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, "%*" USGND_INT_MAX_FSTR " ", fw, mi->size); ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:863:16: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:869:16: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, "%*" USGND_INT_MAX_FSTR " ", fw, mi->no); ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:871:20: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:878:16: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:900:19: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, "%*" USGND_INT_MAX_FSTR " ", fw, mi->max_ever_size); ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:902:16: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, "%*s %*s ", fw, "", fw, ""); ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:904:16: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, "%*" USGND_INT_MAX_FSTR " ", fw, mi->max_ever_no); ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:906:20: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, "%*s %*s ", fw, "", fw, ""); ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:909:16: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] *p += sprintf(*p, "%*s %*s %*s ", fw, "", fw, "", fw, ""); ^~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:986:25: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] area.size = sprintf(area.ptr, format, carg); ^~~~~~~~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1103:25: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] area.size = sprintf(area.ptr, ^~~~~~~~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1109:23: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] area.size += sprintf(area.ptr + area.size, ^~~~~~~~~~~~~~~~~~~~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1120:26: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] area.size += sprintf(area.ptr + area.size, ^~~~~~~~~~~~~~~~~~~~ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1190:18: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] p += sprintf(p, "> %-*s", EM_TIME_FIELD_WIDTH - 2, "Maximum:"); ^ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1223:18: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] p += sprintf(p, "\n"); ^ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1227:15: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] p += sprintf(p, "%s", stop_str); ^ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1230:15: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] p += sprintf(p, exit_str, state->info.exit_status); ^ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1236:18: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] p += sprintf(p, format, tsz, bw); ^ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1286:18: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] p += sprintf(p, "%*" USGND_INT_32_FSTR " ", EM_TIME_FIELD_WIDTH - 1, secs); ^ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:1311:18: warning: passing 'usgnd_int_8 *' (aka 'unsigned char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign] p += sprintf(p, "\n"); ^ /usr/include/secure/_stdio.h:49:28: note: expanded from macro 'sprintf' __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__) ^ erl_memory.c:2231:32: warning: passing 'char *' to parameter of type 'usgnd_int_8 *' (aka 'unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign] size = write_header(state, state->output.header, 1); ^~~~~~~~~~~~~~~~~~~~ erl_memory.c:736:44: note: passing argument to parameter 'ptr' here write_header(em_state *state, usgnd_int_8 *ptr, int trunc) ^ --- lib/tools/c_src/erl_memory.c | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/lib/tools/c_src/erl_memory.c b/lib/tools/c_src/erl_memory.c index 86e84723b1..398b320041 100644 --- a/lib/tools/c_src/erl_memory.c +++ b/lib/tools/c_src/erl_memory.c @@ -149,11 +149,11 @@ typedef struct { typedef struct em_buffer_ { struct em_buffer_ *next; int write; - usgnd_int_8 *data; - usgnd_int_8 *data_end; - usgnd_int_8 *end; + char *data; + char *data_end; + char *end; size_t size; - usgnd_int_8 start[EM_DEFAULT_BUF_SZ]; + char start[EM_DEFAULT_BUF_SZ]; } em_buffer; typedef struct { @@ -173,7 +173,7 @@ typedef struct { } em_buf_queue; typedef struct { - usgnd_int_8 *ptr; + char *ptr; size_t size; } em_area; @@ -460,7 +460,7 @@ enqueue(em_state *state, em_buf_queue *queue, size_t min_size) bsize = min_size; buf = (em_buffer *) (*state->alloc)(sizeof(em_buffer) - + (sizeof(usgnd_int_8) + + (sizeof(char) * (bsize-EM_DEFAULT_BUF_SZ))); if (buf) { buf->size = bsize; @@ -595,12 +595,12 @@ get_next_write_area(em_area *area, em_state *state, em_buf_queue *queue, \* */ static INLINE size_t -write_str(usgnd_int_8 **dstpp, char *srcp) +write_str(char **dstpp, char *srcp) { size_t i = 0; if (dstpp) while (srcp[i]) - *((*dstpp)++) = (usgnd_int_8) srcp[i++]; + *((*dstpp)++) = srcp[i++]; else while (srcp[i]) i++; return i; @@ -608,7 +608,7 @@ write_str(usgnd_int_8 **dstpp, char *srcp) static size_t -write_strings(usgnd_int_8 **ptr, +write_strings(char **ptr, char **strings, char *first_line_prefix, char *line_prefix, @@ -640,10 +640,10 @@ write_strings(usgnd_int_8 **ptr, } static size_t -write_title(usgnd_int_8 **bufp, size_t *overflow, size_t width, char *str) +write_title(char **bufp, size_t *overflow, size_t width, char *str) { size_t i, sz, ws; - usgnd_int_8 *p, *endp; + char *p, *endp; /* * Writes at least one '|' character at the beginning. @@ -689,16 +689,16 @@ write_title(usgnd_int_8 **bufp, size_t *overflow, size_t width, char *str) *(p++) = '|'; while (ws > 1) { ws--; - *(p++) = (usgnd_int_8) ' '; + *(p++) = ' '; } i = 0; while (str[i] && (overflow || p < endp)) - *(p++) = (usgnd_int_8) str[i++]; + *(p++) = str[i++]; while (ws) { ws--; - *(p++) = (usgnd_int_8) ' '; + *(p++) = ' '; } ASSERT(overflow || p == endp); @@ -708,7 +708,7 @@ write_title(usgnd_int_8 **bufp, size_t *overflow, size_t width, char *str) } static size_t -write_obj_sub_titles(em_state *state, usgnd_int_8 **bufp, size_t *overflow) +write_obj_sub_titles(em_state *state, char **bufp, size_t *overflow) { size_t field_width = state->output.field_width; size_t size = write_title(bufp, overflow, field_width, "size"); @@ -733,12 +733,12 @@ write_obj_sub_titles(em_state *state, usgnd_int_8 **bufp, size_t *overflow) } static size_t -write_header(em_state *state, usgnd_int_8 *ptr, int trunc) +write_header(em_state *state, char *ptr, int trunc) { #define MIN_LTEXT_SZ 18 #define HEADER_EOL_STR "|\n" - usgnd_int_8 *p; - usgnd_int_8 **pp; + char *p; + char **pp; int i; size_t overflow; size_t *ofp; @@ -855,7 +855,7 @@ write_header(em_state *state, usgnd_int_8 *ptr, int trunc) } static INLINE void -write_mem_info(em_state *state, usgnd_int_8 **p, em_mem_info *mi) +write_mem_info(em_state *state, char **p, em_mem_info *mi) { int fw = state->output.field_width - 1; *p += sprintf(*p, "%*" USGND_INT_MAX_FSTR " ", fw, mi->size); @@ -894,7 +894,7 @@ write_mem_info(em_state *state, usgnd_int_8 **p, em_mem_info *mi) } static INLINE void -write_max_ever_mem_info(em_state *state, usgnd_int_8 **p, em_mem_info *mi) +write_max_ever_mem_info(em_state *state, char **p, em_mem_info *mi) { int fw = state->output.field_width - 1; *p += sprintf(*p, "%*" USGND_INT_MAX_FSTR " ", fw, mi->max_ever_size); @@ -913,13 +913,13 @@ static void print_string(em_state *state, char *str) { em_area area = {NULL, 0}; - usgnd_int_8 *p; + char *p; /* Get area */ get_next_write_area(&area,state,&state->output.queue,write_str(NULL,str)); - p = (usgnd_int_8 *) area.ptr; + p = area.ptr; area.size = write_str(&p, str); /* Leave area */ @@ -996,7 +996,7 @@ print_emu_arg(em_state *state) } static size_t -write_allocator_info(em_state *state, usgnd_int_8 *ptr) +write_allocator_info(em_state *state, char *ptr) { usgnd_int_32 aix, i, j; char *header = "> Allocator information:\n"; @@ -1008,8 +1008,8 @@ write_allocator_info(em_state *state, usgnd_int_8 *ptr) char **strings; size_t strings_size; size_t max_line_size = 80; - usgnd_int_8 *p = ptr; - usgnd_int_8 **pp = ptr ? &p : NULL; + char *p = ptr; + char **pp = ptr ? &p : NULL; strings_size = state->trace_info.max_block_type_ix + 1; if (strings_size < state->trace_info.max_allocator_ix + 1) @@ -1140,7 +1140,7 @@ static void print_main_footer(em_state *state) { em_area area = {NULL, 0}; - usgnd_int_8 *p; + char *p; int i; char *stop_str = "> Trace stopped\n"; @@ -1248,7 +1248,7 @@ print_main_footer(em_state *state) static void print_info(em_state *state, usgnd_int_32 secs, char *extra) { - usgnd_int_8 *p; + char *p; int i; size_t size; em_area area = {NULL, 0}; @@ -1913,7 +1913,7 @@ error_msg(int res, char *msg) #if EMEM_d_SWITCH static size_t -write_output_filename(usgnd_int_8 *ptr, +write_output_filename(char *ptr, char *dirname, char *nodename, char *hostname, @@ -1921,8 +1921,8 @@ write_output_filename(usgnd_int_8 *ptr, char *pid) { size_t sz = 0; - usgnd_int_8 *p = ptr; - usgnd_int_8 **pp = ptr ? &p : NULL; + char *p = ptr; + char **pp = ptr ? &p : NULL; sz += write_str(pp, dirname); if (pp) *((*pp)++) = DIR_SEP_CHAR; sz++; @@ -2246,7 +2246,7 @@ process_trace(em_state *state) if (!area.size) return EM_TRUNCATED_TRACE_ERROR; res = emtp_parse(state->trace_state, - &area.ptr, &area.size, + (usgnd_int_8 **)&area.ptr, &area.size, NULL, 0, NULL); if (res == EMTP_HEADER_PARSED) break; @@ -2277,7 +2277,7 @@ process_trace(em_state *state) while (area.size) { ops_len = EM_NO_OF_OPS; res = emtp_parse(state->trace_state, - &area.ptr, &area.size, + (usgnd_int_8 **)&area.ptr, &area.size, ops, sizeof(emtp_operation), &ops_len); if (res < 0) return res; @@ -2738,7 +2738,7 @@ output_thread_func(void *arg) error_msg(EIO, "Output queue"); } if (fwrite((void *) area.ptr, - sizeof(usgnd_int_8), + sizeof(char), area.size, state->output.stream) != area.size) { disconnect_queue_reader(&state->output.queue); -- cgit v1.2.3