Mesa (staging/21.3): aco: Work around MSVC restrict in c99_compat.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 15 21:10:59 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 33e3e9c33af5900d865b660c37d8d99da783b067
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33e3e9c33af5900d865b660c37d8d99da783b067

Author: James Park <jpark37 at lagfreegames.com>
Date:   Sat Oct 23 18:02:48 2021 -0700

aco: Work around MSVC restrict in c99_compat.h

Future LLVM header leads to __declspec(__restrict), which is invalid.
Just undefine the restrict macro to keep __declspec(restrict).

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13505>
(cherry picked from commit e0de7aa4d7717bbd79bbc5bfc660f941f680402b)

---

 .pick_status.json                  | 2 +-
 src/amd/compiler/aco_print_asm.cpp | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 02a70b43ccd..39ddc1e5ba4 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1003,7 +1003,7 @@
         "description": "aco: Work around MSVC restrict in c99_compat.h",
         "nominated": false,
         "nomination_type": null,
-        "resolution": 4,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/compiler/aco_print_asm.cpp b/src/amd/compiler/aco_print_asm.cpp
index 9f15de5aacd..cbd29e13212 100644
--- a/src/amd/compiler/aco_print_asm.cpp
+++ b/src/amd/compiler/aco_print_asm.cpp
@@ -25,6 +25,9 @@
 #include "aco_ir.h"
 
 #ifdef LLVM_AVAILABLE
+#if defined(_MSC_VER) && defined(restrict)
+#undef restrict
+#endif
 #include "llvm/ac_llvm_util.h"
 
 #include "llvm-c/Disassembler.h"



More information about the mesa-commit mailing list