DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [dpdk-dev] [PATCH 01/10] mk: adjust gcc flags for new gcc 7 warnings
Date: Fri, 5 May 2017 11:20:11 +0100	[thread overview]
Message-ID: <20170505102011.GA41052@bricha3-MOBL3.ger.corp.intel.com> (raw)
In-Reply-To: <1947779.Ji6X4lE9fr@xps>

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 <bruce.richardson@intel.com> 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 '\<snprintf\>' | wc -l
> 	774
> And probably almost never checked:
> 	git grep '^[[:space:]]*\<snprintf\>' | 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

  reply	other threads:[~2017-05-05 10:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04 15:38 [dpdk-dev] [PATCH 00/10] Enable DPDK core build with gcc 7 Bruce Richardson
2017-05-04 15:38 ` [dpdk-dev] [PATCH 01/10] mk: adjust gcc flags for new gcc 7 warnings Bruce Richardson
2017-05-04 16:38   ` Stephen Hemminger
2017-05-05  9:42     ` Bruce Richardson
2017-05-05 10:02       ` Thomas Monjalon
2017-05-05 10:20         ` Bruce Richardson [this message]
2017-05-05 12:18         ` Van Haaren, Harry
2017-05-04 15:38 ` [dpdk-dev] [PATCH 02/10] drivers/net: disable new gcc 7 warnings for base code Bruce Richardson
2017-05-04 15:38 ` [dpdk-dev] [PATCH 03/10] net/bnx2x: fix warnings about switch fall-through Bruce Richardson
2017-05-04 15:38 ` [dpdk-dev] [PATCH 04/10] net/ixgbe: fix gcc 7 warning for switch fallthrough Bruce Richardson
2017-05-05  0:46   ` Lu, Wenzhuo
2017-05-04 15:38 ` [dpdk-dev] [PATCH 05/10] net/vmxnet3: fix compile error with gcc 7 Bruce Richardson
2017-05-04 16:39   ` Stephen Hemminger
2017-05-04 15:38 ` [dpdk-dev] [PATCH 06/10] lib: fix gcc 7 warnings for switch fall-through Bruce Richardson
2017-05-04 15:38 ` [dpdk-dev] [PATCH 07/10] net: fix missing break inside conditional compile block Bruce Richardson
2017-05-05  9:28   ` Singh, Jasvinder
2017-05-04 15:38 ` [dpdk-dev] [PATCH 08/10] app/testpmd: document explicit switch fall-through Bruce Richardson
2017-05-04 15:38 ` [dpdk-dev] [PATCH 09/10] test/test: fix missing break in switch Bruce Richardson
2017-05-04 15:38 ` [dpdk-dev] [PATCH 10/10] test/test: fix gcc 7 compiler error Bruce Richardson
2017-05-05 16:38 ` [dpdk-dev] [PATCH 00/10] Enable DPDK core build with gcc 7 Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170505102011.GA41052@bricha3-MOBL3.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).