[libcxx-commits] [libcxx] 1540646 - [libcxx] Don't add -Wall when building in MSVC mode
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 5 13:48:33 PST 2021
Author: Martin Storsjö
Date: 2021-03-05T23:48:02+02:00
New Revision: 1540646dbd18b7d7637a9f8ba64b53e0417ff5e4
URL: https://github.com/llvm/llvm-project/commit/1540646dbd18b7d7637a9f8ba64b53e0417ff5e4
DIFF: https://github.com/llvm/llvm-project/commit/1540646dbd18b7d7637a9f8ba64b53e0417ff5e4.diff
LOG: [libcxx] Don't add -Wall when building in MSVC mode
The MSVC -Wall (or /Wall) option maps (in clang-cl) to the GCC style
option -Weverything, which we don't really want. Instead use -W4 which
is the corresponding MSVC option.
This silences the build with clang-cl, which previously used to
output 100 warnings per translation unit.
Differential Revision: https://reviews.llvm.org/D98035
Added:
Modified:
libcxx/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 3599bcde6d66..708405363500 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -572,7 +572,14 @@ endfunction()
# Warning flags ===============================================================
function(cxx_add_warning_flags target)
target_compile_definitions(${target} PUBLIC -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
- target_add_compile_flags_if_supported(${target} PRIVATE -Wall -Wextra -W -Wwrite-strings
+ if (MSVC)
+ # -W4 is the cl.exe/clang-cl equivalent of -Wall. (In cl.exe and clang-cl,
+ # -Wall is equivalent to -Weverything in GCC style compiler drivers.)
+ target_add_compile_flags_if_supported(${target} PRIVATE -W4)
+ else()
+ target_add_compile_flags_if_supported(${target} PRIVATE -Wall)
+ endif()
+ target_add_compile_flags_if_supported(${target} PRIVATE -Wextra -W -Wwrite-strings
-Wno-unused-parameter -Wno-long-long
-Werror=return-type -Wextra-semi)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
More information about the libcxx-commits
mailing list