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

Eric Engestrom eric.engestrom at intel.com
Fri Jun 8 09:29:12 UTC 2018


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',
+            ]
   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


More information about the mesa-dev mailing list