From d43f1a32489e7d22c73f6d6e7a6df59436ad3e17 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Thu, 22 Nov 2012 17:47:49 +0100 Subject: Fix clang compiler warnings on FreeBSD in erts The following are deliberately left, as I have only a list of compiler warnings and no system to test on: hipe/hipe_x86_signal.c:264:5: warning: no previous prototype for function '_sigaction' [-Wmissing-prototypes] int __SIGACTION(int signum, const struct sigaction *act, struct sigaction *oldact) ^ hipe/hipe_x86_signal.c:222:21: note: expanded from macro '__SIGACTION' ^ 1 warning generated. sys/unix/sys_float.c:835:16: warning: declaration of 'struct exception' will not be visible outside of this function [-Wvisibility] matherr(struct exception *exc) ^ sys/unix/sys_float.c:835:1: warning: no previous prototype for function 'matherr' [-Wmissing-prototypes] matherr(struct exception *exc) ^ 2 warnings generated. drivers/unix/unix_efile.c:1504:11: warning: implicit declaration of function 'sendfile' [-Wimplicit-function-declaration] retval = sendfile(in_fd, out_fd, *offset, SENDFILE_CHUNK_SIZE, ^ 1 warning generated. --- erts/emulator/beam/beam_bp.c | 2 +- erts/emulator/beam/beam_load.c | 2 +- erts/emulator/beam/bif.c | 3 +-- erts/emulator/beam/dist.c | 6 +++--- erts/emulator/beam/erl_bif_info.c | 4 ++-- erts/emulator/beam/erl_instrument.c | 4 ++-- erts/emulator/beam/external.c | 4 ++-- erts/emulator/beam/packet_parser.c | 6 ++---- erts/emulator/drivers/common/gzio.c | 5 +++-- 9 files changed, 17 insertions(+), 19 deletions(-) (limited to 'erts/emulator') diff --git a/erts/emulator/beam/beam_bp.c b/erts/emulator/beam/beam_bp.c index c1e11f6448..9b17de34ec 100644 --- a/erts/emulator/beam/beam_bp.c +++ b/erts/emulator/beam/beam_bp.c @@ -969,7 +969,7 @@ erts_trace_time_call(Process* c_p, BeamInstr* I, BpDataTime* bdt) if (pbt == 0) { /* First call of process to instrumented function */ pbt = Alloc(sizeof(process_breakpoint_time_t)); - (void *) ERTS_PROC_SET_CALL_TIME(c_p, ERTS_PROC_LOCK_MAIN, pbt); + (void) ERTS_PROC_SET_CALL_TIME(c_p, ERTS_PROC_LOCK_MAIN, pbt); } else { ASSERT(pbt->pc); /* add time to previous code */ diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index b51f076a5d..96f506c97c 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -5904,7 +5904,7 @@ erts_make_stub_module(Process* p, Eterm Mod, Eterm Beam, Eterm Info) Eterm* tp; Eterm func; Eterm arity_term; - Uint arity; + Sint arity; Uint native_address; Eterm op; diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 97c8114437..46f297fc4d 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -359,8 +359,7 @@ remote_demonitor(Process *c_p, DistEntry *dep, Eterm ref, Eterm to) break; default: ASSERT(! "Invalid dsig prepare result"); - res = ERTS_DEMONITOR_INTERNAL_ERROR; - break; + return ERTS_DEMONITOR_INTERNAL_ERROR; } #ifndef ERTS_SMP diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c index 64cd93a100..98d8481b53 100644 --- a/erts/emulator/beam/dist.c +++ b/erts/emulator/beam/dist.c @@ -2548,9 +2548,9 @@ BIF_RETTYPE setnode_2(BIF_ALIST_2) /* By setting dist_entry==erts_this_dist_entry and DISTRIBUTION on net_kernel do_net_exist will be called when net_kernel is terminated !! */ - (void *) ERTS_PROC_SET_DIST_ENTRY(net_kernel, - ERTS_PROC_LOCK_MAIN, - erts_this_dist_entry); + (void) ERTS_PROC_SET_DIST_ENTRY(net_kernel, + ERTS_PROC_LOCK_MAIN, + erts_this_dist_entry); erts_refc_inc(&erts_this_dist_entry->refc, 2); net_kernel->flags |= F_DISTRIBUTION; diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c index fabddffc68..3d51c17183 100755 --- a/erts/emulator/beam/erl_bif_info.c +++ b/erts/emulator/beam/erl_bif_info.c @@ -3286,7 +3286,7 @@ BIF_RETTYPE erts_debug_get_internal_state_1(BIF_ALIST_1) else if (ERTS_IS_ATOM_STR("next_pid", BIF_ARG_1) || ERTS_IS_ATOM_STR("next_port", BIF_ARG_1)) { /* Used by node_container_SUITE (emulator) */ - Eterm res; + Sint res; if (ERTS_IS_ATOM_STR("next_pid", BIF_ARG_1)) res = erts_ptab_test_next_id(&erts_proc, 0, 0); else @@ -3644,7 +3644,7 @@ BIF_RETTYPE erts_debug_set_internal_state_2(BIF_ALIST_2) Uint next; if (term_to_Uint(BIF_ARG_2, &next) != 0) { - Eterm res; + Sint res; if (ERTS_IS_ATOM_STR("next_pid", BIF_ARG_1)) res = erts_ptab_test_next_id(&erts_proc, 1, next); diff --git a/erts/emulator/beam/erl_instrument.c b/erts/emulator/beam/erl_instrument.c index 963c8b3c58..7f4349556c 100644 --- a/erts/emulator/beam/erl_instrument.c +++ b/erts/emulator/beam/erl_instrument.c @@ -775,8 +775,8 @@ Eterm erts_instr_get_memory_map(Process *proc) ASSERT(hp + 3 == end_hp); if (mem_anchor) { - for (bp = mem_anchor; bp->next; bp = bp->next); - + for (bp = mem_anchor; bp->next; bp = bp->next) + ; ASSERT(org_mem_anchor); org_mem_anchor->prev = bp; bp->next = org_mem_anchor; diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index ab1065aaa1..126f242fc0 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -926,7 +926,7 @@ BIF_RETTYPE erts_debug_dist_ext_to_term_2(BIF_ALIST_2) Eterm res; Eterm *hp; Eterm *hendp; - Uint hsz; + Sint hsz; ErtsDistExternal ede; Eterm *tp; Eterm real_bin; @@ -972,7 +972,7 @@ BIF_RETTYPE erts_debug_dist_ext_to_term_2(BIF_ALIST_2) if (hsz < 0) goto badarg; - hp = HAlloc(BIF_P, hsz); + hp = HAlloc(BIF_P, (Uint) hsz); hendp = hp + hsz; res = erts_decode_dist_ext(&hp, &MSO(BIF_P), &ede); diff --git a/erts/emulator/beam/packet_parser.c b/erts/emulator/beam/packet_parser.c index f1cfa8df39..1e301e3593 100644 --- a/erts/emulator/beam/packet_parser.c +++ b/erts/emulator/beam/packet_parser.c @@ -460,11 +460,9 @@ int packet_get_length(enum PacketParseType htype, hp = (struct tpkt_head*) ptr; if (hp->vrsn == TPKT_VRSN) { plen = get_int16(hp->packet_length) - hlen; - if (plen < 0) - goto error; - } - else + } else { goto error; + } goto remain; } diff --git a/erts/emulator/drivers/common/gzio.c b/erts/emulator/drivers/common/gzio.c index ca6d25adb4..e085c262b0 100644 --- a/erts/emulator/drivers/common/gzio.c +++ b/erts/emulator/drivers/common/gzio.c @@ -13,6 +13,7 @@ # include "config.h" #endif #include +#include /* ssize_t on Mac OS X */ #include #ifdef HAVE_UNISTD_H #include @@ -314,7 +315,7 @@ local int get_byte(s) if (s->z_eof) return EOF; if (s->stream.avail_in == 0) { #ifdef UNIX - size_t res; + ssize_t res; errno = 0; res = ERTS_GZREAD(s->file, s->inbuf, Z_BUFSIZE); if (res == 0) { @@ -487,7 +488,7 @@ erts_gzread(gzFile file, voidp buf, unsigned len) } if (s->stream.avail_in == 0 && !s->z_eof) { #ifdef UNIX - size_t res; + ssize_t res; errno = 0; res = ERTS_GZREAD(s->file, s->inbuf, Z_BUFSIZE); if (res == 0) { -- cgit v1.2.3