Mesa (master): amd/llvm: Reorder LLVM headers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 5 17:29:21 UTC 2020


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

Author: James Park <16356-jpark37 at users.noreply.gitlab.freedesktop.org>
Date:   Wed Aug  5 09:59:25 2020 -0700

amd/llvm: Reorder LLVM headers

LLVM uses __declspec(restrict) which breaks because Mesa define restrict
as __restrict. Move the LLVM headerse up to dodge the macro.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6180>

---

 src/amd/llvm/ac_llvm_helper.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/amd/llvm/ac_llvm_helper.cpp b/src/amd/llvm/ac_llvm_helper.cpp
index 779085b7e78..1174b34b638 100644
--- a/src/amd/llvm/ac_llvm_helper.cpp
+++ b/src/amd/llvm/ac_llvm_helper.cpp
@@ -25,12 +25,6 @@
 
 #include <cstring>
 
-#include "ac_binary.h"
-#include "ac_llvm_util.h"
-#include "ac_llvm_build.h"
-
-#include "util/macros.h"
-
 #include <llvm-c/Core.h>
 #include <llvm/Target/TargetMachine.h>
 #include <llvm/IR/IRBuilder.h>
@@ -39,6 +33,18 @@
 
 #include <llvm/IR/LegacyPassManager.h>
 
+/* DO NOT REORDER THE HEADERS
+ * The LLVM headers need to all be included before any Mesa header,
+ * as they use the `restrict` keyword in ways that are incompatible
+ * with our #define in include/c99_compat.h
+ */
+
+#include "ac_binary.h"
+#include "ac_llvm_util.h"
+#include "ac_llvm_build.h"
+
+#include "util/macros.h"
+
 void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
 {
    llvm::Argument *A = llvm::unwrap<llvm::Argument>(val);



More information about the mesa-commit mailing list