aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2011-08-07 20:05:30 +0200
committerRoland Dreier <roland@purestorage.com>2012-06-07 15:11:40 -0700
commitc4f087527d3c3bc50f6a2531e7b54241a9df9e86 (patch)
tree3441ce7abc8e145f2eb9ef7110fe2a69010bd8f6
parent8b2ffc598bd7f8294f3653cab430146985040739 (diff)
downloadlibibverbs-c4f087527d3c3bc50f6a2531e7b54241a9df9e86.tar.gz
Fix a compiler warnings with NVALGRIND
Fix compiler warnings when compiling with NVALGRIND defined and the latest Valgrind header files. Recently the Valgrind client request implementation has been modified in order to not trigger compiler warnings when building with gcc 4.6. A side effect of that change is that Valgrind client request macros that return a value have to be cast to void in order to avoid a compiler warning. For more information, see also: * Valgrind manual about VALGRIND_MAKE_MEM_DEFINED (http://valgrind.org/docs/manual/mc-manual.html). * Valgrind trunk r11755 (http://article.gmane.org/gmane.comp.debugging.valgrind.devel/13489). Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--src/cmd.c42
-rw-r--r--src/ibverbs.h2
-rw-r--r--src/verbs.c2
3 files changed, 23 insertions, 23 deletions
diff --git a/src/cmd.c b/src/cmd.c
index 1a04228..9789092 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -73,7 +73,7 @@ static int ibv_cmd_get_context_v2(struct ibv_context *context,
return errno;
}
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
context->async_fd = resp->async_fd;
context->num_comp_vectors = 1;
@@ -97,7 +97,7 @@ int ibv_cmd_get_context(struct ibv_context *context, struct ibv_get_context *cmd
if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
context->async_fd = resp->async_fd;
context->num_comp_vectors = resp->num_comp_vectors;
@@ -117,7 +117,7 @@ int ibv_cmd_query_device(struct ibv_context *context,
if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
*raw_fw_ver = resp.fw_ver;
@@ -177,7 +177,7 @@ int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num,
if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
port_attr->state = resp.state;
port_attr->max_mtu = resp.max_mtu;
@@ -212,7 +212,7 @@ int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd,
if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
pd->handle = resp->pd_handle;
pd->context = context;
@@ -251,7 +251,7 @@ int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
mr->handle = resp->mr_handle;
mr->lkey = resp->lkey;
@@ -294,7 +294,7 @@ static int ibv_cmd_create_cq_v2(struct ibv_context *context, int cqe,
if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
cq->handle = resp->cq_handle;
cq->cqe = resp->cqe;
@@ -323,7 +323,7 @@ int ibv_cmd_create_cq(struct ibv_context *context, int cqe,
if (write(context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
cq->handle = resp->cq_handle;
cq->cqe = resp->cqe;
@@ -354,7 +354,7 @@ int ibv_cmd_poll_cq(struct ibv_cq *ibcq, int ne, struct ibv_wc *wc)
goto out;
}
- VALGRIND_MAKE_MEM_DEFINED(resp, rsize);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, rsize);
for (i = 0; i < resp->count; i++) {
wc[i].wr_id = resp->wc[i].wr_id;
@@ -405,7 +405,7 @@ int ibv_cmd_resize_cq(struct ibv_cq *cq, int cqe,
if (write(cq->context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
cq->cqe = resp->cqe;
@@ -440,7 +440,7 @@ int ibv_cmd_destroy_cq(struct ibv_cq *cq)
if (write(cq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
pthread_mutex_lock(&cq->mutex);
while (cq->comp_events_completed != resp.comp_events_reported ||
@@ -466,7 +466,7 @@ int ibv_cmd_create_srq(struct ibv_pd *pd,
if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
srq->handle = resp->srq_handle;
srq->context = pd->context;
@@ -548,7 +548,7 @@ int ibv_cmd_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr,
if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
srq_attr->max_wr = resp.max_wr;
srq_attr->max_sge = resp.max_sge;
@@ -585,7 +585,7 @@ int ibv_cmd_destroy_srq(struct ibv_srq *srq)
if (write(srq->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
pthread_mutex_lock(&srq->mutex);
while (srq->events_completed != resp.events_reported)
@@ -620,7 +620,7 @@ int ibv_cmd_create_qp(struct ibv_pd *pd,
if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
+ (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size);
qp->handle = resp->qp_handle;
qp->qp_num = resp->qpn;
@@ -667,7 +667,7 @@ int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
if (write(qp->context->cmd_fd, cmd, cmd_size) != cmd_size)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
attr->qkey = resp.qkey;
attr->rq_psn = resp.rq_psn;
@@ -888,7 +888,7 @@ int ibv_cmd_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
if (write(ibqp->context->cmd_fd, cmd, cmd_size) != cmd_size)
ret = errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
wr_count = resp.bad_wr;
if (wr_count) {
@@ -949,7 +949,7 @@ int ibv_cmd_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
if (write(ibqp->context->cmd_fd, cmd, cmd_size) != cmd_size)
ret = errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
wr_count = resp.bad_wr;
if (wr_count) {
@@ -1010,7 +1010,7 @@ int ibv_cmd_post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *wr,
if (write(srq->context->cmd_fd, cmd, cmd_size) != cmd_size)
ret = errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
wr_count = resp.bad_wr;
if (wr_count) {
@@ -1048,7 +1048,7 @@ int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
if (write(pd->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
ah->handle = resp.handle;
ah->context = pd->context;
@@ -1084,7 +1084,7 @@ int ibv_cmd_destroy_qp(struct ibv_qp *qp)
if (write(qp->context->cmd_fd, &cmd, sizeof cmd) != sizeof cmd)
return errno;
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
pthread_mutex_lock(&qp->mutex);
while (qp->events_completed != resp.events_reported)
diff --git a/src/ibverbs.h b/src/ibverbs.h
index 6a6e3c8..fa6cd41 100644
--- a/src/ibverbs.h
+++ b/src/ibverbs.h
@@ -49,7 +49,7 @@
#endif /* HAVE_VALGRIND_MEMCHECK_H */
#ifndef VALGRIND_MAKE_MEM_DEFINED
-# define VALGRIND_MAKE_MEM_DEFINED(addr, len)
+# define VALGRIND_MAKE_MEM_DEFINED(addr, len) 0
#endif
#define HIDDEN __attribute__((visibility ("hidden")))
diff --git a/src/verbs.c b/src/verbs.c
index ba3c0a4..b5938f2 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -226,7 +226,7 @@ struct ibv_comp_channel *ibv_create_comp_channel(struct ibv_context *context)
return NULL;
}
- VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
+ (void) VALGRIND_MAKE_MEM_DEFINED(&resp, sizeof resp);
channel->context = context;
channel->fd = resp.fd;