Title: [237282] trunk
Revision
237282
Author
[email protected]
Date
2018-10-18 23:43:47 -0700 (Thu, 18 Oct 2018)

Log Message

[Win][Clang] Do not give -Wall to clang-cl because it is treated as -Weverything
https://bugs.webkit.org/show_bug.cgi?id=190514

Reviewed by Michael Catanzaro.

clang-cl maps /Wall and -Wall to -Weverything which reports tons
of compilation warnings. Do not give -Wall option to clang-cl.

Clang processes -Wall and -Wextra options differently than GCC.
Clang processes all warning options in left-to-right order, while
GCC processes -Wall and -Wextra options first. In order to get the
same effect in both compilers, -Wall and -Wextra should be
speficied before all -Wno-* options.

* Source/cmake/WebKitCompilerFlags.cmake: Put -Wall and -Wextra
options before all -Wno-* options.
* Source/cmake/OptionsMSVC.cmake: Prepend /W4 option, instead of
just replacing /W3 option.

Modified Paths

Diff

Modified: trunk/ChangeLog (237281 => 237282)


--- trunk/ChangeLog	2018-10-19 05:22:15 UTC (rev 237281)
+++ trunk/ChangeLog	2018-10-19 06:43:47 UTC (rev 237282)
@@ -1,3 +1,24 @@
+2018-10-18  Fujii Hironori  <[email protected]>
+
+        [Win][Clang] Do not give -Wall to clang-cl because it is treated as -Weverything
+        https://bugs.webkit.org/show_bug.cgi?id=190514
+
+        Reviewed by Michael Catanzaro.
+
+        clang-cl maps /Wall and -Wall to -Weverything which reports tons
+        of compilation warnings. Do not give -Wall option to clang-cl.
+
+        Clang processes -Wall and -Wextra options differently than GCC.
+        Clang processes all warning options in left-to-right order, while
+        GCC processes -Wall and -Wextra options first. In order to get the
+        same effect in both compilers, -Wall and -Wextra should be
+        speficied before all -Wno-* options.
+
+        * Source/cmake/WebKitCompilerFlags.cmake: Put -Wall and -Wextra
+        options before all -Wno-* options.
+        * Source/cmake/OptionsMSVC.cmake: Prepend /W4 option, instead of
+        just replacing /W3 option.
+
 2018-10-16  Philippe Normand  <[email protected]>
 
         Unreviewed, GTK bots build fix

Modified: trunk/Source/cmake/OptionsMSVC.cmake (237281 => 237282)


--- trunk/Source/cmake/OptionsMSVC.cmake	2018-10-19 05:22:15 UTC (rev 237281)
+++ trunk/Source/cmake/OptionsMSVC.cmake	2018-10-19 06:43:47 UTC (rev 237282)
@@ -53,7 +53,10 @@
     string(REGEX REPLACE "(/EH[a-z]+) " "\\1- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable C++ exceptions
     string(REGEX REPLACE "/EHsc$" "/EHs- /EHc- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable C++ exceptions
     string(REGEX REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
-    string(REGEX REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Warnings are important
+    # More warnings. /W4 should be specified before -Wno-* options for clang-cl.
+    string(REGEX REPLACE "/W3" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
+    string(REGEX REPLACE "/W3" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
+    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(/W4)
 endif ()
 
 if (MSVC_STATIC_RUNTIME)

Modified: trunk/Source/cmake/WebKitCompilerFlags.cmake (237281 => 237282)


--- trunk/Source/cmake/WebKitCompilerFlags.cmake	2018-10-19 05:22:15 UTC (rev 237281)
+++ trunk/Source/cmake/WebKitCompilerFlags.cmake	2018-10-19 06:43:47 UTC (rev 237282)
@@ -119,9 +119,7 @@
     endif ()
 
     # Warnings to be enabled
-    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wall
-                                         -Wextra
-                                         -Wcast-align
+    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wcast-align
                                          -Wformat-security
                                          -Wmissing-format-attribute
                                          -Wpointer-arith
@@ -139,12 +137,18 @@
     if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS "8.0" AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
         WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(-Wno-attributes)
     endif ()
+
+    # -Wexpansion-to-defined produces false positives with GCC but not Clang
+    # https://bugs.webkit.org/show_bug.cgi?id=167643#c13
+    if (CMAKE_COMPILER_IS_GNUCXX)
+        WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-expansion-to-defined)
+    endif ()
 endif ()
 
-# -Wexpansion-to-defined produces false positives with GCC but not Clang
-# https://bugs.webkit.org/show_bug.cgi?id=167643#c13
-if (CMAKE_COMPILER_IS_GNUCXX)
-    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-expansion-to-defined)
+if (COMPILER_IS_GCC_OR_CLANG AND NOT MSVC)
+    # Don't give -Wall to clang-cl because clang-cl treats /Wall and -Wall as -Weverything.
+    # -Wall and -Wextra should be specified before -Wno-* for Clang.
+    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wall -Wextra)
 endif ()
 
 # Ninja tricks compilers into turning off color support.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to