DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] mk: fix build for clang 4
@ 2017-04-17 14:35 Ferruh Yigit
  2017-04-17 14:35 ` [dpdk-dev] [PATCH 2/2] eventdev: " Ferruh Yigit
  2017-04-19 13:23 ` [dpdk-dev] [PATCH 1/2] mk: " Thomas Monjalon
  0 siblings, 2 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-04-17 14:35 UTC (permalink / raw)
  To: Ferruh Yigit, Thomas Monjalon, Jerin Jacob; +Cc: dev

clang 4 gives "taking address of packed member may result in an
unaligned pointer value" warnings in a few locations [1].

Disabled "-Waddress-of-packed-member" warning for clang >= 4

[1] build errors:
.../lib/librte_eal/common/eal_common_memzone.c:275:25:
error: taking address of packed member 'mlock' of class or structure
'rte_mem_config' may result in an unaligned pointer value
[-Werror,-Waddress-of-packed-member]
        rte_rwlock_write_lock(&mcfg->mlock);
                               ^~~~~~~~~~~

.../lib/librte_ip_frag/rte_ipv4_reassembly.c:139:31:
error: taking address of packed member 'src_addr' of class or structure
'ipv4_hdr' may result in an unaligned pointer value
[-Werror,-Waddress-of-packed-member]
        psd = (unaligned_uint64_t *)&ip_hdr->src_addr;
                                     ^~~~~~~~~~~~~~~~

.../lib/librte_vhost/vhost_user.c:1037:34:
error: taking address of packed member 'payload' of class or structure
'VhostUserMsg' may result in an unaligned pointer value
[-Werror,-Waddress-of-packed-member]
	vhost_user_set_vring_num(dev, &msg.payload.state);
				       ^~~~~~~~~~~~~~~~~

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 mk/toolchain/clang/rte.vars.mk | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mk/toolchain/clang/rte.vars.mk b/mk/toolchain/clang/rte.vars.mk
index 7749b99..af34c10 100644
--- a/mk/toolchain/clang/rte.vars.mk
+++ b/mk/toolchain/clang/rte.vars.mk
@@ -79,5 +79,10 @@ include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk
 # workaround clang bug with warning "missing field initializer" for "= {0}"
 WERROR_FLAGS += -Wno-missing-field-initializers
 
+# disable packed member unalign warnings
+ifeq ($(shell test $(CLANG_MAJOR_VERSION) -ge 4 && echo 1), 1)
+WERROR_FLAGS += -Wno-address-of-packed-member
+endif
+
 export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF
 export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS
-- 
2.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH 2/2] eventdev: fix build for clang 4
  2017-04-17 14:35 [dpdk-dev] [PATCH 1/2] mk: fix build for clang 4 Ferruh Yigit
@ 2017-04-17 14:35 ` Ferruh Yigit
  2017-04-19 13:23 ` [dpdk-dev] [PATCH 1/2] mk: " Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-04-17 14:35 UTC (permalink / raw)
  To: Ferruh Yigit, Thomas Monjalon, Jerin Jacob; +Cc: dev

build error:
.../lib/librte_eventdev/rte_eventdev.c:371:6:
error: logical not is only applied to the left hand side of this
bitwise operator [-Werror,-Wlogical-not-parentheses]
  if (!dev_conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT)
      ^
Added parentheses after the '!' to evaluate the bitwise operator first.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 lib/librte_eventdev/rte_eventdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 8042988..5875eb0 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -368,7 +368,7 @@ rte_event_dev_configure(uint8_t dev_id,
 	(*dev->dev_ops->dev_infos_get)(dev, &info);
 
 	/* Check dequeue_timeout_ns value is in limit */
-	if (!dev_conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT) {
+	if (!(dev_conf->event_dev_cfg & RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT)) {
 		if (dev_conf->dequeue_timeout_ns < info.min_dequeue_timeout_ns
 			|| dev_conf->dequeue_timeout_ns >
 				 info.max_dequeue_timeout_ns) {
-- 
2.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] mk: fix build for clang 4
  2017-04-17 14:35 [dpdk-dev] [PATCH 1/2] mk: fix build for clang 4 Ferruh Yigit
  2017-04-17 14:35 ` [dpdk-dev] [PATCH 2/2] eventdev: " Ferruh Yigit
@ 2017-04-19 13:23 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-04-19 13:23 UTC (permalink / raw)
  To: Ferruh Yigit, Jerin Jacob; +Cc: dev

17/04/2017 16:35, Ferruh Yigit:
> clang 4 gives "taking address of packed member may result in an
> unaligned pointer value" warnings in a few locations [1].
> 
> Disabled "-Waddress-of-packed-member" warning for clang >= 4
> 
> [1] build errors:
> .../lib/librte_eal/common/eal_common_memzone.c:275:25:
> error: taking address of packed member 'mlock' of class or structure
> 'rte_mem_config' may result in an unaligned pointer value
> [-Werror,-Waddress-of-packed-member]
>         rte_rwlock_write_lock(&mcfg->mlock);
>                                ^~~~~~~~~~~
> 
> .../lib/librte_ip_frag/rte_ipv4_reassembly.c:139:31:
> error: taking address of packed member 'src_addr' of class or structure
> 'ipv4_hdr' may result in an unaligned pointer value
> [-Werror,-Waddress-of-packed-member]
>         psd = (unaligned_uint64_t *)&ip_hdr->src_addr;
>                                      ^~~~~~~~~~~~~~~~
> 
> .../lib/librte_vhost/vhost_user.c:1037:34:
> error: taking address of packed member 'payload' of class or structure
> 'VhostUserMsg' may result in an unaligned pointer value
> [-Werror,-Waddress-of-packed-member]
> 	vhost_user_set_vring_num(dev, &msg.payload.state);
> 				       ^~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Series applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-19 13:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-17 14:35 [dpdk-dev] [PATCH 1/2] mk: fix build for clang 4 Ferruh Yigit
2017-04-17 14:35 ` [dpdk-dev] [PATCH 2/2] eventdev: " Ferruh Yigit
2017-04-19 13:23 ` [dpdk-dev] [PATCH 1/2] mk: " Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).