[LTP] [PATCH] config.mk.in: build.sh: Add -Wno-missing-field-initializers to CFLAGS

Zhao Gongyi zhaogongyi@huawei.com
Thu Dec 8 14:03:48 CET 2022


Add CFLAGS -Wno-missing-field-initializers to suppress the
compilation warnings like:

autogroup01.c:87:1: warning: missing initializer for field ‘needs_cmds’ of ‘struct tst_test’ [-Wmissing-field-initializers]
 };
 ^
In file included from autogroup01.c:21:0:
../../../../include/tst_test.h:324:21: note: ‘needs_cmds’ declared here
  const char *const *needs_cmds;
                     ^~~~~~~~~~

Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
 build.sh                | 2 +-
 include/mk/config.mk.in | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build.sh b/build.sh
index 1767cc21b..176701024 100755
--- a/build.sh
+++ b/build.sh
@@ -4,7 +4,7 @@

 set -e

-CFLAGS="${CFLAGS:--Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=return-type -fno-common}"
+CFLAGS="${CFLAGS:--Wformat -Werror=format-security -Werror=implicit-function-declaration -Werror=return-type -fno-common -Wno-missing-field-initializers}"
 CC="${CC:-gcc}"

 DEFAULT_PREFIX="$HOME/ltp-install"
diff --git a/include/mk/config.mk.in b/include/mk/config.mk.in
index 22301e126..6712bf215 100644
--- a/include/mk/config.mk.in
+++ b/include/mk/config.mk.in
@@ -76,7 +76,7 @@ LDFLAGS			:= @LDFLAGS@
 DEBUG_CFLAGS		?= -g

 # for -fstrict-aliasing see doc/build-system-guide.txt
-OPT_CFLAGS		?= -O2 -fno-strict-aliasing -pipe
+OPT_CFLAGS		?= -O2 -fno-strict-aliasing -pipe -Wno-missing-field-initializers

 WCFLAGS			?= -Wall -W @GCC_WARN_OLDSTYLE@

--
2.17.1



More information about the ltp mailing list