Quoting Gert Wollny (2018-06-11 09:05:52) > Am Montag, den 11.06.2018, 11:05 +0100 schrieb Eric Engestrom: > > On Monday, 2018-06-11 11:33:20 +0200, Gert Wollny wrote: > > > This warning is misleading: When a struct is partially initialized > > > without > > > assigning to the structure members by name, then the remaining > > > fields > > > will be zeroed out, and this warning will be issued (if enabled). > > > If, on the > > > other hand, the partial initialization is done by assigning to > > > named members, > > > the remaining structure elements may hold random data, but the > > > warning is not > > > issued. Since in Mesa the first approach to initialize structure > > > elements is > > > used very often, and it is usually assumed that the remaining > > > elements are > > > zeroed out, heeding this warning would be counter-productive. > > > > > > v2: - add -Wno-missing-field-initializers to meson-build > > > - fix empty line error > > > (both Eric Engestrom) > > > > > > v3: * check for -Wmissing-field-initializers warning and then > > > disable it > > > because gcc and clang always accept -Wno-* (Dylan Baker) > > > * Also disable this warning for C++ > > > > > > Reviewed-by: Marek Ol\u0161ák <marek.ol...@amd.com> (v1) > > > Reviewed-by: Emil Velikov <emil.veli...@collabora.com> (v2) > > > Signed-off-by: Gert Wollny <gert.wol...@collabora.com> > > > --- > > > configure.ac | 4 ++++ > > > meson.build | 11 +++++++---- > > > 2 files changed, 11 insertions(+), 4 deletions(-) > > > > > > diff --git a/configure.ac b/configure.ac > > > index 75ee1a7c01..6a9e56f974 100644 > > > --- a/configure.ac > > > +++ b/configure.ac > > > @@ -302,7 +302,10 @@ AX_CHECK_COMPILE_FLAG([- > > > Wall], [CFLAGS="$CFLAGS > > > AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration], > > > [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"]) > > > AX_CHECK_COMPILE_FLAG([-Werror=missing- > > > prototypes], [CFLAGS="$CFLAGS -Werror=missing- > > > prototypes"]) > > > AX_CHECK_COMPILE_FLAG([-Wmissing- > > > prototypes], [CFLAGS="$CFLAGS -Wmissing- > > > prototypes"]) > > > +dnl Dylan Baker: gcc and clang always accepr -Wno-*, hence check > > > for the original warning, then set the no-* flag > > > +AX_CHECK_COMPILE_FLAG([-Wmissing-field- > > > initializers], [CFLAGS="$CFLAGS -Wno-missing-field- > > > initializers"]) > > > AX_CHECK_COMPILE_FLAG([-fno-math- > > > errno], [CFLAGS="$CFLAGS -fno-math-errno"]) > > > + > > > AX_CHECK_COMPILE_FLAG([-fno-trapping- > > > math], [CFLAGS="$CFLAGS -fno-trapping-math"]) > > > AX_CHECK_COMPILE_FLAG([- > > > fvisibility=hidden], [VISIBILITY_CFLAGS="- > > > fvisibility=hidden"]) > > > > > > @@ -314,6 +317,7 @@ AX_CHECK_COMPILE_FLAG([- > > > Wall], [CXXFLAGS="$CXXFL > > > AX_CHECK_COMPILE_FLAG([-fno-math- > > > errno], [CXXFLAGS="$CXXFLAGS -fno-math- > > > errno"]) > > > AX_CHECK_COMPILE_FLAG([-fno-trapping- > > > math], [CXXFLAGS="$CXXFLAGS -fno-trapping- > > > math"]) > > > AX_CHECK_COMPILE_FLAG([- > > > fvisibility=hidden], [VISIBILITY_CXXFLAGS="- > > > fvisibility=hidden"]) > > > +AX_CHECK_COMPILE_FLAG([-Wmissing-field- > > > initializers], [CFLAGS="$CFLAGS -Wno-missing-field- > > > initializers"]) > > > AC_LANG_POP([C++]) > > > > > > # Flags to help ensure that certain portions of the code -- and > > > only those > > > diff --git a/meson.build b/meson.build > > > index 160bbfa30b..668fa38328 100644 > > > --- a/meson.build > > > +++ b/meson.build > > > @@ -760,12 +760,15 @@ endforeach > > > > > > # For some reason, the test for -Wno-foo always succeeds with gcc, > > > even if the > > > # option is not supported. Hence, check for -Wfoo instead. > > > -if cpp.has_argument('-Wnon-virtual-dtor') > > > - cpp_args += '-Wno-non-virtual-dtor' > > > -endif > > > + > > > +foreach a : ['non-virtual-dtor', 'missing-field-initializers'] > > > + if cpp.has_argument('-W' + a) > > > + cpp_args += '-Wno-' + a > > > + endif > > > +endforeach > > > > > > no_override_init_args = [] > > > -foreach a : ['override-init', 'initializer-overrides'] > > > +foreach a : ['override-init', 'initializer-overrides', 'missing- > > > field-initializers'] > > > > I'm not sure `no_override_init_args` is the right array to put > > `missing-field-initializers` in; maybe you should add a c_args to add > > everywhere? > Sorry, Dylan was talking about a list where the -Wno- flags are tested > so I picked this one, but there is of course the actual c_args list > where this should be added to, I'll send a correction later. > > best, > Gert
Either way I guess, as long as we check for -Wfoo and add -Wno-foo I'm happy. If Eric has somewhere more appropriate I'd defer to that. Dylan
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev