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

Gert Wollny gw.fossdev at gmail.com
Fri Jun 8 11:02:34 UTC 2018


From: Gert Wollny <gert.wollny at collabora.com>

This warning is misleading: When a struct is partially initialized without
assigning to the struture members by name, then the un-initialized 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, so heeding this warning would be counter-productive.

v2: - add -Wno-missing-field-initializers to meson-build
    - fix empty line error
    (both Eric Engestrom)

Reviewed-by: Marek Olšák <marek.olsak at amd.com> (v1)
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
resent to attach it to the proper thread in patchwork 

 configure.ac | 1 +
 meson.build  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 02dca4547c..94fc13187d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,6 +301,7 @@ 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"])
 AX_CHECK_COMPILE_FLAG([-fno-trapping-math],                    [CFLAGS="$CFLAGS -fno-trapping-math"])
 AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],                   [VISIBILITY_CFLAGS="-fvisibility=hidden"])
diff --git a/meson.build b/meson.build
index 7b7c118d77..1c02599106 100644
--- a/meson.build
+++ b/meson.build
@@ -737,7 +737,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
-- 
2.16.4



More information about the mesa-dev mailing list