i965: Use {} to initialize GENX_* structs.
authorRafael Antognolli <rafael.antognolli@intel.com>
Wed, 12 Jul 2017 23:36:03 +0000 (16:36 -0700)
committerRafael Antognolli <rafael.antognolli@intel.com>
Mon, 24 Jul 2017 23:07:25 +0000 (16:07 -0700)
gen4 have commands which start with KernelStartPointer, which is a
struct, so if we initialize it struct = { 0 }, we get warnings on some
compilers:

"GCC (pre 4.9?) can throw a Wmissing-braces on[1] while clang
-Wmissing-field-initializers [2]." - Emil

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
[2] https://bugs.llvm.org/show_bug.cgi?id=21689

This change works around that and will silence such warnings. It is both
a GCC and a clang extension.

v2:
   - Use {} instead of memset macro (Matt)

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/mesa/drivers/dri/i965/genX_state_upload.c

index ef04603df8e6050926273a4356380c9c0911d569..dacccf78f57a463948dc62fe13fd952133e24202 100644 (file)
@@ -206,7 +206,7 @@ KSP(struct brw_context *brw, uint32_t offset)
    })
 
 #define brw_state_emit(brw, cmd, align, offset, name)              \
-   for (struct cmd name = { 0, },                                  \
+   for (struct cmd name = {},                                      \
         *_dst = brw_state_batch(brw, _brw_cmd_length(cmd) * 4,     \
                                 align, offset);                    \
         __builtin_expect(_dst != NULL, 1);                         \