From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 05 May 2017 03:20:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,292,1491289200"; d="scan'208";a="82929575" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.42]) by orsmga002.jf.intel.com with SMTP; 05 May 2017 03:20:13 -0700 Received: by (sSMTP sendmail emulation); Fri, 05 May 2017 11:20:12 +0100 Date: Fri, 5 May 2017 11:20:11 +0100 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org, Stephen Hemminger 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 Content-Disposition: inline In-Reply-To: <1947779.Ji6X4lE9fr@xps> Organization: Intel Research and =?iso-8859-1?Q?De=ACvel?= =?iso-8859-1?Q?opment?= Ireland Ltd. User-Agent: Mutt/1.8.0 (2017-02-23) Subject: Re: [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: Fri, 05 May 2017 10:20:17 -0000 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