Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

Commit 6736cc6

Browse files
committed
[ORC-RT] Silence warning when building with Clang ToT on Windows
This fixes several of these: ``` [3524/7446] Building CXX object projects\compiler-rt\lib\orc\CMakeFiles\RTOrc.x86_64.dir\dlfcn_wrapper.cpp.obj In file included from C:\git\llvm-project\compiler-rt\lib\orc\dlfcn_wrapper.cpp:15: C:\git\llvm-project\compiler-rt\lib\orc\wrapper_function_utils.h(299,27): warning: address of '__orc_rt_jit_dispatch_ctx' will always evaluate to 'true' [-Wpointer-bool-conversion] 299 | if (ORC_RT_UNLIKELY(!&__orc_rt_jit_dispatch_ctx)) | ~ ^~~~~~~~~~~~~~~~~~~~~~~~~ C:\git\llvm-project\compiler-rt\lib\orc\compiler.h(60,55): note: expanded from macro 'ORC_RT_UNLIKELY' 60 | #define ORC_RT_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false) | ^~~~ 1 warning generated. ```
1 parent 6f8b633 commit 6736cc6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler-rt/lib/orc/wrapper_function_utils.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,15 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
296296
// operation fails.
297297
detail::ResultDeserializer<SPSRetTagT, RetT>::makeSafe(Result);
298298

299+
// Since the functions cannot be zero/unresolved on Windows, the following
300+
// reference taking would always be non-zero, thus generating a compiler
301+
// warning otherwise.
302+
#if !defined(_WIN32)
299303
if (ORC_RT_UNLIKELY(!&__orc_rt_jit_dispatch_ctx))
300304
return make_error<StringError>("__orc_rt_jit_dispatch_ctx not set");
301305
if (ORC_RT_UNLIKELY(!&__orc_rt_jit_dispatch))
302306
return make_error<StringError>("__orc_rt_jit_dispatch not set");
303-
307+
#endif
304308
auto ArgBuffer =
305309
WrapperFunctionResult::fromSPSArgs<SPSArgList<SPSTagTs...>>(Args...);
306310
if (const char *ErrMsg = ArgBuffer.getOutOfBandError())

0 commit comments

Comments
 (0)