From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 3D08A7CD1 for ; Thu, 4 May 2017 17:38:31 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 May 2017 08:38:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,287,1491289200"; d="scan'208";a="97638716" Received: from sivswdev01.ir.intel.com ([10.237.217.45]) by fmsmga006.fm.intel.com with ESMTP; 04 May 2017 08:38:29 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Date: Thu, 4 May 2017 16:38:13 +0100 Message-Id: <20170504153822.19461-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20170504153822.19461-1-bruce.richardson@intel.com> References: <20170504153822.19461-1-bruce.richardson@intel.com> Subject: [dpdk-dev] [PATCH 01/10] mk: adjust gcc flags for new gcc 7 warnings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2017 15:38:31 -0000 There are two new warnings in GCC 7 that cause problems in the DPDK compile. 1. GCC now warns if you have a switch fall-through without a suitable comment indicating that it was intentional. The compiler supports a number of levels of warning which are triggered depending on the type of message used, with level 3 being the default. To accept a wider range of possible fall-through messages, we adjust this down to level 2. 2. GCC also warns about an snprintf where there may be truncation and the return value is not checked. Given that we often use snprintf in DPDK in place of strncpy, and in many cases where truncation is not a problem, we can just disable this particular warning. Signed-off-by: Bruce Richardson --- mk/toolchain/gcc/rte.vars.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk index 5caa600..3834e00 100644 --- a/mk/toolchain/gcc/rte.vars.mk +++ b/mk/toolchain/gcc/rte.vars.mk @@ -99,5 +99,12 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) WERROR_FLAGS += -Wno-uninitialized endif +ifeq ($(shell test $(GCC_VERSION) -gt 70 && echo 1), 1) +# Tell GCC only to error for switch fallthroughs without a suitable comment +WERROR_FLAGS += -Wimplicit-fallthrough=2 +# Ignore errors for snprintf truncation +WERROR_FLAGS += -Wno-format-truncation +endif + export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS -- 2.9.3