[compiler-rt] [compiler-rt] Fix MSVC compiler warnings (PR #67975)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 04:26:36 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
<details>
<summary>Changes</summary>
This fixes adding compiler flags using the CMake "append_list_if" function, which does not support multiple flags separated by spaces.
Before this patch, the MSVC compiler produced many warnings:
```
cl : Command line warning D9002 : ignoring unknown option '/experimental:external /external:W0 /external:anglebrackets'
```
---
Full diff: https://github.com/llvm/llvm-project/pull/67975.diff
3 Files Affected:
- (modified) compiler-rt/lib/asan/CMakeLists.txt (+1-1)
- (modified) compiler-rt/lib/interception/CMakeLists.txt (+1-1)
- (modified) compiler-rt/lib/ubsan/CMakeLists.txt (+1-1)
``````````diff
diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt
index bc5fe0be120f8d7..48d0e91052d73bb 100644
--- a/compiler-rt/lib/asan/CMakeLists.txt
+++ b/compiler-rt/lib/asan/CMakeLists.txt
@@ -92,7 +92,7 @@ append_rtti_flag(OFF ASAN_CFLAGS)
# Silence warnings in system headers with MSVC.
if(NOT CLANG_CL)
- append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external /external:W0 /external:anglebrackets" ASAN_CFLAGS)
+ append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external;/external:W0;/external:anglebrackets" ASAN_CFLAGS)
endif()
# Too many existing bugs, needs cleanup.
diff --git a/compiler-rt/lib/interception/CMakeLists.txt b/compiler-rt/lib/interception/CMakeLists.txt
index 3242cf50e35f860..abe9229340be7a1 100644
--- a/compiler-rt/lib/interception/CMakeLists.txt
+++ b/compiler-rt/lib/interception/CMakeLists.txt
@@ -21,7 +21,7 @@ append_rtti_flag(OFF INTERCEPTION_CFLAGS)
# Silence warnings in system headers with MSVC.
if(NOT CLANG_CL)
- append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external /external:W0 /external:anglebrackets" INTERCEPTION_CFLAGS)
+ append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external;/external:W0;/external:anglebrackets" INTERCEPTION_CFLAGS)
endif()
add_compiler_rt_object_libraries(RTInterception
diff --git a/compiler-rt/lib/ubsan/CMakeLists.txt b/compiler-rt/lib/ubsan/CMakeLists.txt
index 2031726afe0b59d..3f1e12ed9ac66fc 100644
--- a/compiler-rt/lib/ubsan/CMakeLists.txt
+++ b/compiler-rt/lib/ubsan/CMakeLists.txt
@@ -57,7 +57,7 @@ append_list_if(SANITIZER_CAN_USE_CXXABI -DUBSAN_CAN_USE_CXXABI UBSAN_CXXFLAGS)
# Silence warnings in system headers with MSVC.
if(NOT CLANG_CL)
- append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external /external:W0 /external:anglebrackets" UBSAN_CXXFLAGS)
+ append_list_if(COMPILER_RT_HAS_EXTERNAL_FLAG "/experimental:external;/external:W0;/external:anglebrackets" UBSAN_CXXFLAGS)
endif()
set(UBSAN_LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS})
``````````
</details>
https://github.com/llvm/llvm-project/pull/67975
More information about the llvm-commits
mailing list