From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: Re: [PATCH 01/10] mk: adjust gcc flags for new gcc 7 warnings Date: Fri, 5 May 2017 11:20:11 +0100 Message-ID: <20170505102011.GA41052@bricha3-MOBL3.ger.corp.intel.com> References: <20170504153822.19461-1-bruce.richardson@intel.com> <20170504093808.12ea9c07@xeon-e3> <20170505094213.GA42716@bricha3-MOBL3.ger.corp.intel.com> <1947779.Ji6X4lE9fr@xps> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, Stephen Hemminger To: Thomas Monjalon Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 8D3722C18 for ; Fri, 5 May 2017 12:20:16 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1947779.Ji6X4lE9fr@xps> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, May 05, 2017 at 12:02:44PM +0200, Thomas Monjalon wrote: > In this series, there are some fixes for fall-through comments, > missing break and missing initializers. > I think there is no discussion about accepting them in 17.05. > The last item to discuss it the new snprintf warning: > > 05/05/2017 11:42, Bruce Richardson: > > On Thu, May 04, 2017 at 09:38:08AM -0700, Stephen Hemminger wrote: > > > On Thu, 4 May 2017 16:38:13 +0100 > > > Bruce Richardson wrote: > > > > 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. > [...] > > > > --- a/mk/toolchain/gcc/rte.vars.mk > > > > +++ b/mk/toolchain/gcc/rte.vars.mk > > > > +# Ignore errors for snprintf truncation > > > > +WERROR_FLAGS += -Wno-format-truncation > [...] > > 2. for the format truncation warning, ideally, yes we should fix the > > code, except that I don't believe this is feasible in the short term, > > and I also don't believe it is desirable. We extensively use snprintf > > because it has sane/safe truncation, and in many cases we don't care if > > it is being truncated. Therefore disabling the warning seems the best > > approach to me. Furthermore, if we want 17.05 to compile with GCC 7, > > this is the best option within that timeframe. > > We could imagine an explicit ignore of the return code. > However, do we really want this new coding rule for every snprintf? > It is a common call in DPDK: > git grep '\' | wc -l > 774 > And probably almost never checked: > git grep '^[[:space:]]*\' | wc -l > 660 > > I suggest to disable this new warning in GCC 7. > Any opinions? I'd suggest that even fewer than that are actually recorded, let alone checked: git grep '= *snprintf\>' | wc -l 89 So I'm (obviously) +1 for dropping this warning check. /Bruce