From f315410543a023f8ae6ed352a342fac961d4cfa4 Mon Sep 17 00:00:00 2001 From: Lijian Zhang Date: Tue, 7 Aug 2018 11:11:58 +0800 Subject: fix compiling warnings with GCC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 7 plus Ubuntu-16.04 default ccache 3.2.4 reports warnings on switch case fall-through code, which is commonly seen in DPDK code, which will cause image building failure finally. It requires newer ccache version to support -Wimplicit-fallthrough. To suppress the warning, if GCC is version 7 or higher, and it's old ccache version, will disable the fall-through check. dpdk-18.05/drivers/net/ark/ark_ethdev_rx.h:39:0, from dpdk-18.05/drivers/net/ark/ark_ethdev_rx.c:36: dpdk-18.05/arm64-armv8a-linuxapp-gcc/include/rte_mbuf.h: In function ‘rte_pktmbuf_alloc_bulk’: dpdk-18.05/arm64-armv8a-linuxapp-gcc/include/rte_mbuf.h:1292:7: error: this statement may fall through [-Werror=implicit-fallthrough=] idx++; ~~~^~ Change-Id: I4d12492471fadef9d349ba9e853a6799512f76f5 Signed-off-by: Lijian Zhang --- dpdk/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dpdk/Makefile b/dpdk/Makefile index 053fe765205..a1e2cb08b4e 100644 --- a/dpdk/Makefile +++ b/dpdk/Makefile @@ -164,6 +164,21 @@ else DPDK_EXTRA_CFLAGS := -g -O0 endif +# -Wimplicit-fallthrough was introduced starting from GCC 7, +# and it requires newer version of ccache. +# Disable fallthrough warning for old ccache version. +ifeq ($(DPDK_CC),gcc) +GCC_VER_V = "7.0.0" +CCACHE_VER_V = "3.4.1" +GCC_VER = $(shell gcc --version | grep ^gcc | sed 's/^.* //g') +CCACHE_VER = $(shell ccache --version | grep ^ccache | sed 's/^.* //g') +ifeq ($(shell expr "$(GCC_VER)" ">=" "$(GCC_VER_V)"),1) +ifeq ($(shell expr "$(CCACHE_VER)" "<" "$(CCACHE_VER_V)"),1) +DPDK_EXTRA_CFLAGS += -Wimplicit-fallthrough=0 +endif +endif +endif + ifeq ($(AESNI),y) IPSEC_MB_BUILD_PATH := $(B)/intel-ipsec-mb-$(IPSEC_MB_VER) DPDK_EXTRA_CFLAGS += -L$(IPSEC_MB_BUILD_PATH) -I$(IPSEC_MB_BUILD_PATH) -- cgit 1.2.3-korg