All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Devesh Sharma
	<Devesh.sharma-laKkSmNT4hbQT0dZR+AlfA@public.gmane.org>,
	Hal Rosenstock
	<hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
	Mike Marciniszyn
	<mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Steve Wise
	<swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>,
	Tatyana Nikolova
	<Tatyana.E.Nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Vladimir Sokolovsky
	<vlad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH 21/28] mlx5: Avoid gcc 5.4 warning -Wempty-body
Date: Mon,  5 Sep 2016 15:08:11 -0600	[thread overview]
Message-ID: <1473109698-31408-22-git-send-email-jgunthorpe@obsidianresearch.com> (raw)
In-Reply-To: <1473109698-31408-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

gcc 5.4 remarks:

../providers/mlx5/buf.c:95:61: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]

Around code like this:

	if (shmdt(hmem->shmaddr) == -1)
		mlx5_dbg(stderr, MLX5_DBG_CONTIG, "%s\n", strerror(errno));

When mlx5_dgb is defined as an empty macro the code expands to
	if (..)
		;

Which is functionally okay, but strange.

It is much better to make mlx5_dbg an empty static inline, this way it
continues to do parameter type validation even when disabled, and we
can drop the sprinkling of #ifdef MLX5_DEBUG everywhere.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libmlx5/src/mlx5.h  |  6 +++++-
 libmlx5/src/qp.c    |  7 -------
 libmlx5/src/verbs.c | 10 ----------
 3 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/libmlx5/src/mlx5.h b/libmlx5/src/mlx5.h
index 5833339a543f..b4787dade7cb 100644
--- a/libmlx5/src/mlx5.h
+++ b/libmlx5/src/mlx5.h
@@ -158,7 +158,11 @@ do {									\
 } while (0)
 
 #else
