From 52f0e9c136d7f5acf8dd1991d9644ed0fa28888e Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Tue, 21 Jan 2020 09:58:01 +0000 Subject: [PATCH] net/ionic: ignore missing field initializers warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The compiler warning is: from .../drivers/net/ionic/ionic_dev.c:7: .../drivers/net/ionic/ionic_if.h:202:5: note: ‘rsvd’ declared here u8 rsvd[62]; ^ This has been observed with gcc 4.8.5, newer 9+ compiler are not giving this warning. Warning is a reminder to the user that there are some fields in the struct not initialized with the default value. But the C standard clarifies that in that case the field value will be zero and code is aware of this behavior, so no initializing to a default value is intentional and it is safe to ignore this compiler warning. Adding '-Wno-missing-field-initializers' compiler flag to disable the warning. Reported-by: Anoob Joseph Reported-by: Raslan Darawsheh Reported-by: Xueming Zhang Signed-off-by: Ferruh Yigit --- drivers/net/ionic/Makefile | 3 +++ drivers/net/ionic/meson.build | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/net/ionic/Makefile b/drivers/net/ionic/Makefile index f74ac2d34f..bfbe15e27b 100644 --- a/drivers/net/ionic/Makefile +++ b/drivers/net/ionic/Makefile @@ -31,4 +31,7 @@ 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 dee8a36088..06b7760180 100644 --- a/drivers/net/ionic/meson.build +++ b/drivers/net/ionic/meson.build @@ -11,3 +11,12 @@ sources = files( 'ionic_main.c' ) +error_cflags = [ + '-Wno-missing-field-initializers', +] + +foreach flag: error_cflags + if cc.has_argument(flag) + c_args += flag + endif +endforeach -- 2.20.1