[compiler-rt] [compiler-rt] Fix MSVC compiler warnings (PR #67975)

Yury Bura via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 2 04:24:54 PDT 2023


https://github.com/yurybura created https://github.com/llvm/llvm-project/pull/67975

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'
```

>From 290490964cd557d9f7f1e553e2a8a1c523648846 Mon Sep 17 00:00:00 2001
From: Yury Bura <yurybura at gmail.com>
Date: Mon, 2 Oct 2023 13:23:50 +0200
Subject: [PATCH] [compiler-rt] Fix MSVC compiler warnings 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'
---
 compiler-rt/lib/asan/CMakeLists.txt         | 2 +-
 compiler-rt/lib/interception/CMakeLists.txt | 2 +-
 compiler-rt/lib/ubsan/CMakeLists.txt        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

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})



More information about the llvm-commits mailing list