diff options
author | Reid Kleckner <rnk@google.com> | 2016-06-17 17:48:52 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-06-17 17:48:52 +0000 |
commit | d80ed424db5879f5250e0be79332bc4c31a8ef29 (patch) | |
tree | d91110cbe004fdc4ee4215cabf5af4c4c361aa64 /CMakeLists.txt | |
parent | 820e56d16151e68193754349bfdbbd5682a7fb15 (diff) |
Fix some warnings in the MSVC build
- Fixes warnings about the ignored -fms-compatibility-version flag.
- Fixes warnings about overriding /W4 with /W3 and back.
- Fixes a warning where PREFETCH() expanded to nothing in a braceless if
block.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273021 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 66a3e4384..102655dea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,7 +135,14 @@ pythonize_bool(COMPILER_RT_DEBUG) include(config-ix) if(MSVC) - append_string_if(COMPILER_RT_HAS_W3_FLAG /W3 CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + # Override any existing /W flags with /W4. This is what LLVM does. Failing to + # remove other /W[0-4] flags will result in a warning about overriding a + # previous flag. + if (COMPILER_RT_HAS_W4_FLAG) + string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + append_string_if(COMPILER_RT_HAS_W4_FLAG /W4 CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + endif() else() append_string_if(COMPILER_RT_HAS_WALL_FLAG -Wall CMAKE_C_FLAGS CMAKE_CXX_FLAGS) endif() |