From ff3b4f6683cffece1d97dc7994e7161fd3e09d92 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 16 Nov 2020 11:39:44 +0100 Subject: [PATCH] util: fix unknown pragma warning on msvc MSVC has no idea about these pragmas, and spews warnings about them, making it hard to spot real problems. So let's only use these macros on GCC. Fixes: 2ec290cd92a ("util: Fix/silence variable shadowing warnings") Reviewed-by: Tony Wasserka Part-of: --- src/util/format/u_format.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h index cdd91241564..10dc8beb6dd 100644 --- a/src/util/format/u_format.h +++ b/src/util/format/u_format.h @@ -383,8 +383,10 @@ typedef void (*util_format_fetch_rgba_func_ptr)(void *dst, const uint8_t *src, unsigned i, unsigned j); /* Silence warnings triggered by sharing function/struct names */ +#ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshadow" +#endif const struct util_format_description * util_format_description(enum pipe_format format) ATTRIBUTE_CONST; @@ -393,7 +395,9 @@ util_format_pack_description(enum pipe_format format) ATTRIBUTE_CONST; const struct util_format_unpack_description * util_format_unpack_description(enum pipe_format format) ATTRIBUTE_CONST; +#ifdef __GNUC__ #pragma GCC diagnostic pop +#endif /** * Returns a function to fetch a single pixel (i, j) from a block.