aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2013-12-02 15:49:58 +0100
committerHenrik Nord <[email protected]>2013-12-02 15:50:01 +0100
commit87054d91f9cb191274a56ac80a8ab29c4cb3a0ef (patch)
tree4e2e9dc83a55f5a0621d4790c181d56ca35a9bc5 /lib
parent3e7d99747edeb7b22f8c6cea937cdd830613dcad (diff)
parent80f95d2ab4352eef90ae2546a8e42f4ed82cd738 (diff)
downloadotp-87054d91f9cb191274a56ac80a8ab29c4cb3a0ef.tar.gz
otp-87054d91f9cb191274a56ac80a8ab29c4cb3a0ef.tar.bz2
otp-87054d91f9cb191274a56ac80a8ab29c4cb3a0ef.zip
Merge branch 'nox/fix-clang-warnings' into maint
* nox/fix-clang-warnings: Silence warnings about socklen_t pointers sign in erl_memory Compile in_heapfrag() only in debug mode Silence two warnings about tests being always true Conditionally compile my_gethostbyname_r and my_gethostbyaddr_r Silence a mismatching type pointer warning in ei_resolve Silence warnings about different buffer types in erl_memory erts: Remove unused file winsock_func.h Silence warnings about unused return values in ic Silence a warning in erl_poll about an empty loop body Fix erts_check_off_heap2 assertion Properly mark erl_assert_error as non-returning Remove uninitialized use of new_crr in erl_alloc_util OTP-11517
Diffstat (limited to 'lib')
-rw-r--r--lib/erl_interface/src/connect/ei_resolve.c9
-rw-r--r--lib/erl_interface/src/encode/encode_ulonglong.c2
-rw-r--r--lib/erl_interface/src/legacy/erl_marshal.c2
-rw-r--r--lib/ic/c_src/oe_ei_code_erlang_binary.c2
-rw-r--r--lib/ic/c_src/oe_ei_encode_atom.c2
-rw-r--r--lib/ic/c_src/oe_ei_encode_port.c2
-rw-r--r--lib/ic/c_src/oe_ei_encode_ref.c2
-rw-r--r--lib/ic/c_src/oe_ei_encode_string.c2
-rw-r--r--lib/ic/c_src/oe_ei_encode_term.c2
-rw-r--r--lib/tools/c_src/erl_memory.c73
10 files changed, 53 insertions, 45 deletions
diff --git a/lib/erl_interface/src/connect/ei_resolve.c b/lib/erl_interface/src/connect/ei_resolve.c
index 2545c5f3de..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.
@@ -226,7 +228,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++;
@@ -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 */
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;
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;
diff --git a/lib/tools/c_src/erl_memory.c b/lib/tools/c_src/erl_memory.c
index 86e84723b1..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 <windows.h>
+typedef int socklen_t;
#else
# if defined(__linux__) && defined(__GNUC__)
# define _GNU_SOURCE 1
@@ -149,11 +150,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 +174,7 @@ typedef struct {
} em_buf_queue;
typedef struct {
- usgnd_int_8 *ptr;
+ char *ptr;
size_t size;
} em_area;
@@ -460,7 +461,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 +596,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 +609,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 +641,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 +690,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 +709,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 +734,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 +856,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 +895,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 +914,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 */
@@ -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";
@@ -996,7 +997,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 +1009,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 +1141,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 +1249,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 +1914,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 +1922,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 +2247,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 +2278,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;
@@ -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);
@@ -2738,7 +2739,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);