[Mesa-dev] [PATCH 01/24] configure.ac: Add CFLAG -Wno-missing-field-initializers

Dylan Baker dylan at pnwbakers.com
Fri Jun 8 16:38:34 UTC 2018


Quoting Eric Engestrom (2018-06-08 02:29:12)
> On Tuesday, 2018-06-05 13:58:44 +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.
> > 
> > Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
> > ---
> >  configure.ac | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 02dca4547c..7d71e0ee4e 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -301,7 +301,9 @@ 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"])
> > +AX_CHECK_COMPILE_FLAG([-Wno-missing-field-initializers],       [CFLAGS="$CFLAGS -Wno-missing-field-initializers"])
> >  AX_CHECK_COMPILE_FLAG([-fno-math-errno],                       [CFLAGS="$CFLAGS -fno-math-errno"])
> > +
> 
> ^ stray empty line
> 
> Please also add this in this patch :)
> 
> ----8<----
> diff --git a/meson.build b/meson.build
> index 03aa54fe701375c90bd8..405a5faff9604eb1e14e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -735,7 +735,9 @@ endif
>  c_args = []
>  foreach a : ['-Wall', '-Werror=implicit-function-declaration',
>               '-Werror=missing-prototypes', '-fno-math-errno',
> -             '-fno-trapping-math', '-Qunused-arguments']
> +             '-fno-trapping-math', '-Qunused-arguments',
> +             '-Wno-missing-field-initializers',

This won't work correctly, gcc and clang always report that -Wno- works. There's
another list in the meson build that takes 'missing-field-initializers' as an
argument andtests with -W and then adds -Wno- to the pre_args instead.

> +            ]
>    if cc.has_argument(a)
>      c_args += a
>    endif
> ---->8----
> 
> >  AX_CHECK_COMPILE_FLAG([-fno-trapping-math],                    [CFLAGS="$CFLAGS -fno-trapping-math"])
> >  AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],                   [VISIBILITY_CFLAGS="-fvisibility=hidden"])
> >  
> > -- 
> > 2.16.4
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180608/be7e8c8a/attachment.sig>


More information about the mesa-dev mailing list