From 299c1119d297a988353baec2ae97ecd22cf8283e Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Tue, 5 Jun 2018 22:10:59 +0200 Subject: [PATCH] vrend_formats.c: Silence warning -Wmissing-field-initializers The warning doesn't really add value, because the way the code is written the fields will be initialized to zero, hence disable the warning in this file. Reviewed-by: Gurchetan Singh Signed-off-by: Gert Wollny Signed-off-by: Jakob Bornecrantz --- src/vrend_formats.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/vrend_formats.c b/src/vrend_formats.c index 9b02d4e..eb9f217 100644 --- a/src/vrend_formats.c +++ b/src/vrend_formats.c @@ -32,6 +32,21 @@ #define RRR1_SWIZZLE { PIPE_SWIZZLE_RED, PIPE_SWIZZLE_RED, PIPE_SWIZZLE_RED, PIPE_SWIZZLE_ONE } #define RGB1_SWIZZLE { PIPE_SWIZZLE_RED, PIPE_SWIZZLE_GREEN, PIPE_SWIZZLE_BLUE, PIPE_SWIZZLE_ONE } +#ifdef __GNUC__ +/* The warning missing-field-initializers is misleading: If at least one field + * is initialized, then the un-initialized fields will be filled with zero. + * Silencing the warning by manually adding the zeros that the compiler will add + * anyway doesn't improve the code, and initializing the files by using a named + * notation will make it worse, because then he remaining fields truely be + * un-initialized. + */ +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wmissing-field-initializers" +#else +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif +#endif + /* fill the format table */ static struct vrend_format_table base_rgba_formats[] = {