swr: Limit DEBUG workaround to LLVM < 7
authorMichel Dänzer <mdaenzer@redhat.com>
Mon, 16 Sep 2019 15:08:14 +0000 (17:08 +0200)
committerMichel Dänzer <michel@daenzer.net>
Tue, 17 Sep 2019 10:24:29 +0000 (10:24 +0000)
As of version 7, LLVM uses LLVM_DEBUG instead of just DEBUG.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
src/gallium/drivers/swr/swr_shader.cpp
src/gallium/drivers/swr/swr_state.cpp

index 47f717bfc2a1c305ab0ac7163549e4e54995a0b0..42b2d6d80964355b432bdf2b562ef2ed2c27aa19 100644 (file)
 #pragma warning(disable : 4146 4244 4267 4800 4996)
 #endif
 
+#include <llvm/Config/llvm-config.h>
+
+#if LLVM_VERSION_MAJOR < 7
 // llvm 3.7+ reuses "DEBUG" as an enum value
 #pragma push_macro("DEBUG")
 #undef DEBUG
+#endif
 
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Instructions.h"
@@ -47,8 +51,6 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/ExecutionEngine/ObjectCache.h"
 
-#include "llvm/Config/llvm-config.h"
-
 #include "llvm/IR/Verifier.h"
 #include "llvm/ExecutionEngine/MCJIT.h"
 #include "llvm/Support/FileSystem.h"
@@ -133,7 +135,9 @@ static inline llvm::AttributeSet GetFuncAttribSet(llvm::LLVMContext&       ctx,
 }
 #endif
 
+#if LLVM_VERSION_MAJOR < 7
 #pragma pop_macro("DEBUG")
+#endif
 
 #include <deque>
 #include <list>
index 2a73095ec499fadd103096ee2e9eca0541ed606c..9b4eb047e21fc0937163e5a1b60d15313b743228 100644 (file)
  * IN THE SOFTWARE.
  ***************************************************************************/
 
+#include <llvm/Config/llvm-config.h>
+
+#if LLVM_VERSION_MAJOR < 7
 // llvm redefines DEBUG
 #pragma push_macro("DEBUG")
 #undef DEBUG
+#endif
+
 #include "JitManager.h"
-#include <llvm/Config/llvm-config.h>
 #include "llvm-c/Core.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/IR/LegacyPassManager.h"
+
+#if LLVM_VERSION_MAJOR < 7
 #pragma pop_macro("DEBUG")
+#endif
 
 #include "state.h"
 #include "gen_state_llvm.h"
index 84c67597c4679f8199d364dae93af9d9b0d6ecde..c6b19204b32ccbeabfacca2cdd6454d4f3ccb21e 100644 (file)
  * IN THE SOFTWARE.
  ***************************************************************************/
 
+#include <llvm/Config/llvm-config.h>
+
+#if LLVM_VERSION_MAJOR < 7
 // llvm redefines DEBUG
 #pragma push_macro("DEBUG")
 #undef DEBUG
+#endif
 
 #include <rasterizer/core/state.h>
 #include "JitManager.h"
+
+#if LLVM_VERSION_MAJOR < 7
 #pragma pop_macro("DEBUG")
+#endif
 
 #include "common/os.h"
 #include "jit_api.h"