[libcxx-commits] [PATCH] D98035: [libcxx] Don't add -Wall when building in MSVC mode

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 5 04:49:07 PST 2021


mstorsjo created this revision.
Herald added a subscriber: mgorny.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

The MSVC -Wall (or /Wall) option maps (in clang-cl) to the GCC style
option -Weverything, which we don't really want.

This silences the build with clang-cl, which previously used to
output 100 warnings per translation unit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98035

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -572,7 +572,12 @@
 # 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 (NOT MSVC)
+    # Don't add -Wall with clang-cl; in cl.exe mode, -Wall (or /Wall) means
+    # the same as -Weverything in a GCC like driver.
+    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")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98035.328477.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210305/f7b4f359/attachment-0001.bin>


More information about the libcxx-commits mailing list