mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 01:20:51 +03:00
CMake: Fix LLVM_INTRINSIC_TD_PATH and LDC_INSTALL_PREFIX expansion (#3223)
In -std=gnu* mode, `linux` is a macro that expands to 1. If LLVM_INTRINSIC_TD_PATH (bare string) contains `linux` (e.g. x86_64-linux-gnu), LLVM_INTRINSIC_TD_PATH in gen_gccbuiltins.cpp will be expanded and the whole string will get corrupted. Fix it by switching from bare strings to C++ raw string literals (preserving Windows backslashes).
This commit is contained in:
parent
94743b90fc
commit
91aeb0e674
5 changed files with 19 additions and 20 deletions
|
@ -55,19 +55,23 @@ DComputeCodeGenManager::createComputeTarget(const std::string &s) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#define XSTR(x) #x
|
||||
#define STR(x) XSTR((x))
|
||||
#define STR(x) #x
|
||||
#define XSTR(x) STR(x)
|
||||
|
||||
error(Loc(),
|
||||
"unrecognised or invalid DCompute targets: the format is ocl-xy0 "
|
||||
"for OpenCl x.y and cuda-xy0 for CUDA CC x.y."
|
||||
#if LDC_LLVM_SUPPORTED_TARGET_SPIRV
|
||||
" Valid versions for OpenCl are " STR(OCL_VALID_VER_INIT) "."
|
||||
" Valid versions for OpenCl are " XSTR((OCL_VALID_VER_INIT)) "."
|
||||
#endif
|
||||
#if LDC_LLVM_SUPPORTED_TARGET_NVPTX
|
||||
" Valid versions for CUDA are " STR(CUDA_VALID_VER_INIT)
|
||||
" Valid versions for CUDA are " XSTR((CUDA_VALID_VER_INIT))
|
||||
#endif
|
||||
);
|
||||
|
||||
#undef XSTR
|
||||
#undef STR
|
||||
|
||||
fatal();
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue