Re: [PATCH 2/2] tools: Add -Wno-missing-field-initializers to for clang
From: Nick Desaulniers
Date: Tue May 11 2021 - 14:23:32 EST
On Tue, May 11, 2021 at 8:02 AM Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:
>
> 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>
Seems fine, it's only enabled for the kernel at W=2 anyways.
Acked-by: Nick Desaulniers <ndesaulniers@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
>
--
Thanks,
~Nick Desaulniers