From f63802e7e8eba0114dc103bd35bd8800ef5f1ed0 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sat, 27 Jul 2019 21:16:01 +1200
Subject: [PATCH] Avoid macro clash with LLVM 9.

Early previews of LLVM 9 reveal that our Min() macro causes compiler
errors in LLVM headers reached by the include directives in
llvm_inline.cpp.  Let's just undefine it.

Discussion: https://postgr.es/m/20190606173216.GA6306%40alvherre.pgsql
---
 src/backend/jit/llvm/llvmjit_inline.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/backend/jit/llvm/llvmjit_inline.cpp b/src/backend/jit/llvm/llvmjit_inline.cpp
index 8005d43a84..1ac1d9deae 100644
--- a/src/backend/jit/llvm/llvmjit_inline.cpp
+++ b/src/backend/jit/llvm/llvmjit_inline.cpp
@@ -24,6 +24,9 @@ extern "C"
 #include "postgres.h"
 }
 
+/* Avoid macro clash with LLVM headers */
+#undef Min
+
 #include "jit/llvmjit.h"
 
 extern "C"
-- 
2.22.0

