[Mesa-dev] [PATCH v2] i965: Use {} to initialize GENX_* structs.

Francisco Jerez currojerez at riseup.net
Fri Jul 14 21:12:34 UTC 2017


Rafael Antognolli <rafael.antognolli at intel.com> writes:

> 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
>
> This change works around that and will silence such warnings. It is both
> a GCC and a clang extension.
>

...and it's standard C++.  Patch is:

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> v2:
>    - Use {} instead of memset macro (Matt)
>
> Signed-off-by: Rafael Antognolli <rafael.antognolli at intel.com>
> Cc: Jason Ekstrand <jason at jlekstrand.net>
> Cc: Matt Turner <mattst88 at gmail.com>
> Cc: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  src/mesa/drivers/dri/i965/genX_state_upload.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
> index 54a547c..025d3ca 100644
> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
> @@ -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);                         \
> -- 
> 2.9.4
>
> _______________________________________________
> 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: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170714/001a8ab9/attachment.sig>


More information about the mesa-dev mailing list