[PATCH 2/2] tools: Add -Wno-missing-field-initializers to for clang

From: Masami Hiramatsu
Date: Tue May 11 2021 - 11:02:50 EST


Since clang's -Wmissing-field-initializers warns valid syntax of
initializing data structure (e.g. initializing static data
structure with single NULL, the rest of fields are initialized
with zero), it is better to disable this warning option
for clang for now.
This can stop building perf because -Werror is also specified.

Note that same issue on gcc has been fixed in 4.7.0, so we don't need
this for gcc.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750

Signed-off-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
---
tools/scripts/Makefile.include | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index f9271f3ea912..4fd5d33ded03 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -89,6 +89,10 @@ ifeq ($(CC_NO_CLANG), 1)
EXTRA_WARNINGS += -Wstrict-aliasing=3
endif

+ifneq ($(CC_NO_CLANG), 1)
+EXTRA_WARNINGS += -Wno-missing-field-initializers
+endif
+
# Hack to avoid type-punned warnings on old systems such as RHEL5:
# We should be changing CFLAGS and checking gcc version, but this
# will do for now and keep the above -Wstrict-aliasing=3 in place