From c886f4263a34ea083511c3a0a0206f5ba8a34934 Mon Sep 17 00:00:00 2001 From: Thomas Monjalon Date: Tue, 21 Jan 2020 15:35:31 +0100 Subject: [PATCH] mk: ignore missing field initializers warning Three warnings are commonly disabled in DPDK with make and meson: * address-of-packed-member always disabled * missing-field-initializers disabled with meson disabled with make + clang or make + gcc < 4.7 disabled with make + gcc <= 5 for test files and event drivers * packed-not-aligned disabled with meson This change is removing exceptions for missing-field-initializers. As it is always disabled, some redundant configs are cleaned up. Now the situation is: * address-of-packed-member always disabled * missing-field-initializers always disabled * packed-not-aligned disabled with meson It could alternatively be decided to disable missing-field-initializers only for old gcc (< 6). The warning packed-not-aligned is not modified in this change. Signed-off-by: Thomas Monjalon Acked-by: Ferruh Yigit --- app/test/Makefile | 7 ------- drivers/event/opdl/Makefile | 7 ------- drivers/event/sw/Makefile | 7 ------- drivers/net/fm10k/Makefile | 2 -- drivers/net/i40e/Makefile | 2 -- drivers/net/ionic/Makefile | 3 --- drivers/net/ionic/meson.build | 10 ---------- mk/toolchain/clang/rte.vars.mk | 2 +- mk/toolchain/gcc/rte.vars.mk | 4 +--- 9 files changed, 2 insertions(+), 42 deletions(-) diff --git a/app/test/Makefile b/app/test/Makefile index d955dbb03f..b9bb3a74b2 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -258,13 +258,6 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1) CFLAGS_test_memcpy.o += -fno-var-tracking-assignments CFLAGS_test_memcpy_perf.o += -fno-var-tracking-assignments -# for older GCC versions, allow us to initialize an event using -# designated initializers. -ifeq ($(shell test $(GCC_VERSION) -le 50 && echo 1), 1) -CFLAGS_test_eventdev_sw.o += -Wno-missing-field-initializers -CFLAGS_test_event_timer_adapter.o += -Wno-missing-field-initializers -CFLAGS_test_event_crypto_adapter.o += -Wno-missing-field-initializers -endif endif endif diff --git a/drivers/event/opdl/Makefile b/drivers/event/opdl/Makefile index fb87c7d0d4..1dfd6f5e83 100644 --- a/drivers/event/opdl/Makefile +++ b/drivers/event/opdl/Makefile @@ -10,13 +10,6 @@ LIB = librte_pmd_opdl_event.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) CFLAGS += -DALLOW_EXPERIMENTAL_API -# for older GCC versions, allow us to initialize an event using -# designated initializers. -ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) -ifeq ($(shell test $(GCC_VERSION) -le 50 && echo 1), 1) -CFLAGS += -Wno-missing-field-initializers -endif -endif LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs LDLIBS += -lrte_bus_vdev -lrte_mbuf -lrte_mempool diff --git a/drivers/event/sw/Makefile b/drivers/event/sw/Makefile index 17937e295e..8ea5cceb8b 100644 --- a/drivers/event/sw/Makefile +++ b/drivers/event/sw/Makefile @@ -9,13 +9,6 @@ LIB = librte_pmd_sw_event.a # build flags CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) -# for older GCC versions, allow us to initialize an event using -# designated initializers. -ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) -ifeq ($(shell test $(GCC_VERSION) -le 50 && echo 1), 1) -CFLAGS += -Wno-missing-field-initializers -endif -endif LDLIBS += -lrte_eal -lrte_eventdev -lrte_kvargs -lrte_ring LDLIBS += -lrte_mempool -lrte_mbuf LDLIBS += -lrte_bus_vdev diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile index 722bf1ee04..0271bcb15e 100644 --- a/drivers/net/fm10k/Makefile +++ b/drivers/net/fm10k/Makefile @@ -29,7 +29,6 @@ else ifeq ($(CONFIG_RTE_TOOLCHAIN_CLANG),y) CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args CFLAGS_BASE_DRIVER += -Wno-unused-variable -CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers else # @@ -38,7 +37,6 @@ else CFLAGS_BASE_DRIVER = -Wno-unused-parameter -Wno-unused-value CFLAGS_BASE_DRIVER += -Wno-strict-aliasing -Wno-format-extra-args CFLAGS_BASE_DRIVER += -Wno-unused-variable -CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers ifeq ($(shell test $(GCC_VERSION) -ge 44 && echo 1), 1) CFLAGS += -Wno-deprecated diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile index 435eb511ad..819473abac 100644 --- a/drivers/net/i40e/Makefile +++ b/drivers/net/i40e/Makefile @@ -31,7 +31,6 @@ CFLAGS_BASE_DRIVER += -Wno-unused-value CFLAGS_BASE_DRIVER += -Wno-unused-parameter CFLAGS_BASE_DRIVER += -Wno-strict-aliasing CFLAGS_BASE_DRIVER += -Wno-format -CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast CFLAGS_BASE_DRIVER += -Wno-format-nonliteral CFLAGS_BASE_DRIVER += -Wno-unused-variable @@ -41,7 +40,6 @@ CFLAGS_BASE_DRIVER += -Wno-unused-value CFLAGS_BASE_DRIVER += -Wno-unused-parameter CFLAGS_BASE_DRIVER += -Wno-strict-aliasing CFLAGS_BASE_DRIVER += -Wno-format -CFLAGS_BASE_DRIVER += -Wno-missing-field-initializers CFLAGS_BASE_DRIVER += -Wno-pointer-to-int-cast CFLAGS_BASE_DRIVER += -Wno-format-nonliteral CFLAGS_BASE_DRIVER += -Wno-format-security diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile index bfbe15e27b..f74ac2d34f 100644 --- a/drivers/net/ionic/Makefile +++ b/drivers/net/ionic/Makefile @@ -31,7 +31,4 @@ SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_lif.c SRCS-$(CONFIG_RTE_LIBRTE_IONIC_PMD) += ionic_main.c -CFLAGS_ionic_dev.o += -Wno-missing-field-initializers -CFLAGS_ionic_lif.o += -Wno-missing-field-initializers - include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/net/ionic/meson.build b/drivers/net/ionic/meson.build index 06b7760180..1c6362d27c 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -10,13 +10,3 @@ sources = files( 'ionic_lif.c', 'ionic_main.c' ) - -error_cflags = [ - '-Wno-missing-field-initializers', -] - -foreach flag: error_cflags - if cc.has_argument(flag) - c_args += flag - endif -endforeach diff --git a/mk/toolchain/clang/rte.vars.mk b/mk/toolchain/clang/rte.vars.mk index 3c49dc568d..d441f6d8f3 100644 --- a/mk/toolchain/clang/rte.vars.mk +++ b/mk/toolchain/clang/rte.vars.mk @@ -48,7 +48,7 @@ endif # process cpu flags include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk -# workaround clang bug with warning "missing field initializer" for "= {0}" +# disable warning for non-initialised fields WERROR_FLAGS += -Wno-missing-field-initializers # disable packed member unalign warnings diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk index 9fc704193b..f19305e495 100644 --- a/mk/toolchain/gcc/rte.vars.mk +++ b/mk/toolchain/gcc/rte.vars.mk @@ -74,10 +74,8 @@ WERROR_FLAGS += -Wno-lto-type-mismatch endif endif -# workaround GCC bug with warning "missing initializer" for "= {0}" -ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) +# disable warning for non-initialised fields WERROR_FLAGS += -Wno-missing-field-initializers -endif # workaround GCC bug with warning "may be used uninitialized" ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) WERROR_FLAGS += -Wno-uninitialized -- 2.20.1