-	#define mlx5_dbg(fp, mask, format, arg...)
+static inline void mlx5_dbg(FILE *fp, uint32_t mask, const char *fmt, ...)
+	__attribute__((format(printf, 3, 4)));
+static inline void mlx5_dbg(FILE *fp, uint32_t mask, const char *fmt, ...)
+{
+}
 #endif
 
 enum {
diff --git a/libmlx5/src/qp.c b/libmlx5/src/qp.c
index c805fcae4123..23270e50af7a 100644
--- a/libmlx5/src/qp.c
+++ b/libmlx5/src/qp.c
@@ -356,9 +356,7 @@ static inline int copy_eth_inline_headers(struct ibv_qp *ibqp,
 	int inl_hdr_size = MLX5_ETH_L2_INLINE_HEADER_SIZE;
 	int inl_hdr_copy_size = 0;
 	int j = 0;
-#ifdef MLX5_DEBUG
 	FILE *fp = to_mctx(ibqp->context)->dbg_fp;
-#endif
 
 	if (unlikely(wr->num_sge < 1)) {
 		mlx5_dbg(fp, MLX5_DBG_QP_SEND, "illegal num_sge: %d, minimum is 1\n",
@@ -560,9 +558,7 @@ static inline int set_tso_eth_seg(void **seg, struct ibv_send_wr *wr,
 	int size_of_inl_hdr_start = sizeof(eseg->inline_hdr_start);
 	uint64_t left, left_len, copy_sz;
 	void *pdata = wr->tso.hdr;
-#ifdef MLX5_DEBUG
 	FILE *fp = to_mctx(qp->ibv_qp->context)->dbg_fp;
-#endif
 
 	if (unlikely(wr->tso.hdr_sz < MLX5_ETH_L2_MIN_HEADER_SIZE ||
 		     wr->tso.hdr_sz > qp->max_tso_header)) {
@@ -629,10 +625,7 @@ static inline int _mlx5_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
 	uint8_t fence;
 	uint8_t next_fence;
 	uint32_t max_tso = 0;
-
-#ifdef MLX5_DEBUG
 	FILE *fp = to_mctx(ibqp->context)->dbg_fp;
-#endif
 
 	mlx5_spin_lock(&qp->sq.lock);
 
diff --git a/libmlx5/src/verbs.c b/libmlx5/src/verbs.c
index 07e2545e2791..a76821e6f695 100644
--- a/libmlx5/src/verbs.c
+++ b/libmlx5/src/verbs.c
@@ -360,9 +360,7 @@ static struct ibv_cq_ex *create_cq(struct ibv_context *context,
 	int				cqe_sz;
 	int				ret;
 	int				ncqe;
-#ifdef MLX5_DEBUG
 	FILE *fp = to_mctx(context)->dbg_fp;
-#endif
 
 	if (!cq_attr->cqe) {
 		mlx5_dbg(fp, MLX5_DBG_CQ, "CQE invalid\n");
@@ -840,9 +838,7 @@ static int mlx5_calc_sq_size(struct mlx5_context *ctx,
 {
 	int wqe_size;
 	int wq_size;
-#ifdef MLX5_DEBUG
 	FILE *fp = ctx->dbg_fp;
-#endif
 
 	if (!attr->cap.max_send_wr)
 		return 0;
@@ -892,9 +888,7 @@ static int mlx5_calc_rq_size(struct mlx5_context *ctx,
 	int wqe_size;
 	int wq_size;
 	int scat_spc;
-#ifdef MLX5_DEBUG
 	FILE *fp = ctx->dbg_fp;
-#endif
 
 	if (!attr->cap.max_recv_wr)
 		return 0;
@@ -1146,9 +1140,7 @@ struct ibv_qp *create_qp(struct ibv_context *context,
 	struct ibv_qp		       *ibqp;
 	int32_t				usr_idx = 0;
 	uint32_t			uuar_index;
-#ifdef MLX5_DEBUG
 	FILE *fp = ctx->dbg_fp;
-#endif
 
 	if (attr->comp_mask & ~MLX5_CREATE_QP_SUP_COMP_MASK)
 		return NULL;
@@ -1610,9 +1602,7 @@ mlx5_create_xrc_srq(struct ibv_context *context,
 	int max_sge;
 	struct ibv_srq *ibsrq;
 	int uidx;
-#ifdef MLX5_DEBUG
 	FILE *fp = ctx->dbg_fp;
-#endif
 
 	msrq = calloc(1, sizeof(*msrq));
 	if (!msrq)
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-09-05 21:08 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 21:07 [PATCH 00/28] Patches for userspace Jason Gunthorpe
     [not found] ` <1473109698-31408-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-05 21:07   ` [PATCH 01/28] Fix bogus executable file permissions Jason Gunthorpe
2016-09-05 21:07   ` [PATCH 02/28] Include pthreads in the provider libraries Jason Gunthorpe
     [not found]     ` <1473109698-31408-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-07 14:41       ` Steve Wise
2016-09-07 16:04         ` Jason Gunthorpe
2016-09-07 18:00       ` Steve Wise
2016-09-14 15:15       ` Yishai Hadas
     [not found]         ` <2961f191-3020-ed18-0200-ce569c19326b-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-14 16:01           ` Jason Gunthorpe
     [not found]             ` <20160914160150.GA16014-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-14 16:27               ` Yishai Hadas
2016-09-05 21:07   ` [PATCH 03/28] Be explicit about _GNU_SOURCE Jason Gunthorpe
     [not found]     ` <1473109698-31408-4-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-06 13:53       ` Hal Rosenstock
2016-09-07 18:01       ` Steve Wise
2016-09-13 21:39       ` Hefty, Sean
2016-09-14 16:30       ` Yishai Hadas
2016-09-05 21:07   ` [PATCH 04/28] cxgb3/4: Display correct version number in error message Jason Gunthorpe
     [not found]     ` <1473109698-31408-5-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-07 18:02       ` Steve Wise
2016-09-05 21:07   ` [PATCH 05/28] hfi/ipath: Use the name of the provider for the .driver file Jason Gunthorpe
2016-09-05 21:07   ` [PATCH 06/28] i40iw: Avoid gcc warning -Wint-to-pointer-cast Jason Gunthorpe
2016-09-05 21:07   ` [PATCH 07/28] iwpm: Add AM_INIT_AUTOMAKE([subdir-objects]) Jason Gunthorpe
2016-09-05 21:07   ` [PATCH 08/28] ibcm: Actually use the version script when linking Jason Gunthorpe
2016-09-05 21:07   ` [PATCH 09/28] mlx5: Fix gcc 6.4 uninitialized variable warning Jason Gunthorpe
     [not found]     ` <1473109698-31408-10-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-14 15:39       ` Yishai Hadas
     [not found]         ` <0ba444b7-6af4-72f3-d3d6-c27b73421679-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-14 16:37           ` Jason Gunthorpe
     [not found]             ` <20160914163716.GB16014-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-15 14:26               ` Yishai Hadas
     [not found]                 ` <f54fd76a-975f-900a-d996-2ae208402ae8-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-15 16:21                   ` Jason Gunthorpe
     [not found]                     ` <20160915162136.GA26111-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-19 15:02                       ` Yishai Hadas
2016-09-05 21:08   ` [PATCH 10/28] nes: Fix clang 3.6 warning -Wtautological-constant-out-of-range-compare Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 11/28] ocrdma: Fix incorrect type of ibwc_status Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 12/28] ocrdma: Fix incorrect enum constant Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 13/28] rdmacm: Use correct format specifier for size_t Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 14/28] rdmacm: Control symbol export from librspreload Jason Gunthorpe
     [not found]     ` <1473109698-31408-15-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-13 21:50       ` Hefty, Sean
2016-09-05 21:08   ` [PATCH 15/28] umad: Include umad.h in the canonical way Jason Gunthorpe
     [not found]     ` <1473109698-31408-16-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-06 13:54       ` Hal Rosenstock
2016-09-05 21:08   ` [PATCH 16/28] umad: Fix incorrect arguments to umad_register2 in tests Jason Gunthorpe
     [not found]     ` <1473109698-31408-17-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-06 13:54       ` Hal Rosenstock
2016-09-05 21:08   ` [PATCH 17/28] verbs: Fix incorrect type of len Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 18/28] verbs: Fix clang 3.6 warning -Wtautological-compare Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 19/28] verbs: Avoid gcc 6.1 warning -Wunused-variable Jason Gunthorpe
     [not found]     ` <1473109698-31408-20-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-14 16:46       ` Yishai Hadas
     [not found]         ` <7d6553e1-d4a8-a4da-8ccb-ed25d9ba1d91-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-14 16:57           ` Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 20/28] verbs: Use inttypes.h format string macros Jason Gunthorpe
2016-09-05 21:08   ` Jason Gunthorpe [this message]
     [not found]     ` <1473109698-31408-22-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-14 16:25       ` [PATCH 21/28] mlx5: Avoid gcc 5.4 warning -Wempty-body Yishai Hadas
     [not found]         ` <6214bd07-f40c-8458-73a2-c07383c5d85a-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-14 16:55           ` Jason Gunthorpe
     [not found]             ` <20160914165519.GC16014-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-15  5:18               ` Leon Romanovsky
     [not found]                 ` <20160915051840.GJ26069-2ukJVAZIZ/Y@public.gmane.org>
2016-09-15 15:19                   ` Jason Gunthorpe
2016-09-15 15:15               ` Yishai Hadas
2016-09-05 21:08   ` [PATCH 22/28] nes: Avoid gcc 6.1 warning -Wmisleading-indentation Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 23/28] rxe: Avoid gcc 5.4 warning -Wswitch Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 24/28] Fix gcc 5.4, clang 3.6 warnings about unused objects Jason Gunthorpe
     [not found]     ` <1473109698-31408-25-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-07 18:04       ` Steve Wise
2016-09-05 21:08   ` [PATCH 25/28] Avoid gcc 5.4 warning -Wtype-limits Jason Gunthorpe
     [not found]     ` <1473109698-31408-26-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-07 18:05       ` Steve Wise
2016-09-05 21:08   ` [PATCH 26/28] Avoid gcc 5.4 warning -Wunused-result Jason Gunthorpe
     [not found]     ` <1473109698-31408-27-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-13 21:58       ` Hefty, Sean
     [not found]         ` <1828884A29C6694DAF28B7E6B8A82373AB0806AA-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-09-13 22:24           ` Jason Gunthorpe
2016-09-14 16:35       ` Yishai Hadas
     [not found]         ` <3b8df987-b422-a59c-4dc0-8a99524ab45e-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-14 16:58           ` Jason Gunthorpe
     [not found]             ` <20160914165830.GE16014-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-15  5:13               ` Leon Romanovsky
2016-10-09 13:31       ` Yishai Hadas
     [not found]         ` <9ae84345-4427-4689-e6d1-0bfa3eb19630-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-10-09 23:19           ` Jason Gunthorpe
     [not found]             ` <20161009231936.GA24139-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-10-10 10:06               ` Yishai Hadas
     [not found]                 ` <1e022827-f28c-e2cd-2b6a-edfb713ed0b5-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-10-12 18:07                   ` Doug Ledford
2016-10-09 15:14       ` Bart Van Assche
     [not found]         ` <3884fb5e-13a2-3ab6-0cce-66f73fbe84b7-HInyCGIudOg@public.gmane.org>
2016-10-09 23:12           ` Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 27/28] Avoid clang 3.6 warning -Wmissing-field-initializers Jason Gunthorpe
2016-09-05 21:08   ` [PATCH 28/28] Avoid gcc warning -Wpointer-to-int-cast Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473109698-31408-22-git-send-email-jgunthorpe@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=Devesh.sharma-laKkSmNT4hbQT0dZR+AlfA@public.gmane.org \
    --cc=Tatyana.E.Nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
    --cc=vlad-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.