[meta-intel] [PATCH V2 3/4] dpdk-dev-libibverbs: Fix additional warnings

Khem Raj raj.khem at gmail.com
Mon Aug 14 22:27:04 PDT 2017


Clang detects more warnings as errors and these fixes address it

Signed-off-by: Khem Raj <raj.khem at gmail.com>
---
 .../dpdk-dev-libibverbs_1.2.1-3.4-2.0.0.0.bb       |   6 +-
 .../files/0001-Fix-build-with-clang.patch          |  32 ++++++
 ...02-typecast-enum-to-int-before-comparison.patch | 115 +++++++++++++++++++++
 .../files/0003-initialize-use_config_mr.patch      |  31 ++++++
 .../files/0004-Fix-clang-warnings.patch            |  56 ++++++++++
 5 files changed, 239 insertions(+), 1 deletion(-)
 create mode 100644 common/recipes-extended/dpdk-dev-libibverbs/files/0001-Fix-build-with-clang.patch
 create mode 100644 common/recipes-extended/dpdk-dev-libibverbs/files/0002-typecast-enum-to-int-before-comparison.patch
 create mode 100644 common/recipes-extended/dpdk-dev-libibverbs/files/0003-initialize-use_config_mr.patch
 create mode 100644 common/recipes-extended/dpdk-dev-libibverbs/files/0004-Fix-clang-warnings.patch

diff --git a/common/recipes-extended/dpdk-dev-libibverbs/dpdk-dev-libibverbs_1.2.1-3.4-2.0.0.0.bb b/common/recipes-extended/dpdk-dev-libibverbs/dpdk-dev-libibverbs_1.2.1-3.4-2.0.0.0.bb
index 5636d8f..c06cceb 100644
--- a/common/recipes-extended/dpdk-dev-libibverbs/dpdk-dev-libibverbs_1.2.1-3.4-2.0.0.0.bb
+++ b/common/recipes-extended/dpdk-dev-libibverbs/dpdk-dev-libibverbs_1.2.1-3.4-2.0.0.0.bb
@@ -5,7 +5,11 @@ LIC_FILES_CHKSUM =  "file://COPYING;md5=7c557f27dd795ba77cc419dddc656b51"
 
 SRC_URI = "https://github.com/Mellanox/dpdk-dev-libibverbs/archive/libibverbs-${PV}.tar.gz;name=${PN} \
            file://init_c.patch \
-          "
+           file://0001-Fix-build-with-clang.patch \
+           file://0002-typecast-enum-to-int-before-comparison.patch \
+           file://0003-initialize-use_config_mr.patch \
+           file://0004-Fix-clang-warnings.patch \
+           "
 
 SRC_URI[dpdk-dev-libibverbs.md5sum] = "65234ee278eb437a7069326f37cd4d86"
 SRC_URI[dpdk-dev-libibverbs.sha256sum] = "a6471515556cb8d10ad471bb7efb8cf760b248a28aceb57d4534d50d572f56cd"
