Mesa (main): nir: Fixes MSVC compiling error about unused variable `_`

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 23 15:24:12 UTC 2022


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

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Mon May 23 22:16:34 2022 +0800

nir: Fixes MSVC compiling error about unused variable `_`

Fixes: 836470d4331 ("nir: allow NIR_PASS(_, )")

MSVC compiling error:
```
nir/nir_lower_shader_calls.c
../mesa/src/compiler/nir/nir_lower_shader_calls.c(1188): error C2220: the following warning is treated as an error
../mesa/src/compiler/nir/nir_lower_shader_calls.c(1188): warning C4101: '_': unreferenced local variable
../mesa/src/compiler/nir/nir_lower_shader_calls.c(1190): warning C4101: '_': unreferenced local variable
```

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16666>

---

 src/util/macros.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/macros.h b/src/util/macros.h
index 7c6df7e58ba..2138f5d662d 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -299,6 +299,8 @@ do {                       \
  */
 #ifdef HAVE_FUNC_ATTRIBUTE_UNUSED
 #define UNUSED __attribute__((unused))
+#elif defined (_MSC_VER)
+#define UNUSED __pragma(warning(suppress:4100 4101))
 #else
 #define UNUSED
 #endif



More information about the mesa-commit mailing list