From bfc81004283909e811f44f7de55399a674eb9236 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Mon, 14 Oct 2013 23:43:27 +0200 Subject: Silence warnings about unused return values in ic The warnings are: oe_ei_encode_string.c:26:3: warning: expression result unused [-Wunused-value] (int) ei_encode_string(0,&size,p); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ oe_ei_encode_port.c:26:3: warning: expression result unused [-Wunused-value] (int) ei_encode_port(NULL, &size, p); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ oe_ei_encode_atom.c:26:3: warning: expression result unused [-Wunused-value] (int) ei_encode_atom(0,&size,p); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ oe_ei_encode_pid.c:26::3: warning: expression result unused [-Wunused-value] (int) ei_encode_pid(NULL, &size, p); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ oe_ei_encode_ref.c:26:3: warning: expression result unused [-Wunused-value] (int) ei_encode_ref(NULL, &size, p); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ oe_ei_encode_term.c:26:3: warning: expression result unused [-Wunused-value] (int) ei_encode_term(NULL, &size, t); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- lib/ic/c_src/oe_ei_code_erlang_binary.c | 2 +- lib/ic/c_src/oe_ei_encode_atom.c | 2 +- lib/ic/c_src/oe_ei_encode_port.c | 2 +- lib/ic/c_src/oe_ei_encode_ref.c | 2 +- lib/ic/c_src/oe_ei_encode_string.c | 2 +- lib/ic/c_src/oe_ei_encode_term.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/ic/c_src/oe_ei_code_erlang_binary.c b/lib/ic/c_src/oe_ei_code_erlang_binary.c index f790f8bd69..a484dadbe0 100644 --- a/lib/ic/c_src/oe_ei_code_erlang_binary.c +++ b/lib/ic/c_src/oe_ei_code_erlang_binary.c @@ -24,7 +24,7 @@ int oe_encode_erlang_binary(CORBA_Environment *ev, erlang_binary *binary) { int size = ev->_iout; - (int) ei_encode_binary(0, &size, binary->_buffer, binary->_length); + ei_encode_binary(0, &size, binary->_buffer, binary->_length); if (size >= ev->_outbufsz) { char *buf = ev->_outbuf; diff --git a/lib/ic/c_src/oe_ei_encode_atom.c b/lib/ic/c_src/oe_ei_encode_atom.c index d16df25859..c643cf4fee 100644 --- a/lib/ic/c_src/oe_ei_encode_atom.c +++ b/lib/ic/c_src/oe_ei_encode_atom.c @@ -23,7 +23,7 @@ int oe_ei_encode_atom(CORBA_Environment *ev, const char *p) { int size = ev->_iout; - (int) ei_encode_atom(0,&size,p); + ei_encode_atom(0,&size,p); if (size >= ev->_outbufsz) { char *buf = ev->_outbuf; diff --git a/lib/ic/c_src/oe_ei_encode_port.c b/lib/ic/c_src/oe_ei_encode_port.c index 981f82c08d..4be1523df1 100644 --- a/lib/ic/c_src/oe_ei_encode_port.c +++ b/lib/ic/c_src/oe_ei_encode_port.c @@ -23,7 +23,7 @@ int oe_ei_encode_port(CORBA_Environment *ev, const erlang_port *p) { int size = ev->_iout; - (int) ei_encode_port(NULL, &size, p); + ei_encode_port(NULL, &size, p); if (size >= ev->_outbufsz) { char *buf = ev->_outbuf; diff --git a/lib/ic/c_src/oe_ei_encode_ref.c b/lib/ic/c_src/oe_ei_encode_ref.c index d321469b45..71dc5e5a70 100644 --- a/lib/ic/c_src/oe_ei_encode_ref.c +++ b/lib/ic/c_src/oe_ei_encode_ref.c @@ -23,7 +23,7 @@ int oe_ei_encode_ref(CORBA_Environment *ev, const erlang_ref *p) { int size = ev->_iout; - (int) ei_encode_ref(NULL, &size, p); + ei_encode_ref(NULL, &size, p); if (size >= ev->_outbufsz) { char *buf = ev->_outbuf; diff --git a/lib/ic/c_src/oe_ei_encode_string.c b/lib/ic/c_src/oe_ei_encode_string.c index 48de73b5a8..a52a2e639d 100644 --- a/lib/ic/c_src/oe_ei_encode_string.c +++ b/lib/ic/c_src/oe_ei_encode_string.c @@ -23,7 +23,7 @@ int oe_ei_encode_string(CORBA_Environment *ev, const char *p) { int size = ev->_iout; - (int) ei_encode_string(0,&size,p); + ei_encode_string(0,&size,p); if (size >= ev->_outbufsz) { char *buf = ev->_outbuf; diff --git a/lib/ic/c_src/oe_ei_encode_term.c b/lib/ic/c_src/oe_ei_encode_term.c index 48de152ac6..b1f1375638 100644 --- a/lib/ic/c_src/oe_ei_encode_term.c +++ b/lib/ic/c_src/oe_ei_encode_term.c @@ -23,7 +23,7 @@ int oe_ei_encode_term(CORBA_Environment *ev, void *t) { int size = ev->_iout; - (int) ei_encode_term(NULL, &size, t); + ei_encode_term(NULL, &size, t); if (size >= ev->_outbufsz) { char *buf = ev->_outbuf; -- cgit v1.2.3 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(-) (limited to 'lib') 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 From 012e6ee060c5b2c3933fb3ca8058ab63bac30962 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 15 Oct 2013 10:36:42 +0200 Subject: Silence a mismatching type pointer warning in ei_resolve Why we are assigning a pointer to pointer to char to a pointer to char baffles me. The warning is: connect/ei_resolve.c:229:11: warning: incompatible pointer types assigning to 'char *' from 'char **'; dereference with * [-Wincompatible-pointer-types] *pptr = src_aliases; ^ ~~~~~~~~~~~ * --- lib/erl_interface/src/connect/ei_resolve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/erl_interface/src/connect/ei_resolve.c b/lib/erl_interface/src/connect/ei_resolve.c index 2545c5f3de..494dba072c 100644 --- a/lib/erl_interface/src/connect/ei_resolve.c +++ b/lib/erl_interface/src/connect/ei_resolve.c @@ -226,7 +226,7 @@ static int copy_hostent(struct hostent *dest, const struct hostent *src, char *b while(*(src_aliases)) { if (buflen < sizeof(*pptr)) return -1; - *pptr = src_aliases; + *pptr = (char *)src_aliases; advance_buf(buffer,buflen,sizeof(*pptr)); src_aliases++; pptr++; -- cgit v1.2.3 From 8e970802761c593e2ed556722276ea036c4ad031 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 15 Oct 2013 10:44:19 +0200 Subject: Conditionally compile my_gethostbyname_r and my_gethostbyaddr_r These are not needed when not on VXWORKS or without _REENTRANT. connect/ei_resolve.c:302:24: warning: unused function 'my_gethostbyname_r' [-Wunused-function] static struct hostent *my_gethostbyname_r(const char *name, ^ connect/ei_resolve.c:360:24: warning: unused function 'my_gethostbyaddr_r' [-Wunused-function] static struct hostent *my_gethostbyaddr_r(const char *addr, ^ --- lib/erl_interface/src/connect/ei_resolve.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/erl_interface/src/connect/ei_resolve.c b/lib/erl_interface/src/connect/ei_resolve.c index 494dba072c..74dcba61a7 100644 --- a/lib/erl_interface/src/connect/ei_resolve.c +++ b/lib/erl_interface/src/connect/ei_resolve.c @@ -173,6 +173,8 @@ static int verify_dns_configuration(void) #endif +#if defined(VXWORKS) || _REENTRANT + /* * Copy the contents of one struct hostent to another, i.e. don't just * copy the pointers, copy all the data and create new pointers, etc. @@ -357,6 +359,10 @@ static struct hostent *my_gethostbyname_r(const char *name, return rval; } +#endif /* defined(VXWORKS) || _REENTRANT */ + +#if defined(VXWORKS) || EI_THREADS != false + static struct hostent *my_gethostbyaddr_r(const char *addr, int length, int type, @@ -418,6 +424,7 @@ static struct hostent *my_gethostbyaddr_r(const char *addr, return rval; } +#endif /* defined(VXWORKS) || EI_THREADS != false */ #endif /* !HAVE_GETHOSTBYNAME_R */ -- cgit v1.2.3 From 09152f810b04715785cb0437f9bc0ce42bb0f85f Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 15 Oct 2013 10:49:55 +0200 Subject: Silence two warnings about tests being always true encode/encode_ulonglong.c:55:25: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] if ((p < 256) && (p >= 0)) { ~ ^ ~ legacy/erl_marshal.c:293:24: warning: comparison of unsigned expression >= 0 is always true [-Wtautological-compare] if ((ul < 256) && (ul >= 0)) { ~~ ^ ~ --- lib/erl_interface/src/encode/encode_ulonglong.c | 2 +- lib/erl_interface/src/legacy/erl_marshal.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/erl_interface/src/encode/encode_ulonglong.c b/lib/erl_interface/src/encode/encode_ulonglong.c index 0f21af2a91..2f136abf96 100644 --- a/lib/erl_interface/src/encode/encode_ulonglong.c +++ b/lib/erl_interface/src/encode/encode_ulonglong.c @@ -52,7 +52,7 @@ int ei_encode_ulonglong(char *buf, int *index, EI_ULONGLONG p) char *s = buf + *index; char *s0 = s; - if ((p < 256) && (p >= 0)) { + if (p < 256) { if (!buf) s += 2; else { put8(s,ERL_SMALL_INTEGER_EXT); diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c index e207b5f0f1..9558dc134b 100644 --- a/lib/erl_interface/src/legacy/erl_marshal.c +++ b/lib/erl_interface/src/legacy/erl_marshal.c @@ -290,7 +290,7 @@ int erl_encode_it(ETERM *ep, unsigned char **ext, int dist) return 0; } /* SMALL_INTEGER */ - if ((ul < 256) && (ul >= 0)) { + if (ul < 256) { *(*ext)++ = ERL_SMALL_INTEGER_EXT; *(*ext)++ = ul & 0xff; return 0; -- cgit v1.2.3 From 80f95d2ab4352eef90ae2546a8e42f4ed82cd738 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 21 Nov 2013 18:18:42 +0100 Subject: Silence warnings about socklen_t pointers sign in erl_memory erl_memory.c:947:7: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign] &saddr_size) != 0) ^~~~~~~~~~~ /usr/include/sys/socket.h:616:74: note: passing argument to parameter here int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict) ^ erl_memory.c:2613:57: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between pointers to integer types with different sign [-Wpointer-sign] sock = accept(lsock, (struct sockaddr *) &oth_addr, &oth_addr_len); ^~~~~~~~~~~~~ /usr/include/sys/socket.h:610:69: note: passing argument to parameter here int accept(int, struct sockaddr * __restrict, socklen_t * __restrict) ^ --- lib/tools/c_src/erl_memory.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/tools/c_src/erl_memory.c b/lib/tools/c_src/erl_memory.c index 398b320041..c4e126a7b1 100644 --- a/lib/tools/c_src/erl_memory.c +++ b/lib/tools/c_src/erl_memory.c @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2003-2012. All Rights Reserved. + * Copyright Ericsson AB 2003-2013. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -30,6 +30,7 @@ # undef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # include +typedef int socklen_t; #else # if defined(__linux__) && defined(__GNUC__) # define _GNU_SOURCE 1 @@ -938,7 +939,7 @@ print_emu_arg(em_state *state) struct hostent *hp; struct in_addr iaddr; usgnd_int_16 port; - int saddr_size = sizeof(saddr); + socklen_t saddr_size = sizeof(saddr); size_t size; char *format = "> Emulator command line argument: +Mit %s\n"; @@ -2555,7 +2556,7 @@ init_connection(em_state *state) SOCKET lsock; SOCKET sock = INVALID_SOCKET; struct sockaddr_in my_addr; - int oth_addr_len; + socklen_t oth_addr_len; struct sockaddr_in oth_addr; #ifdef __WIN32__ WORD wVersionRequested = MAKEWORD(2,0); -- cgit v1.2.3