diff --git a/common/recipes-extended/dpdk-dev-libibverbs/files/0001-Fix-build-with-clang.patch b/common/recipes-extended/dpdk-dev-libibverbs/files/0001-Fix-build-with-clang.patch
new file mode 100644
index 0000000..93d8aba
--- /dev/null
+++ b/common/recipes-extended/dpdk-dev-libibverbs/files/0001-Fix-build-with-clang.patch
@@ -0,0 +1,32 @@
+From b705caef6c717adc80585843b7fcc68700ced4b6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Sat, 12 Aug 2017 09:25:24 -0700
+Subject: [PATCH 1/4] Fix build with clang
+
+Fix
+error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses]
+        if ((!port_attr->comp_mask & IBV_EXP_QUERY_PORT_ATTR_MASK1) ||
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+Upstream-Status: Pending
+
+ include/infiniband/verbs_exp.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/infiniband/verbs_exp.h b/include/infiniband/verbs_exp.h
+index ae94deb..42ed83d 100644
+--- a/include/infiniband/verbs_exp.h
++++ b/include/infiniband/verbs_exp.h
+@@ -2955,7 +2955,7 @@ static inline int ibv_exp_query_port(struct ibv_context *context,
+ 				      &port_attr->port_attr);
+ 
+ 	/* Check that only valid flags were given */
+-	if ((!port_attr->comp_mask & IBV_EXP_QUERY_PORT_ATTR_MASK1) ||
++	if (!(port_attr->comp_mask & IBV_EXP_QUERY_PORT_ATTR_MASK1) ||
+ 	    (port_attr->comp_mask & ~IBV_EXP_QUERY_PORT_ATTR_MASKS) ||
+ 	    (port_attr->mask1 & ~IBV_EXP_QUERY_PORT_MASK)) {
+ 		errno = EINVAL;
+-- 
+2.14.1
+
diff --git a/common/recipes-extended/dpdk-dev-libibverbs/files/0002-typecast-enum-to-int-before-comparison.patch b/common/recipes-extended/dpdk-dev-libibverbs/files/0002-typecast-enum-to-int-before-comparison.patch
new file mode 100644
index 0000000..00516eb
--- /dev/null
+++ b/common/recipes-extended/dpdk-dev-libibverbs/files/0002-typecast-enum-to-int-before-comparison.patch
@@ -0,0 +1,115 @@
+From 7edab012f2d28de7e6d3657ec698e1090d0112de Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Sat, 12 Aug 2017 09:25:49 -0700
+Subject: [PATCH 2/4] typecast enum to int before comparison
+
+Fix
+error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare]
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+Upstream-Status: Pending
+
+ examples/cc_pingpong.c   | 2 +-
+ examples/rc_pingpong.c   | 2 +-
+ examples/srq_pingpong.c  | 2 +-
+ examples/task_pingpong.c | 2 +-
+ examples/uc_pingpong.c   | 2 +-
+ examples/umr_rc.c        | 2 +-
+ examples/xsrq_pingpong.c | 2 +-
+ 7 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/examples/cc_pingpong.c b/examples/cc_pingpong.c
+index 7b3e397..567c503 100644
+--- a/examples/cc_pingpong.c
++++ b/examples/cc_pingpong.c
+@@ -1408,7 +1408,7 @@ int main(int argc, char *argv[])
+ 
+ 		case 'm':
+ 			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (mtu < 0) {
++			if ((int)mtu < 0) {
+ 				usage(argv[0]);
+ 				return 1;
+ 			}
+diff --git a/examples/rc_pingpong.c b/examples/rc_pingpong.c
+index 786577e..e661368 100644
+--- a/examples/rc_pingpong.c
++++ b/examples/rc_pingpong.c
+@@ -759,7 +759,7 @@ int main(int argc, char *argv[])
+ 
+ 		case 'm':
+ 			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (mtu < 0) {
++			if ((int)mtu < 0) {
+ 				usage(argv[0]);
+ 				return 1;
+ 			}
+diff --git a/examples/srq_pingpong.c b/examples/srq_pingpong.c
+index 9762866..f85a7cd 100644
+--- a/examples/srq_pingpong.c
++++ b/examples/srq_pingpong.c
+@@ -697,7 +697,7 @@ int main(int argc, char *argv[])
+ 
+ 		case 'm':
+ 			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (mtu < 0) {
++			if ((int)mtu < 0) {
+ 				usage(argv[0]);
+ 				return 1;
+ 			}
+diff --git a/examples/task_pingpong.c b/examples/task_pingpong.c
+index 748f8bb..d03a8b2 100644
+--- a/examples/task_pingpong.c
++++ b/examples/task_pingpong.c
+@@ -1005,7 +1005,7 @@ int main(int argc, char *argv[])
+ 
+ 		case 'm':
+ 			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (mtu < 0) {
++			if ((int)mtu < 0) {
+ 				usage(argv[0]);
+ 				return 1;
+ 			}
+diff --git a/examples/uc_pingpong.c b/examples/uc_pingpong.c
+index 879bd77..a38a054 100644
+--- a/examples/uc_pingpong.c
++++ b/examples/uc_pingpong.c
+@@ -606,7 +606,7 @@ int main(int argc, char *argv[])
+ 
+ 		case 'm':
+ 			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (mtu < 0) {
++			if ((int)mtu < 0) {
+ 				usage(argv[0]);
+ 				return 1;
+ 			}
+diff --git a/examples/umr_rc.c b/examples/umr_rc.c
+index ab76d3c..0ec636a 100644
+--- a/examples/umr_rc.c
++++ b/examples/umr_rc.c
+@@ -950,7 +950,7 @@ int main(int argc, char *argv[])
+ 
+ 		case 'm':
+ 			mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (mtu < 0) {
++			if ((int)mtu < 0) {
+ 				usage(argv[0]);
+ 				return 1;
+ 			}
+diff --git a/examples/xsrq_pingpong.c b/examples/xsrq_pingpong.c
+index c4ae51d..cebae5d 100644
+--- a/examples/xsrq_pingpong.c
++++ b/examples/xsrq_pingpong.c
+@@ -910,7 +910,7 @@ int main(int argc, char *argv[])
+ 			break;
+ 		case 'm':
+ 			ctx.mtu = pp_mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (ctx.mtu < 0) {
++			if ((int)ctx.mtu < 0) {
+ 				usage(argv[0]);
+ 				return 1;
+ 			}
+-- 
+2.14.1
+
diff --git a/common/recipes-extended/dpdk-dev-libibverbs/files/0003-initialize-use_config_mr.patch b/common/recipes-extended/dpdk-dev-libibverbs/files/0003-initialize-use_config_mr.patch
new file mode 100644
index 0000000..da4ef15
--- /dev/null
+++ b/common/recipes-extended/dpdk-dev-libibverbs/files/0003-initialize-use_config_mr.patch
@@ -0,0 +1,31 @@
+From 936da7fcab06ff3bc7c1c1e1ab108a36797da039 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Sat, 12 Aug 2017 09:28:00 -0700
+Subject: [PATCH 3/4] initialize use_config_mr
+
+Fixes
+error: variable 'use_contig_mr' is uninitialized when used here [-Werror,-Wuninitialized]
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+Upstream-Status: Pending
+
+ examples/dcini.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/examples/dcini.c b/examples/dcini.c
+index 001e905..08d75ec 100644
+--- a/examples/dcini.c
++++ b/examples/dcini.c
+@@ -269,7 +269,7 @@ int main(int argc, char *argv[])
+ 	int			size = 4096;
+ 	int			iters = 1000;
+ 	int			use_event = 0;
+-	int			use_contig_mr;
++	int			use_contig_mr = 0;
+ 	int			err;
+ 	struct ibv_ah_attr	ah_attr;
+ 	struct dc_ctx		ctx = {
+-- 
+2.14.1
+
diff --git a/common/recipes-extended/dpdk-dev-libibverbs/files/0004-Fix-clang-warnings.patch b/common/recipes-extended/dpdk-dev-libibverbs/files/0004-Fix-clang-warnings.patch
new file mode 100644
index 0000000..26f09e5
--- /dev/null
+++ b/common/recipes-extended/dpdk-dev-libibverbs/files/0004-Fix-clang-warnings.patch
@@ -0,0 +1,56 @@
+From 08944074f9d9525a57e88a4990dd833d0999b8df Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem at gmail.com>
+Date: Sat, 12 Aug 2017 09:36:55 -0700
+Subject: [PATCH 4/4] Fix clang warnings
+
+../../../../../../../workspace/sources/dpdk-dev-libibverbs/examples/intf.c:1221:11: error: comparison of array 'ctx->dev_name' not equal to a null pointer is always true [-Werror,-Wtautological-pointer-compare]
+        if (ctx->dev_name != NULL) {
+            ~~~~~^~~~~~~~    ~~~~
+../../../../../../../workspace/sources/dpdk-dev-libibverbs/examples/intf.c:1893:13: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
+                        if (size < 0 || size > MAX_MSG_SIZE)
+                            ~~~~ ^ ~
+../../../../../../../workspace/sources/dpdk-dev-libibverbs/examples/intf.c:1901:12: error: comparison of unsigned enum expression < 0 is always false [-Werror,-Wtautological-compare]
+                        if (mtu < 0)
+                            ~~~ ^ ~
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+---
+Upstream-Status: Pending
+
+ examples/intf.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/examples/intf.c b/examples/intf.c
+index 8d158ee..1f1af50 100644
+--- a/examples/intf.c
++++ b/examples/intf.c
+@@ -1218,7 +1218,7 @@ int create_resources(struct intf_context *ctx)
+ 		return 1;
+ 	}
+ 
+-	if (!ctx->dev_name) {
++	if (!ctx->dev_name[0]) {
+ 		ctx->ib_dev = *dev_list;
+ 		if (!ctx->ib_dev) {
+ 			fprintf(stderr, "No IB devices found\n");
+@@ -1828,7 +1828,7 @@ int parse_input(struct intf_input *input, struct intf_input *default_input, int
+ 	char *ib_devname = NULL;
+ 	char *vrbs_intf = NULL;
+ 	char *cpus_str = NULL;
+-	unsigned long long size;
++	long long size;
+ 
+ 	memcpy(input, default_input, sizeof(*input));
+ 
+@@ -1898,7 +1898,7 @@ int parse_input(struct intf_input *input, struct intf_input *default_input, int
+ 
+ 		case 'm':
+ 			mtu = mtu_to_enum(strtol(optarg, NULL, 0));
+-			if (mtu < 0)
++			if ((int)mtu < 0)
+ 				goto print_usage;
+ 			input->ib_data.mtu = mtu;
+ 			break;
+-- 
+2.14.1
+
-- 
2.14.1



More information about the meta-intel mailing list