build: disable gcc 10 zero-length-bounds warning

gcc 10 issues warnings about the use of rearm_data marker
from struct rte_mbuf.

e.g.
../drivers/net/enic/enic_rxtx_vec_avx2.c: In function ‘rx_one’:
../drivers/net/enic/enic_rxtx_vec_avx2.c:21:2:
warning:
array subscript 0 is outside the bounds of an interior zero-length array
‘RTE_MARKER64’ {aka ‘long unsigned int[0]’} [-Wzero-length-bounds]
   21 |  *(uint64_t *)&mb->rearm_data = enic->mbuf_initializer;
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../lib/librte_mbuf/rte_mbuf.h:45,
                 from ../drivers/net/enic/enic_rxtx_vec_avx2.c:6:
../lib/librte_mbuf/rte_mbuf_core.h:484:15:
note: while referencing ‘rearm_data’
  484 |  RTE_MARKER64 rearm_data;
      |

Disable this warning for gcc 10 in order to allow v20.05 to build
without changes to struct rte_mbuf.

Bugzilla ID: 396
Cc: stable@dpdk.org

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
Kevin Traynor 2020-05-14 14:18:57 +01:00 committed by David Marchand
parent 572f2a9089
commit cfacbcb5a2
2 changed files with 9 additions and 0 deletions

View file

@ -208,6 +208,10 @@ warning_flags = [
'-Wno-packed-not-aligned',
'-Wno-missing-field-initializers'
]
if cc.get_id() == 'gcc' and cc.version().version_compare('>=10.0')
# FIXME: Bugzilla 396
warning_flags += '-Wno-zero-length-bounds'
endif
if not dpdk_conf.get('RTE_ARCH_64')
# for 32-bit, don't warn about casting a 32-bit pointer to 64-bit int - it's fine!!
warning_flags += '-Wno-pointer-to-int-cast'

View file

@ -81,6 +81,11 @@ ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1)
WERROR_FLAGS += -Wno-uninitialized
endif
ifeq ($(shell test $(GCC_VERSION) -ge 100 && echo 1), 1)
# FIXME: Bugzilla 396
WERROR_FLAGS += -Wno-zero-length-bounds
endif
HOST_WERROR_FLAGS := $(WERROR_FLAGS)
ifeq ($(shell test $(HOST_GCC_VERSION) -gt 70 && echo 1), 1)