examples: fix clang compilation issues
PATCH 1/1 examples: fix clang compilation issues
Contains adjustments to some warnings which prevent examples from compiling under clang.
Contains ability to override RTE_SDK_BIN in rte.extvars.mk, without which it's impossible to compile the examples against DPDK if it compiled into any build directory not named identically to the RTE_TARGET.
A message that is not in the archive (sent off-list or not yet received): 1405914461-19335-1-git-send-email-mhall-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org
PATCH 1/4 l3fwd: some functions are unused in l3fwd-acl
--- examples/l3fwd/Makefile | 1 + 1 file changed, 1 insertion(+)
examples/l3fwd/Makefile +1 -0
@@ -46,6 +46,7 @@ SRCS-y := main.c CFLAGS += -O3 $(USER_FLAGS) CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-unused-function # workaround for a gcc bug with noreturn attribute # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): 1405914461-19335-2-git-send-email-mhall-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org
Re: [PATCH 1/4] l3fwd: some functions are unused in l3fwd-acl
Hi,
2014-07-20 20:47, Matthew Hall:
Quoted 1 line
+CFLAGS += -Wno-unused-function
I think it's better to fix the code instead of removing a warning. If there is a very good reason to not do it, it would appear in the log.
Thanks
Signature · 1 line
Thomas
Re: [PATCH 1/4] l3fwd: some functions are unused in l3fwd-acl
The same code is used in l3fwd and l3fwd-acl. When it is reused in l3fwd-acl a packet processing function from original l3fwd is not used any more.
Signature · 1 line
Sent from my mobile device.
Quoted 10 lines · Thomas Monjalon
Hi,
2014-07-20 20:47, Matthew Hall:
Quoted 1 line
+CFLAGS += -Wno-unused-function
I think it's better to fix the code instead of removing a warning. If there is a very good reason to not do it, it would appear in the log.
Thanks
Re: [PATCH 1/4] l3fwd: some functions are unused in l3fwd-acl
In reply to a message not in the archiveQuoted 16 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Matthew Hall
Sent: Sunday, July 20, 2014 8:48 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/4] l3fwd: some functions are unused in l3fwd-aclSigned-off-by Matthew Hall <[email protected]>--- examples/l3fwd/Makefile | 1 + 1 file changed, 1 insertion(+)examples/l3fwd/Makefile +0
-0
examples/l3fwd/Makefile SRCS-y := main.c · line 50
Quoted 5 lines
examples/l3fwd/Makefile +1
-0@@ -46,6 +46,7 @@ SRCS-y := main.c CFLAGS += -O3 $(USER_FLAGS) CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-unused-function
Rather than disabling the warnings, would it not be better to remove the functions entirely from the compile? I would assume that these are functions for one leg of the l3fwd code (e.g. hash lookup vs lpm lookup) that are not used in the other leg of the code, in which case the proper fix should be to add some more #ifdefs, right?
/Bruce
PATCH 2/4 virtio-net.c: incorrect parens around equality check
In reply to a message not in the archive--- examples/vhost/virtio-net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
examples/vhost/virtio-net.c +2 -2
@@ -280,8 +280,8 @@ get_config_ll_entry(struct vhost_device_ctx ctx)/* Loop through linked list until the device_fh is found. */ while (ll_dev !=NULL ) { -if ((ll_dev->dev.device_fh == ctx.fh)) -return ll_dev; +if (ll_dev->dev.device_fh == ctx.fh) +return ll_dev; ll_dev = ll_dev->next; }
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): 1405914461-19335-3-git-send-email-mhall-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org
Thomas Monjalon
Acked-byRe: [PATCH 2/4] virtio-net.c: incorrect parens around equality check
Hi Matthew,
I think that patches 1, 3 and 4 need some rework but this one is valid and has no relation with other ones in the serie. So it can be integrated now.
2014-07-20 20:47, Matthew Hall:
examples/vhost/virtio-net.c get_config_ll_entry(struct vhost_device_ctx ctx) · line 286
Quoted 12 lines
examples/vhost/virtio-net.c +2
-2@@ -280,8 +280,8 @@ get_config_ll_entry(struct vhost_device_ctx ctx)/* Loop through linked list until the device_fh is found. */ while (ll_dev !=NULL ) { -if ((ll_dev->dev.device_fh == ctx.fh)) -return ll_dev; +if (ll_dev->dev.device_fh == ctx.fh) +return ll_dev; ll_dev = ll_dev->next; }
Applied for version 1.7.1.
Thanks
Signature · 1 line
Thomas
Re: [PATCH 2/4] virtio-net.c: incorrect parens around equality check
Quoted 4 lines · Thomas Monjalon
Hi Matthew,
I think that patches 1, 3 and 4 need some rework but this one is valid and has no relation with other ones in the serie. So it can be integrated now.
Great thanks!
I'll work a bit more on the others when I've got time.
Discovered them during a weekend Open Source project.
Matthew.
PATCH 3/4 examples/*: -Wno-switch required for weird ioctl() ID's
In reply to a message not in the archive--- examples/multi_process/client_server_mp/mp_client/Makefile | 1 + examples/multi_process/client_server_mp/mp_server/Makefile | 1 + examples/multi_process/l2fwd_fork/Makefile | 1 + examples/multi_process/simple_mp/Makefile | 1 + examples/multi_process/symmetric_mp/Makefile | 1 + examples/netmap_compat/Makefile | 2 ++ examples/netmap_compat/bridge/Makefile | 1 + examples/vhost/Makefile | 1 + 8 files changed, 9 insertions(+)
examples/multi_process/client_server_mp/mp_client/Makefile +1 -0
@@ -43,6 +43,7 @@ APP = mp_client SRCS-y := client.c CFLAGS += $(WERROR_FLAGS) -O3 +CFLAGS += -Wno-switch CFLAGS += -I$(SRCDIR)/../shared include $(RTE_SDK)/mk/rte.extapp.mk
examples/multi_process/client_server_mp/mp_server/Makefile +1 -0
@@ -52,6 +52,7 @@ SRCS-y := main.c init.c args.c INC := $(wildcard *.h) CFLAGS += $(WERROR_FLAGS) -O3 +CFLAGS += -Wno-switch CFLAGS += -I$(SRCDIR)/../shared # for newer gcc, e.g. 4.4, no-strict-aliasing may not be necessary
examples/multi_process/l2fwd_fork/Makefile +1 -0
@@ -46,5 +46,6 @@ SRCS-y := main.c flib.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-switch include $(RTE_SDK)/mk/rte.extapp.mk
examples/multi_process/simple_mp/Makefile +1 -0
@@ -46,5 +46,6 @@ SRCS-y := main.c mp_commands.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-switch include $(RTE_SDK)/mk/rte.extapp.mk
examples/multi_process/symmetric_mp/Makefile +1 -0
@@ -46,5 +46,6 @@ SRCS-y := main.c CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-switch include $(RTE_SDK)/mk/rte.extapp.mk
examples/netmap_compat/Makefile +2 -0
@@ -38,6 +38,8 @@ unexport RTE_SRCDIR RTE_OUTPUT RTE_EXTMK DIRS-y += bridge +CFLAGS += -Wno-switch + .PHONY: all clean $(DIRS-y) all: $(DIRS-y)
examples/netmap_compat/bridge/Makefile +1 -0
@@ -56,6 +56,7 @@ SRCS-y += compat_netmap.c CFLAGS += -O3 -I$(SRCDIR)/../lib -I$(SRCDIR)/../netmap CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-switch include $(RTE_SDK)/mk/rte.extapp.mk
examples/vhost/Makefile +1 -0
@@ -53,6 +53,7 @@ SRCS-y := main.c virtio-net.c vhost-net-cdev.c CFLAGS += -O2 -I/usr/local/include -D_FILE_OFFSET_BITS=64 -Wno-unused-parameter CFLAGS += $(WERROR_FLAGS) +CFLAGS += -Wno-switch LDFLAGS += -lfuse include $(RTE_SDK)/mk/rte.extapp.mk
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): 1405914461-19335-4-git-send-email-mhall-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org
Re: [PATCH 3/4] examples/*: -Wno-switch required for weird ioctl() ID's
2014-07-20 20:47, Matthew Hall:
Quoted 1 line
+CFLAGS += -Wno-switch
As I said for patch 1/4,
I think it's better to fix the code instead of removing a warning. If there is a very good reason to not do it, it would appear in the log.
Thanks
Signature · 1 line
Thomas
PATCH 4/4 rte.extvars.mk: allow user to override RTE_SDK_BIN
In reply to a message not in the archiveWithout this patch it is impossible to compile the examples if you have compiled the DPDK into the $(RTE_SDK)/build directory, or any other one besides $(RTE_SDK)/$(RTE_TARGET).
--- mk/rte.extvars.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mk/rte.extvars.mk +1 -1
@@ -51,7 +51,7 @@ endif RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile export RTE_EXTMK -RTE_SDK_BIN := $(RTE_SDK)/$(RTE_TARGET) +RTE_SDK_BIN ?= $(RTE_SDK)/$(RTE_TARGET) # # Output files wil go in a separate directory: default output is
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): 1405914461-19335-5-git-send-email-mhall-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org
Re: [PATCH 4/4] rte.extvars.mk: allow user to override RTE_SDK_BIN
Hi,
2014-07-20 20:47, Matthew Hall:
Quoted 3 lines
Without this patch it is impossible to compile the examples if you have compiled the DPDK into the $(RTE_SDK)/build directory, or any other one besides $(RTE_SDK)/$(RTE_TARGET).
Please, could you explain why is it impossible in your case?
The standard usage is:
make T=x86_64-native-linuxapp-gcc install
make T=x86_64-native-linuxapp-gcc examples O=x86_64-native-linuxapp-gcc/examples
If you don't want to use install mode, you can build like this:
make config T=x86_64-native-linuxapp-gcc make make -C examples RTE_SDK=$(pwd) RTE_TARGET=build O=$(readlink -m build/examples)
mk/rte.extvars.mk endif · line 54
Quoted 4 lines
mk/rte.extvars.mk +1
-1-RTE_SDK_BIN := $(RTE_SDK)/$(RTE_TARGET) +RTE_SDK_BIN ?= $(RTE_SDK)/$(RTE_TARGET)
I don't understand why this change could help.
You can even use this:
make -C examples RTE_SDK=$(pwd) RTE_SDK_BIN=$(pwd)/build O=$(readlink -m build/examples)
without the patch because command line override variables.
Note that O= is optional.
Signature · 1 line
Thomas