Mesa (master): util: fix unknown pragma warning on msvc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 16 11:25:53 UTC 2020


Module: Mesa
Branch: master
Commit: ff3b4f6683cffece1d97dc7994e7161fd3e09d92
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff3b4f6683cffece1d97dc7994e7161fd3e09d92

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Mon Nov 16 11:39:44 2020 +0100

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 <tony.wasserka at gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7633>

---

 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.



More information about the mesa-commit mailing list