mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
Fix LLVM related headers to compile standalone (to fix cpluspluscheck).
Previously llvmjit.h #error'ed when USE_LLVM was not defined, to prevent it from being included from code not having #ifdef USE_LLVM guards - but that's not actually that useful after, during the development of JIT support, LLVM related code was moved into a separately compiled .so. Having that #error means cpluspluscheck doesn't work when llvm support isn't enabled, which isn't great. Similarly add USE_LLVM guards to llvmjit_emit.h, and additionally make sure it compiles standalone. Per complaint from Tom Lane. Author: Andres Freund Discussion: https://postgr.es/m/19808.1548692361@sss.pgh.pa.us Backpatch: 11, where JIT support was added
This commit is contained in:
@ -11,9 +11,11 @@
|
|||||||
#ifndef LLVMJIT_H
|
#ifndef LLVMJIT_H
|
||||||
#define LLVMJIT_H
|
#define LLVMJIT_H
|
||||||
|
|
||||||
#ifndef USE_LLVM
|
/*
|
||||||
#error "llvmjit.h should only be included by code dealing with llvm"
|
* To avoid breaking cpluspluscheck, allow including the file even when LLVM
|
||||||
#endif
|
* is not available.
|
||||||
|
*/
|
||||||
|
#ifdef USE_LLVM
|
||||||
|
|
||||||
#include <llvm-c/Types.h>
|
#include <llvm-c/Types.h>
|
||||||
|
|
||||||
@ -140,4 +142,5 @@ extern char *LLVMGetHostCPUFeatures(void);
|
|||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* USE_LLVM */
|
||||||
#endif /* LLVMJIT_H */
|
#endif /* LLVMJIT_H */
|
||||||
|
@ -9,9 +9,17 @@
|
|||||||
#ifndef LLVMJIT_EMIT_H
|
#ifndef LLVMJIT_EMIT_H
|
||||||
#define LLVMJIT_EMIT_H
|
#define LLVMJIT_EMIT_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To avoid breaking cpluspluscheck, allow including the file even when LLVM
|
||||||
|
* is not available.
|
||||||
|
*/
|
||||||
|
#ifdef USE_LLVM
|
||||||
|
|
||||||
#include <llvm-c/Core.h>
|
#include <llvm-c/Core.h>
|
||||||
|
|
||||||
|
#include "fmgr.h"
|
||||||
|
#include "jit/llvmjit.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Emit a non-LLVM pointer as an LLVM constant.
|
* Emit a non-LLVM pointer as an LLVM constant.
|
||||||
@ -263,4 +271,5 @@ l_funcvalue(LLVMBuilderRef b, LLVMValueRef v_fcinfo, size_t argno)
|
|||||||
return LLVMBuildLoad(b, l_funcvaluep(b, v_fcinfo, argno), "");
|
return LLVMBuildLoad(b, l_funcvaluep(b, v_fcinfo, argno), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* USE_LLVM */
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user