Title: [220403] trunk
Revision
220403
Author
mcatanz...@igalia.com
Date
2017-08-08 08:03:48 -0700 (Tue, 08 Aug 2017)

Log Message

[CMake] Properly test if compiler supports compiler flags
https://bugs.webkit.org/show_bug.cgi?id=174490

Reviewed by Konstantin Tokarev.

.:

This turned out to be a massive pain. I didn't want to merely check options before using
them: I also wanted to organize the code to avoid setting similar flags in different places.
Right now we set a bunch of global flags in OptionsCommon.cmake, and a bunch more flags in
WEBKIT_SET_EXTRA_COMPILER_FLAGS on a per-target basis.

Setting flags per-target seems better in general, e.g. because it makes it very easy to
disable warnings for particular ThirdParty targets. But it turns out that all the flags set
on a per-target basis get passed to both the C compiler and the C++ compiler, so it's
impossible to pass C++-only flags there. That's terrible. It's possible to make the flags
language-conditional using generator expressions, but that doesn't work for the Visual
Studio backend, so we would have to drop support for that (not going to happen). The CMake
documentation suggests that C and C++ files ought to be built in separate targets to avoid
this. It's a mess, basically.

So I've wound up removing WEBKIT_SET_EXTRA_COMPILER_FLAGS and adding most of those flags to
CMAKE_C_FLAGS and CMAKE_CXX_FLAGS instead. Really the only disadvantage of this is we now
have to suppress individual warnings when building ANGLESupport in WebCore. That's not the
end of the world. The only remaining useful feature of WEBKIT_SET_EXTRA_COMPILER_FLAGS was
to add -fPIC to static library targets, but turns out CMake does that for us if we just set
the variable CMAKE_POSITION_INDEPENDENT_CODE, so we can get rid of it completely.

Of course there are also macros for setting target-specific compiler flags, which we
frequently need in order to suppress specific warnings, particularly warnings coming from
third-party libraries like ANGLE and gtest. But remember the footgun: these macros will test
the flag against only one compiler, but must work with both C and C++ compilers unless the
build target exclusively contains targets built with just one of those compilers. Yuck.

* CMakeLists.txt:
* Source/CMakeLists.txt:
* Source/PlatformGTK.cmake:
* Source/cmake/OptionsCommon.cmake:
* Source/cmake/WebKitCommon.cmake:
* Source/cmake/WebKitCompilerFlags.cmake: Added.
* Source/cmake/WebKitMacros.cmake:

Source/_javascript_Core:

* API/tests/PingPongStackOverflowTest.cpp:
(testPingPongStackOverflow):
* API/tests/testapi.c:
* b3/testb3.cpp:
(JSC::B3::testPatchpointLotsOfLateAnys):

Source/ThirdParty:

* brotli/CMakeLists.txt:
* gtest/CMakeLists.txt:
* woff2/CMakeLists.txt:
* xdgmime/CMakeLists.txt:

Source/WebCore:

* CMakeLists.txt:
* PlatformGTK.cmake:
* PlatformWPE.cmake:

Source/WebDriver:

* WebDriverService.cpp:
(WebDriver::WebDriverService::run):
* glib/SessionHostGlib.cpp:

Source/WebKit:

* CMakeLists.txt:
* PlatformGTK.cmake:

Source/WTF:

* wtf/Compiler.h:

Tools:

* DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
* MiniBrowser/gtk/CMakeLists.txt:
* TestRunnerShared/Bindings/JSWrapper.cpp:
(WTR::JSWrapper::initialize):
* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp:
(TestWebKitAPI::CheckedArithmeticTester::run):
* TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp:
* TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:
* TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp:
(formControlsAssociatedCallback):
* TestWebKitAPI/glib/CMakeLists.txt:
* TestWebKitAPI/glib/WebKitGLib/TestMain.h:
(Test::getResourcesDir):
* WebKitTestRunner/CMakeLists.txt:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::menuItemClickCallback):
(WTR::staticConvertMenuItemToType):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setUseDashboardCompatibilityMode):
* WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
(WTR::AccessibilityNotificationHandler::disconnectAccessibilityCallbacks):
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::helpText const):
(WTR::AccessibilityUIElement::attributedStringForRange):
* WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
(WTR::EventSenderProxy::updateTouchPoint):
(WTR::EventSenderProxy::releaseTouchPoint):

Modified Paths

Added Paths

Diff

Modified: trunk/CMakeLists.txt (220402 => 220403)


--- trunk/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -126,6 +126,8 @@
 set(WebKit2_LIBRARY_TYPE SHARED)
 set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
 
+set(CMAKE_POSITION_INDEPENDENT_CODE True)
+
 # -----------------------------------------------------------------------------
 # Install _javascript_ shell
 # -----------------------------------------------------------------------------

Modified: trunk/ChangeLog (220402 => 220403)


--- trunk/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,45 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        This turned out to be a massive pain. I didn't want to merely check options before using
+        them: I also wanted to organize the code to avoid setting similar flags in different places.
+        Right now we set a bunch of global flags in OptionsCommon.cmake, and a bunch more flags in
+        WEBKIT_SET_EXTRA_COMPILER_FLAGS on a per-target basis.
+
+        Setting flags per-target seems better in general, e.g. because it makes it very easy to
+        disable warnings for particular ThirdParty targets. But it turns out that all the flags set
+        on a per-target basis get passed to both the C compiler and the C++ compiler, so it's
+        impossible to pass C++-only flags there. That's terrible. It's possible to make the flags
+        language-conditional using generator expressions, but that doesn't work for the Visual
+        Studio backend, so we would have to drop support for that (not going to happen). The CMake
+        documentation suggests that C and C++ files ought to be built in separate targets to avoid
+        this. It's a mess, basically.
+
+        So I've wound up removing WEBKIT_SET_EXTRA_COMPILER_FLAGS and adding most of those flags to
+        CMAKE_C_FLAGS and CMAKE_CXX_FLAGS instead. Really the only disadvantage of this is we now
+        have to suppress individual warnings when building ANGLESupport in WebCore. That's not the
+        end of the world. The only remaining useful feature of WEBKIT_SET_EXTRA_COMPILER_FLAGS was
+        to add -fPIC to static library targets, but turns out CMake does that for us if we just set
+        the variable CMAKE_POSITION_INDEPENDENT_CODE, so we can get rid of it completely.
+
+        Of course there are also macros for setting target-specific compiler flags, which we
+        frequently need in order to suppress specific warnings, particularly warnings coming from
+        third-party libraries like ANGLE and gtest. But remember the footgun: these macros will test
+        the flag against only one compiler, but must work with both C and C++ compilers unless the
+        build target exclusively contains targets built with just one of those compilers. Yuck.
+
+        * CMakeLists.txt:
+        * Source/CMakeLists.txt:
+        * Source/PlatformGTK.cmake:
+        * Source/cmake/OptionsCommon.cmake:
+        * Source/cmake/WebKitCommon.cmake:
+        * Source/cmake/WebKitCompilerFlags.cmake: Added.
+        * Source/cmake/WebKitMacros.cmake:
+
 2017-08-07  Brian Burg  <bb...@apple.com>
 
         Remove CANVAS_PATH compilation guard

Modified: trunk/Source/CMakeLists.txt (220402 => 220403)


--- trunk/Source/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -43,29 +43,3 @@
 endif ()
 
 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
-
-# -----------------------------------------------------------------------------
-# Set compiler flags for all targets
-# -----------------------------------------------------------------------------
-if (NOT USE_SYSTEM_MALLOC)
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(bmalloc ${ADDITIONAL_COMPILER_FLAGS})
-endif ()
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(WTF ${ADDITIONAL_COMPILER_FLAGS})
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(_javascript_Core ${ADDITIONAL_COMPILER_FLAGS})
-
-if (ENABLE_WEBCORE)
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(PAL ${ADDITIONAL_COMPILER_FLAGS})
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCoreTestSupport ${ADDITIONAL_COMPILER_FLAGS})
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCore ${ADDITIONAL_COMPILER_FLAGS})
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCoreDerivedSources ${ADDITIONAL_COMPILER_FLAGS})
-endif ()
-
-if (ENABLE_WEBKIT_LEGACY)
-    # FIXME: Rename this target to WebKitLegacy.
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebKit ${ADDITIONAL_COMPILER_FLAGS})
-endif ()
-
-if (ENABLE_WEBKIT)
-    # FIXME: Rename this target to WebKit.
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebKit2 ${ADDITIONAL_COMPILER_FLAGS})
-endif ()

Modified: trunk/Source/_javascript_Core/API/tests/PingPongStackOverflowTest.cpp (220402 => 220403)


--- trunk/Source/_javascript_Core/API/tests/PingPongStackOverflowTest.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/_javascript_Core/API/tests/PingPongStackOverflowTest.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -142,7 +142,6 @@
         "PingPongStackOverflowObject.__proto__ = undefined;" \
         "undefined instanceof PingPongStackOverflowObject;";
 
-    JSValueRef scriptResult = nullptr;
     JSValueRef exception = nullptr;
     JSStringRef script = JSStringCreateWithUTF8CString(scriptString);
 
@@ -161,7 +160,7 @@
     Options::maxPerThreadStackUsage() = stackSize + Options::softReservedZoneSize();
 
     exception = nullptr;
-    scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
+    JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
 
     if (!exception) {
         printf("FAIL: PingPongStackOverflowError not thrown in PingPongStackOverflow test\n");

Modified: trunk/Source/_javascript_Core/API/tests/testapi.c (220402 => 220403)


--- trunk/Source/_javascript_Core/API/tests/testapi.c	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/_javascript_Core/API/tests/testapi.c	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1134,6 +1134,10 @@
     return result;
 }
 
+#if COMPILER(GCC)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
 static void checkConstnessInJSObjectNames()
 {
     JSStaticFunction fun;
@@ -1141,6 +1145,9 @@
     JSStaticValue val;
     val.name = "something";
 }
+#if COMPILER(GCC)
+#pragma GCC diagnostic pop
+#endif
 
 #ifdef __cplusplus
 extern "C" {

Modified: trunk/Source/_javascript_Core/ChangeLog (220402 => 220403)


--- trunk/Source/_javascript_Core/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,16 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        * API/tests/PingPongStackOverflowTest.cpp:
+        (testPingPongStackOverflow):
+        * API/tests/testapi.c:
+        * b3/testb3.cpp:
+        (JSC::B3::testPatchpointLotsOfLateAnys):
+
 2017-08-06  Yusuke Suzuki  <utatane....@gmail.com>
 
         [Linux] Clear WasmMemory with madvice instead of memset

Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (220402 => 220403)


--- trunk/Source/_javascript_Core/b3/testb3.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -8481,7 +8481,7 @@
         });
     root->appendNewControlValue(proc, Return, Origin(), patchpoint);
 
-    CHECK(compileAndRun<int>(proc) == (things.size() * (things.size() - 1)) / 2);
+    CHECK(static_cast<size_t>(compileAndRun<int>(proc)) == (things.size() * (things.size() - 1)) / 2);
 }
 
 void testPatchpointAnyImm(ValueRep rep)

Modified: trunk/Source/PlatformGTK.cmake (220402 => 220403)


--- trunk/Source/PlatformGTK.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/PlatformGTK.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -24,9 +24,10 @@
     add_custom_command(
         OUTPUT "${CMAKE_BINARY_DIR}/${_stamp_name}"
         DEPENDS ${DocumentationDependencies}
-        COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=${CMAKE_C_FLAGS} ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc ${_extra_args}
+        COMMAND ${CMAKE_COMMAND} -E env "CC=${CMAKE_C_COMPILER}" "CFLAGS=${CMAKE_C_FLAGS} -Wno-unused-parameter" ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc ${_extra_args}
         COMMAND touch ${_stamp_name}
         WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+        VERBATIM
     )
 endmacro()
 

Modified: trunk/Source/ThirdParty/ChangeLog (220402 => 220403)


--- trunk/Source/ThirdParty/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/ThirdParty/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,15 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        * brotli/CMakeLists.txt:
+        * gtest/CMakeLists.txt:
+        * woff2/CMakeLists.txt:
+        * xdgmime/CMakeLists.txt:
+
 2017-07-17  Michael Catanzaro  <mcatanz...@igalia.com>
 
         [CMake] Macros in WebKitMacros.cmake should be prefixed with WEBKIT_ namespace

Modified: trunk/Source/ThirdParty/brotli/CMakeLists.txt (220402 => 220403)


--- trunk/Source/ThirdParty/brotli/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/ThirdParty/brotli/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -15,8 +15,8 @@
 include_directories("${BROTLI_INCLUDE_DIRECTORIES}")
 add_definitions(-DBROTLI_BUILD_PORTABLE)
 add_library(brotli STATIC ${BROTLI_SOURCES})
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(brotli)
 
 if (COMPILER_IS_GCC_OR_CLANG)
-    WEBKIT_ADD_TARGET_PROPERTIES(brotli COMPILE_FLAGS "-Wno-cast-align -Wno-implicit-fallthrough")
+    WEBKIT_ADD_TARGET_C_FLAGS(brotli -Wno-cast-align
+                                     -Wno-implicit-fallthrough)
 endif ()

Modified: trunk/Source/ThirdParty/gtest/CMakeLists.txt (220402 => 220403)


--- trunk/Source/ThirdParty/gtest/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/ThirdParty/gtest/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -35,6 +35,9 @@
 include_directories(${GTEST_INCLUDE_DIRECTORIES})
 add_definitions(-DGTEST_HAS_RTTI=0)
 
+WEBKIT_ADD_TARGET_CXX_FLAGS(gtest -Wno-undef
+                                  -Wno-suggest-attribute=format)
+
 # FIXME: This works around compatibility problems in the old version of the third-pary
 # googletest source code checkout. It should be removed once we upgrade to a newer version.
 if (COMPILER_IS_CLANG)

Modified: trunk/Source/ThirdParty/woff2/CMakeLists.txt (220402 => 220403)


--- trunk/Source/ThirdParty/woff2/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/ThirdParty/woff2/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -16,12 +16,12 @@
 include_directories("${WOFF2_INCLUDE_DIRECTORIES}")
 add_library(woff2 STATIC ${WOFF2_SOURCES})
 target_link_libraries(woff2 brotli)
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(woff2)
 
 if (COMPILER_IS_GCC_OR_CLANG)
-    WEBKIT_ADD_TARGET_PROPERTIES(woff2 COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-variable -Wno-unused-parameter")
+    WEBKIT_ADD_TARGET_CXX_FLAGS(woff2 -Wno-cast-align
+                                      -Wno-implicit-fallthrough
+                                      -Wno-sign-compare
+                                      -Wno-unused-variable
+                                      -Wno-unused-parameter
+                                      -Wno-unused-but-set-variable)
 endif ()
-
-if (CMAKE_COMPILER_IS_GNUCXX)
-    WEBKIT_ADD_TARGET_PROPERTIES(woff2 COMPILE_FLAGS "-Wno-unused-but-set-variable")
-endif ()

Modified: trunk/Source/ThirdParty/xdgmime/CMakeLists.txt (220402 => 220403)


--- trunk/Source/ThirdParty/xdgmime/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/ThirdParty/xdgmime/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -19,8 +19,8 @@
 include_directories("${XDGMIME_INCLUDE_DIRECTORIES}")
 add_definitions(-DXDG_PREFIX=_wk_xdg)
 add_library(xdgmime STATIC ${XDGMIME_SOURCES})
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(xdgmime)
 
 if (COMPILER_IS_GCC_OR_CLANG)
-    WEBKIT_ADD_TARGET_PROPERTIES(xdgmime COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
+    WEBKIT_ADD_TARGET_C_FLAGS(xdgmime -Wno-sign-compare
+                                      -Wno-unused-parameter)
 endif ()

Modified: trunk/Source/WTF/ChangeLog (220402 => 220403)


--- trunk/Source/WTF/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WTF/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,12 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        * wtf/Compiler.h:
+
 2017-08-07  Filip Pizlo  <fpi...@apple.com>
 
         Baseline JIT should do caging

Modified: trunk/Source/WTF/wtf/Compiler.h (220402 => 220403)


--- trunk/Source/WTF/wtf/Compiler.h	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WTF/wtf/Compiler.h	2017-08-08 15:03:48 UTC (rev 220403)
@@ -102,8 +102,6 @@
 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1
 #endif
 
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-
 #endif /* COMPILER(GCC) */
 
 /* COMPILER(MINGW) - MinGW GCC */

Modified: trunk/Source/WebCore/CMakeLists.txt (220402 => 220403)


--- trunk/Source/WebCore/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -4020,7 +4020,7 @@
 # See https://bugs.webkit.org/show_bug.cgi?id=146440
 string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
 if (CMAKE_COMPILER_IS_GNUCXX AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|x86)$")
-    WEBKIT_ADD_TARGET_PROPERTIES(WebCore COMPILE_FLAGS "-fno-tree-sra")
+    WEBKIT_ADD_TARGET_CXX_FLAGS(WebCore -fno-tree-sra)
 endif ()
 
 if (MSVC)
@@ -4042,11 +4042,6 @@
 if (ENABLE_GRAPHICS_CONTEXT_3D AND NOT WIN32)
     add_library(ANGLESupport STATIC ${ANGLESupport_SOURCES})
 
-    # Suppress null conversion warnings for sources in Source/ThirdParty/ANGLE
-    if (COMPILER_IS_CLANG)
-        WEBKIT_ADD_TARGET_PROPERTIES(ANGLESupport COMPILE_FLAGS "-Wno-null-conversion")
-    endif ()
-
     # Enable the ESSL and GLSL translators.
     set_property(TARGET ANGLESupport
         PROPERTY COMPILE_DEFINITIONS
@@ -4062,7 +4057,14 @@
         "${THIRDPARTY_DIR}/ANGLE/src/common/third_party/numerics"
     )
     list(APPEND WebCore_LIBRARIES ANGLESupport)
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(ANGLESupport IGNORECXX_WARNINGS)
+
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(ANGLESupport -Wno-implicit-fallthrough
+                                                 -Wno-null-conversion
+                                                 -Wno-suggest-attribute=format
+                                                 -Wno-unused-function
+                                                 -Wno-unused-parameter)
+    endif ()
 endif ()
 
 target_link_libraries(WebCore ${WebCore_LIBRARIES})

Modified: trunk/Source/WebCore/ChangeLog (220402 => 220403)


--- trunk/Source/WebCore/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebCore/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,14 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        * CMakeLists.txt:
+        * PlatformGTK.cmake:
+        * PlatformWPE.cmake:
+
 2017-08-08  Zan Dobersek  <zdober...@igalia.com>
 
         [GStreamer] Don't use GraphicsContext3D in VideoTextureCoperGStreamer

Modified: trunk/Source/WebCore/PlatformGTK.cmake (220402 => 220403)


--- trunk/Source/WebCore/PlatformGTK.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -272,7 +272,6 @@
     # for the plugin process.
     add_library(WebCorePlatformGTK2 ${WebCore_LIBRARY_TYPE} ${WebCorePlatformGTK_SOURCES})
     add_dependencies(WebCorePlatformGTK2 WebCore)
-    WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCorePlatformGTK2)
     set_property(TARGET WebCorePlatformGTK2
         APPEND
         PROPERTY COMPILE_DEFINITIONS GTK_API_VERSION_2=1
@@ -303,7 +302,6 @@
 
 add_library(WebCorePlatformGTK ${WebCore_LIBRARY_TYPE} ${WebCorePlatformGTK_SOURCES})
 add_dependencies(WebCorePlatformGTK WebCore)
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCorePlatformGTK)
 target_include_directories(WebCorePlatformGTK PRIVATE
     ${WebCore_INCLUDE_DIRECTORIES}
 )

Modified: trunk/Source/WebCore/PlatformWPE.cmake (220402 => 220403)


--- trunk/Source/WebCore/PlatformWPE.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebCore/PlatformWPE.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -193,7 +193,6 @@
 
 add_library(WebCorePlatformWPE ${WebCore_LIBRARY_TYPE} ${WebCorePlatformWPE_SOURCES})
 add_dependencies(WebCorePlatformWPE WebCore)
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCorePlatformWPE)
 target_include_directories(WebCorePlatformWPE PRIVATE
     ${WebCore_INCLUDE_DIRECTORIES}
 )

Modified: trunk/Source/WebDriver/ChangeLog (220402 => 220403)


--- trunk/Source/WebDriver/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebDriver/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,14 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        * WebDriverService.cpp:
+        (WebDriver::WebDriverService::run):
+        * glib/SessionHostGlib.cpp:
+
 2017-08-07  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog is not a prompt

Modified: trunk/Source/WebDriver/WebDriverService.cpp (220402 => 220403)


--- trunk/Source/WebDriver/WebDriverService.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebDriver/WebDriverService.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -53,7 +53,7 @@
 int WebDriverService::run(int argc, char** argv)
 {
     String portString;
-    for (unsigned i = 1 ; i < argc; ++i) {
+    for (int i = 1 ; i < argc; ++i) {
         const char* arg = argv[i];
         if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) {
             printUsageStatement(argv[0]);

Modified: trunk/Source/WebDriver/glib/SessionHostGlib.cpp (220402 => 220403)


--- trunk/Source/WebDriver/glib/SessionHostGlib.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebDriver/glib/SessionHostGlib.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -62,7 +62,7 @@
 
 const GDBusInterfaceVTable SessionHost::s_interfaceVTable = {
     // method_call
-    [](GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName, const gchar* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData) {
+    [](GDBusConnection*, const gchar*, const gchar*, const gchar*, const gchar* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData) {
         auto* sessionHost = static_cast<SessionHost*>(userData);
         if (!g_strcmp0(methodName, "SetTargetList")) {
             guint64 connectionID;
@@ -94,6 +94,8 @@
     nullptr,
     // set_property
     nullptr,
+    // padding
+    nullptr
 };
 
 void SessionHost::connectToBrowser(Function<void (Succeeded)>&& completionHandler)

Modified: trunk/Source/WebKit/CMakeLists.txt (220402 => 220403)


--- trunk/Source/WebKit/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebKit/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -880,11 +880,6 @@
     target_link_libraries(WebKit2 -Wl,--start-group WebCore WebCoreDerivedSources -Wl,--end-group)
 endif ()
 
-# Suppress unused parameter warnings for sources in WebKit2.
-if (COMPILER_IS_GCC_OR_CLANG)
-    WEBKIT_ADD_TARGET_PROPERTIES(WebKit2 COMPILE_FLAGS "-Wno-unused-parameter")
-endif ()
-
 if (WebKit2_VERSION_SCRIPT)
     WEBKIT_ADD_TARGET_PROPERTIES(WebKit2 LINK_FLAGS "${WebKit2_VERSION_SCRIPT}")
 endif ()
@@ -911,11 +906,22 @@
     target_link_libraries(StorageProcess ${StorageProcess_LIBRARIES})
     install(TARGETS StorageProcess DESTINATION "${LIBEXEC_INSTALL_DIR}")
 
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(StorageProcess -Wno-unused-parameter)
+    endif ()
+
     if (WebKit2_StorageProcess_OUTPUT_NAME)
         set_target_properties(StorageProcess PROPERTIES OUTPUT_NAME ${WebKit2_StorageProcess_OUTPUT_NAME})
     endif ()
 endif ()
 
+# Suppress unused parameter warnings for sources in WebKit2.
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(WebKit2 -Wno-unused-parameter)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(WebProcess -Wno-unused-parameter)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(NetworkProcess -Wno-unused-parameter)
+endif ()
+
 if (ENABLE_PLUGIN_PROCESS AND NOT "${PORT}" STREQUAL "Mac")
     add_definitions(-DENABLE_PLUGIN_PROCESS=1)
     add_executable(PluginProcess ${PluginProcess_SOURCES})
@@ -923,6 +929,10 @@
     target_link_libraries(PluginProcess ${PluginProcess_LIBRARIES})
     install(TARGETS PluginProcess DESTINATION "${LIBEXEC_INSTALL_DIR}")
 
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(PluginProcess -Wno-unused-parameter)
+    endif ()
+
     if (WebKit2_PluginProcess_OUTPUT_NAME)
       set_target_properties(PluginProcess PROPERTIES OUTPUT_NAME ${WebKit2_PluginProcess_OUTPUT_NAME})
     endif ()

Modified: trunk/Source/WebKit/ChangeLog (220402 => 220403)


--- trunk/Source/WebKit/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebKit/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,13 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        * CMakeLists.txt:
+        * PlatformGTK.cmake:
+
 2017-08-07  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Web Automation: setUserInputForCurrentJavaScriptPrompt should fail if current dialog is not a prompt

Modified: trunk/Source/WebKit/PlatformGTK.cmake (220402 => 220403)


--- trunk/Source/WebKit/PlatformGTK.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/WebKit/PlatformGTK.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1066,6 +1066,10 @@
     add_dependencies(WebKitPluginProcess2 WebKit2)
 
     install(TARGETS WebKitPluginProcess2 DESTINATION "${LIBEXEC_INSTALL_DIR}")
+
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(WebKitPluginProcess2 -Wno-unused-parameter)
+    endif ()
 endif () # ENABLE_PLUGIN_PROCESS_GTK2
 
 # GTK3 PluginProcess
@@ -1090,6 +1094,10 @@
 add_webkit2_prefix_header(webkit2gtkinjectedbundle)
 target_link_libraries(webkit2gtkinjectedbundle WebKit2)
 
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(webkit2gtkinjectedbundle -Wno-unused-parameter)
+endif ()
+
 # Add ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} to LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
 if (APPLE)
     set(LOADER_LIBRARY_PATH_VAR "DYLD_LIBRARY_PATH")

Modified: trunk/Source/cmake/OptionsCommon.cmake (220402 => 220403)


--- trunk/Source/cmake/OptionsCommon.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/cmake/OptionsCommon.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,21 +1,6 @@
 add_definitions(-DBUILDING_WITH_CMAKE=1)
 add_definitions(-DHAVE_CONFIG_H=1)
 
-# CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS only matters with GCC >= 4.7.0.  Since this
-# version, -P does not output empty lines, which currently breaks make_names.pl in
-# WebCore. Investigating whether make_names.pl should be changed instead is left as an exercise to
-# the reader.
-if (MSVC)
-    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "/nologo /EP /TP")
-    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS})
-else ()
-    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "-E -P -x c++")
-    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS "-E -x c++")
-endif ()
-
-set(CODE_GENERATOR_PREPROCESSOR "\"${CMAKE_CXX_COMPILER}\" ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
-set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "\"${CMAKE_CXX_COMPILER}\" ${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS}")
-
 option(USE_THIN_ARCHIVES "Produce all static libraries as thin archives" ON)
 if (USE_THIN_ARCHIVES)
     execute_process(COMMAND ${CMAKE_AR} -V OUTPUT_VARIABLE AR_VERSION)
@@ -30,82 +15,6 @@
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 define_property(TARGET PROPERTY FOLDER INHERITED BRIEF_DOCS "folder" FULL_DOCS "IDE folder name")
 
-if (CMAKE_GENERATOR STREQUAL "Ninja")
-    if (COMPILER_IS_CLANG)
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
-    else ()
-        if (CMAKE_COMPILER_IS_GNUCC)
-            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
-        endif ()
-        if (CMAKE_COMPILER_IS_GNUCXX)
-            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
-        endif ()
-    endif ()
-endif ()
-
-# FIXME: Some warning flags should probably be set in WEBKIT_SET_EXTRA_COMPILER_FLAGS instead.
-# But language-specific warnings probably cannot be moved there.
-if (COMPILER_IS_GCC_OR_CLANG)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
-
-    if (COMPILER_IS_CLANG_CL)
-        # clang-cl.exe impersonates cl.exe so some clang arguments like -fno-rtti are
-        # represented using cl.exe's options and should not be passed as flags, so 
-        # we do not add -fno-rtti or -fno-exceptions for clang-cl
-
-        # FIXME: These warnings should be addressed
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-undef -Wno-macro-redefined -Wno-unknown-pragmas -Wno-nonportable-include-path -Wno-unknown-argument")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef -Wno-macro-redefined -Wno-unknown-pragmas -Wno-nonportable-include-path -Wno-unknown-argument")
-    else ()
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -fno-exceptions -fno-rtti")
-
-        if (WIN32)
-            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields -Wno-unknown-pragmas")
-            add_definitions(-D{CMAKE_CXX_FLAGS} -mno-ms-bitfields -Wno-unknown-pragmas)
-            add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
-        endif ()
-    endif ()
-
-    if (NOT (COMPILER_IS_CLANG AND "${CLANG_VERSION}" VERSION_LESS 4.0.0))
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-expansion-to-defined")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-expansion-to-defined")
-    endif ()
-
-    if (CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER "7.0")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type")
-    endif ()
-endif ()
-
-# Ensure that the default include system directories are added to the list of CMake implicit includes.
-# This workarounds an issue that happens when using GCC 6 and using system includes (-isystem).
-# For more details check: https://bugs.webkit.org/show_bug.cgi?id=161697
-macro(DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _compiler _flags _result)
-    file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n")
-    separate_arguments(_buildFlags UNIX_COMMAND "${_flags}")
-    execute_process(COMMAND ${_compiler} ${_buildFlags} -v -E -x ${_lang} -dD dummy
-                    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles OUTPUT_QUIET
-                    ERROR_VARIABLE _gccOutput)
-    file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
-    if ("${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list")
-        set(${_result} ${CMAKE_MATCH_1})
-        string(REPLACE "\n" " " ${_result} "${${_result}}")
-        separate_arguments(${_result})
-    endif ()
-endmacro()
-
-if (CMAKE_COMPILER_IS_GNUCC)
-   DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c" "${CMAKE_C_COMPILER}" "${CMAKE_C_FLAGS}" SYSTEM_INCLUDE_DIRS)
-   set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
-endif ()
-
-if (CMAKE_COMPILER_IS_GNUCXX)
-   DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c++" "${CMAKE_CXX_COMPILER}" "${CMAKE_CXX_FLAGS}" SYSTEM_INCLUDE_DIRS)
-   set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
-endif ()
-
 # Detect Cortex-A53 core if CPU is ARM64 and OS is Linux.
 # Query /proc/cpuinfo for each available core and check reported CPU part number: 0xd03 signals Cortex-A53.
 # (see Main ID Register in ARM Cortex-A53 MPCore Processor Technical Reference Manual)
@@ -127,12 +36,7 @@
     if (NOT WTF_CPU_ARM64)
         message(FATAL_ERROR "WTF_CPU_ARM64_CORTEXA53 set without WTF_CPU_ARM64")
     endif ()
-    CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-835769 CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
-    if (CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
-        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769")
-        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-835769")
-        message(STATUS "Enabling Cortex-A53 workaround for compiler and disabling GNU gold linker, because it doesn't support this workaround.")
-    endif ()
+    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAG(-mfix-cortex-a53-835769)
 endif ()
 
 EXPOSE_VARIABLE_TO_BUILD(WTF_CPU_ARM64_CORTEXA53)
@@ -171,8 +75,8 @@
 
 set(ENABLE_DEBUG_FISSION_DEFAULT OFF)
 if (USE_LD_GOLD AND CMAKE_BUILD_TYPE STREQUAL "Debug")
-    CHECK_CXX_ACCEPTS_FLAG(-gsplit-dwarf CXX_ACCEPTS_GSPLIT_DWARF)
-    if (CXX_ACCEPTS_GSPLIT_DWARF)
+    check_cxx_compiler_flag(-gsplit-dwarf CXX_COMPILER_SUPPORTS_GSPLIT_DWARF)
+    if (CXX_COMPILER_SUPPORTS_GSPLIT_DWARF)
         set(ENABLE_DEBUG_FISSION_DEFAULT ON)
     endif ()
 endif ()
@@ -189,26 +93,6 @@
     set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
 endif ()
 
-if (COMPILER_IS_CLANG)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
-endif ()
-
-string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "x86_64")
-    # To avoid out of memory when building with debug option in 32bit system.
-    # See https://bugs.webkit.org/show_bug.cgi?id=77327
-    set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-Wl,--no-keep-memory ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
-endif ()
-
-if (NOT MSVC)
-    string(REGEX MATCHALL "-fsanitize=[^ ]*" ENABLED_COMPILER_SANITIZERS ${CMAKE_CXX_FLAGS})
-endif ()
-
-if (UNIX AND NOT APPLE AND NOT ENABLED_COMPILER_SANITIZERS)
-    set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
-endif ()
-
 if (USE_ARM_LLVM_DISASSEMBLER)
     find_package(LLVM REQUIRED)
     SET_AND_EXPOSE_TO_BUILD(HAVE_LLVM TRUE)

Modified: trunk/Source/cmake/WebKitCommon.cmake (220402 => 220403)


--- trunk/Source/cmake/WebKitCommon.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/cmake/WebKitCommon.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -37,6 +37,8 @@
     # -----------------------------------------------------------------------------
 
     # To prevent multiple inclusion, most modules should be included once here.
+    include(CheckCCompilerFlag)
+    include(CheckCXXCompilerFlag)
     include(CheckCXXSourceCompiles)
     include(CheckFunctionExists)
     include(CheckIncludeFile)
@@ -46,11 +48,11 @@
     include(CMakeDependentOption)
     include(CMakeParseArguments)
     include(ProcessorCount)
-    include(TestCXXAcceptsFlag)
 
     include(WebKitPackaging)
     include(WebKitMacros)
     include(WebKitFS)
+    include(WebKitCompilerFlags)
     include(WebKitFeatures)
 
     include(OptionsCommon)

Added: trunk/Source/cmake/WebKitCompilerFlags.cmake (0 => 220403)


--- trunk/Source/cmake/WebKitCompilerFlags.cmake	                        (rev 0)
+++ trunk/Source/cmake/WebKitCompilerFlags.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -0,0 +1,200 @@
+# Prepends flags to CMAKE_C_FLAGS if supported by the C compiler. Almost all
+# flags should be prepended to allow the user to override them.
+macro(WEBKIT_PREPEND_GLOBAL_C_FLAGS)
+    foreach (_flag ${ARGN})
+        check_c_compiler_flag("${_flag}" C_COMPILER_SUPPORTS_${_flag})
+        if (C_COMPILER_SUPPORTS_${_flag})
+            set(CMAKE_C_FLAGS "${_flag} ${CMAKE_C_FLAGS}")
+        endif ()
+    endforeach ()
+endmacro()
+
+# Appends flags to CMAKE_C_FLAGS if supported by the C compiler. This macro
+# should be used sparingly. Only append flags if the user must not be allowed to
+# override them.
+macro(WEBKIT_APPEND_GLOBAL_C_FLAGS)
+    foreach (_flag ${ARGN})
+        check_c_compiler_flag("${_flag}" C_COMPILER_SUPPORTS_${_flag})
+        if (C_COMPILER_SUPPORTS_${_flag})
+            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}")
+        endif ()
+    endforeach ()
+endmacro()
+
+# Prepends flags to CMAKE_CXX_FLAGS if supported by the C++ compiler. Almost all
+# flags should be prepended to allow the user to override them.
+macro(WEBKIT_PREPEND_GLOBAL_CXX_FLAGS)
+    foreach (_flag ${ARGN})
+        check_cxx_compiler_flag("${_flag}" CXX_COMPILER_SUPPORTS_${_flag})
+        if (CXX_COMPILER_SUPPORTS_${_flag})
+            set(CMAKE_CXX_FLAGS "${_flag} ${CMAKE_CXX_FLAGS}")
+        endif ()
+    endforeach ()
+endmacro()
+
+# Appends flags to CMAKE_CXX_FLAGS if supported by the C++ compiler. This macro
+# should be used sparingly. Only append flags if the user must not be allowed to
+# override them.
+macro(WEBKIT_APPEND_GLOBAL_CXX_FLAGS)
+    foreach (_flag ${ARGN})
+        check_cxx_compiler_flag("${_flag}" CXX_COMPILER_SUPPORTS_${_flag})
+        if (CXX_COMPILER_SUPPORTS_${_flag})
+            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}")
+        endif ()
+    endforeach ()
+endmacro()
+
+# Prepends flags to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if supported by the C
+# or C++ compiler, respectively. Almost all flags should be prepended to allow
+# the user to override them.
+macro(WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS)
+    WEBKIT_PREPEND_GLOBAL_C_FLAGS(${ARGN})
+    WEBKIT_PREPEND_GLOBAL_CXX_FLAGS(${ARGN})
+endmacro()
+
+# Appends flags to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS if supported by the C or
+# C++ compiler, respectively. This macro should be used sparingly. Only append
+# flags if the user must not be allowed to override them.
+macro(WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS)
+    WEBKIT_APPEND_GLOBAL_C_FLAGS(${ARGN})
+    WEBKIT_APPEND_GLOBAL_CXX_FLAGS(${ARGN})
+endmacro()
+
+# Appends flags to COMPILE_FLAGS of _target if supported by the C compiler.
+# Note that it is simply not possible to pass different C and C++ flags, unless
+# we drop support for the Visual Studio backend and use the COMPILE_LANGUAGE
+# generator _expression_. This is a very serious limitation.
+macro(WEBKIT_ADD_TARGET_C_FLAGS _target)
+    foreach (_flag ${ARGN})
+        check_c_compiler_flag("${_flag}" C_COMPILER_SUPPORTS_${_flag})
+        if (C_COMPILER_SUPPORTS_${_flag})
+            target_compile_options(${_target} PRIVATE ${_flag})
+        endif ()
+    endforeach ()
+endmacro()
+
+# Appends flags to COMPILE_FLAGS of _target if supported by the C++ compiler.
+# Note that it is simply not possible to pass different C and C++ flags, unless
+# we drop support for the Visual Studio backend and use the COMPILE_LANGUAGE
+# generator _expression_. This is a very serious limitation.
+macro(WEBKIT_ADD_TARGET_CXX_FLAGS _target)
+    foreach (_flag ${ARGN})
+        check_cxx_compiler_flag("${_flag}" CXX_COMPILER_SUPPORTS_${_flag})
+        if (CXX_COMPILER_SUPPORTS_${_flag})
+            target_compile_options(${_target} PRIVATE ${_flag})
+        endif ()
+    endforeach ()
+endmacro()
+
+
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS(-fno-strict-aliasing)
+
+    # clang-cl.exe impersonates cl.exe so some clang arguments like -fno-rtti are
+    # represented using cl.exe's options and should not be passed as flags, so
+    # we do not add -fno-rtti or -fno-exceptions for clang-cl
+    if (COMPILER_IS_CLANG_CL)
+        # FIXME: These warnings should be addressed
+        WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-undef
+                                             -Wno-macro-redefined
+                                             -Wno-unknown-pragmas
+                                             -Wno-nonportable-include-path
+                                             -Wno-unknown-argument)
+    else ()
+        WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS(-fno-exceptions)
+        WEBKIT_APPEND_GLOBAL_CXX_FLAGS(-std=c++14
+                                       -fno-rtti)
+
+        if (WIN32)
+            WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS(-mno-ms-bitfields)
+            WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wno-unknown-pragmas)
+            add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
+        endif ()
+    endif ()
+
+    # Warnings to be enabled
+    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Wall
+                                         -Wextra
+                                         -Wcast-align
+                                         -Wformat-security
+                                         -Wmissing-format-attribute
+                                         -Wpointer-arith
+                                         -Wundef
+                                         -Wwrite-strings)
+
+    # Warnings to be disabled
+    # FIXME: We should probably not be disabling -Wno-maybe-uninitialized?
+    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-Qunused-arguments
+                                         -Wno-expansion-to-defined
+                                         -Wno-maybe-uninitialized
+                                         -Wno-noexcept-type
+                                         -Wno-parentheses-equality)
+endif ()
+
+
+# Ninja tricks compilers into turning off color support.
+if (CMAKE_GENERATOR STREQUAL "Ninja")
+    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-fcolor-diagnostics
+                                         -fdiagnostics-color=always)
+endif ()
+
+
+string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "x86_64")
+    # To avoid out of memory when building with debug option in 32bit system.
+    # See https://bugs.webkit.org/show_bug.cgi?id=77327
+    set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-Wl,--no-keep-memory ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
+endif ()
+
+
+if (NOT MSVC)
+    string(REGEX MATCHALL "-fsanitize=[^ ]*" ENABLED_COMPILER_SANITIZERS ${CMAKE_CXX_FLAGS})
+endif ()
+
+if (UNIX AND NOT APPLE AND NOT ENABLED_COMPILER_SANITIZERS)
+    set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
+endif ()
+
+
+# CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS only matters with GCC >= 4.7.0.  Since this
+# version, -P does not output empty lines, which currently breaks make_names.pl in
+# WebCore. Investigating whether make_names.pl should be changed instead is left as an exercise to
+# the reader.
+if (MSVC)
+    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "/nologo /EP /TP")
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS})
+else ()
+    set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "-E -P -x c++")
+    set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS "-E -x c++")
+endif ()
+
+set(CODE_GENERATOR_PREPROCESSOR "\"${CMAKE_CXX_COMPILER}\" ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
+set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "\"${CMAKE_CXX_COMPILER}\" ${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS}")
+
+
+# Ensure that the default include system directories are added to the list of CMake implicit includes.
+# This workarounds an issue that happens when using GCC 6 and using system includes (-isystem).
+# For more details check: https://bugs.webkit.org/show_bug.cgi?id=161697
+macro(DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _compiler _flags _result)
+    file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n")
+    separate_arguments(_buildFlags UNIX_COMMAND "${_flags}")
+    execute_process(COMMAND ${_compiler} ${_buildFlags} -v -E -x ${_lang} -dD dummy
+                    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles OUTPUT_QUIET
+                    ERROR_VARIABLE _gccOutput)
+    file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
+    if ("${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list")
+        set(${_result} ${CMAKE_MATCH_1})
+        string(REPLACE "\n" " " ${_result} "${${_result}}")
+        separate_arguments(${_result})
+    endif ()
+endmacro()
+
+if (CMAKE_COMPILER_IS_GNUCC)
+   DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c" "${CMAKE_C_COMPILER}" "${CMAKE_C_FLAGS}" SYSTEM_INCLUDE_DIRS)
+   set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
+endif ()
+
+if (CMAKE_COMPILER_IS_GNUCXX)
+   DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c++" "${CMAKE_CXX_COMPILER}" "${CMAKE_CXX_FLAGS}" SYSTEM_INCLUDE_DIRS)
+   set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
+endif ()

Modified: trunk/Source/cmake/WebKitMacros.cmake (220402 => 220403)


--- trunk/Source/cmake/WebKitMacros.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Source/cmake/WebKitMacros.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -176,46 +176,6 @@
     endforeach ()
 endmacro()
 
-# Sets extra compile flags for a target, depending on the compiler being used.
-# Currently, only GCC is supported.
-macro(WEBKIT_SET_EXTRA_COMPILER_FLAGS _target)
-    set(options ENABLE_WERROR IGNORECXX_WARNINGS)
-    CMAKE_PARSE_ARGUMENTS("OPTION" "${options}" "" "" ${ARGN})
-    if (COMPILER_IS_GCC_OR_CLANG)
-        get_target_property(OLD_COMPILE_FLAGS ${_target} COMPILE_FLAGS)
-        if (${OLD_COMPILE_FLAGS} STREQUAL "OLD_COMPILE_FLAGS-NOTFOUND")
-            set(OLD_COMPILE_FLAGS "")
-        endif ()
-
-        if (NOT WIN32)
-            get_target_property(TARGET_TYPE ${_target} TYPE)
-            if (${TARGET_TYPE} STREQUAL "STATIC_LIBRARY") # -fPIC is automatically added to shared libraries
-                set(OLD_COMPILE_FLAGS "-fPIC ${OLD_COMPILE_FLAGS}")
-            endif ()
-        endif ()
-
-        # Suppress -Wparentheses-equality warning of Clang
-        if (COMPILER_IS_CLANG)
-            set(OLD_COMPILE_FLAGS "-Wno-parentheses-equality ${OLD_COMPILE_FLAGS}")
-        endif ()
-
-        # Enable warnings by default
-        if (NOT ${OPTION_IGNORECXX_WARNINGS})
-            set(OLD_COMPILE_FLAGS "-Wall -Wextra -Wcast-align -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wundef -Wwrite-strings ${OLD_COMPILE_FLAGS}")
-        endif ()
-
-        # Enable errors on warning
-        if (OPTION_ENABLE_WERROR)
-            set(OLD_COMPILE_FLAGS "-Werror ${OLD_COMPILE_FLAGS}")
-        endif ()
-
-        set_target_properties(${_target} PROPERTIES
-            COMPILE_FLAGS "${OLD_COMPILE_FLAGS}")
-
-        unset(OLD_COMPILE_FLAGS)
-    endif ()
-endmacro()
-
 # Append the given flag to the target property.
 # Builds on top of get_target_property() and set_target_properties()
 macro(WEBKIT_ADD_TARGET_PROPERTIES _target _property _flags)

Modified: trunk/Tools/ChangeLog (220402 => 220403)


--- trunk/Tools/ChangeLog	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/ChangeLog	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1,3 +1,40 @@
+2017-08-08  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [CMake] Properly test if compiler supports compiler flags
+        https://bugs.webkit.org/show_bug.cgi?id=174490
+
+        Reviewed by Konstantin Tokarev.
+
+        * DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
+        * MiniBrowser/gtk/CMakeLists.txt:
+        * TestRunnerShared/Bindings/JSWrapper.cpp:
+        (WTR::JSWrapper::initialize):
+        * TestWebKitAPI/CMakeLists.txt:
+        * TestWebKitAPI/PlatformGTK.cmake:
+        * TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp:
+        (TestWebKitAPI::CheckedArithmeticTester::run):
+        * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp:
+        * TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:
+        * TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp:
+        (formControlsAssociatedCallback):
+        * TestWebKitAPI/glib/CMakeLists.txt:
+        * TestWebKitAPI/glib/WebKitGLib/TestMain.h:
+        (Test::getResourcesDir):
+        * WebKitTestRunner/CMakeLists.txt:
+        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+        (WTR::menuItemClickCallback):
+        (WTR::staticConvertMenuItemToType):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setUseDashboardCompatibilityMode):
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
+        (WTR::AccessibilityNotificationHandler::disconnectAccessibilityCallbacks):
+        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+        (WTR::AccessibilityUIElement::helpText const):
+        (WTR::AccessibilityUIElement::attributedStringForRange):
+        * WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
+        (WTR::EventSenderProxy::updateTouchPoint):
+        (WTR::EventSenderProxy::releaseTouchPoint):
+
 2017-08-08  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [iOS WK2] WKWebView schedules nonstop layout after pressing cmb+b,i,u inside a contenteditable div

Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt (220402 => 220403)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -55,7 +55,5 @@
 add_library(TestNetscapePlugIn SHARED ${WebKitTestNetscapePlugIn_SOURCES})
 target_link_libraries(TestNetscapePlugIn ${WebKitTestNetscapePlugIn_LIBRARIES})
 set_target_properties(TestNetscapePlugIn PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins)
-WEBKIT_SET_EXTRA_COMPILER_FLAGS(TestNetscapePlugIn)
 
-# Suppress unused parameter warnings for sources in WebKit2.
-WEBKIT_ADD_TARGET_PROPERTIES(TestNetscapePlugIn COMPILE_FLAGS "-Wno-unused-parameter")
+WEBKIT_ADD_TARGET_CXX_FLAGS(TestNetscapePlugIn -Wno-unused-parameter)

Modified: trunk/Tools/MiniBrowser/gtk/CMakeLists.txt (220402 => 220403)


--- trunk/Tools/MiniBrowser/gtk/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/MiniBrowser/gtk/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -61,4 +61,6 @@
 add_executable(MiniBrowser ${MiniBrowser_SOURCES})
 target_link_libraries(MiniBrowser ${MiniBrowser_LIBRARIES})
 
+WEBKIT_ADD_TARGET_CXX_FLAGS(MiniBrowser -Wno-unused-parameter)
+
 install(TARGETS MiniBrowser DESTINATION "${LIBEXEC_INSTALL_DIR}")

Modified: trunk/Tools/TestRunnerShared/Bindings/JSWrapper.cpp (220402 => 220403)


--- trunk/Tools/TestRunnerShared/Bindings/JSWrapper.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestRunnerShared/Bindings/JSWrapper.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -61,7 +61,7 @@
     return wrappable;
 }
 
-void JSWrapper::initialize(JSContextRef ctx, JSObjectRef object)
+void JSWrapper::initialize(JSContextRef, JSObjectRef object)
 {
     JSWrappable* wrappable = unwrapObject(object);
     if (!wrappable)

Modified: trunk/Tools/TestWebKitAPI/CMakeLists.txt (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -151,6 +151,13 @@
 
     target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
     add_dependencies(TestWebKitAPIInjectedBundle WTF ${ForwardingHeadersForTestWebKitAPI_NAME})
+
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKitAPIInjectedBundle -Wno-dangling-else
+                                                                -Wno-sign-compare
+                                                                -Wno-undef
+                                                                -Wno-unused-parameter)
+    endif ()
 endif ()
 
 if (WIN32)
@@ -186,6 +193,13 @@
     RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}
 )
 
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(TestWTF -Wno-dangling-else
+                                        -Wno-sign-compare
+                                        -Wno-undef
+                                        -Wno-unused-parameter)
+endif ()
+
 if (ENABLE_WEBKIT)
     add_library(TestWebKitAPIBase
         ${test_main_SOURCES}
@@ -198,4 +212,10 @@
     target_link_libraries(TestWebKitAPIBase _javascript_Core WTF WebKit2 gtest)
 
     add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
+
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKitAPIBase -Wno-sign-compare
+                                                      -Wno-undef
+                                                      -Wno-unused-parameter)
+    endif ()
 endif ()

Modified: trunk/Tools/TestWebKitAPI/PlatformGTK.cmake (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/PlatformGTK.cmake	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/PlatformGTK.cmake	2017-08-08 15:03:48 UTC (rev 220403)
@@ -156,3 +156,13 @@
     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/GUniquePtr.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/WorkQueueGLib.cpp
 )
+
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKit2 -Wno-sign-compare
+                                            -Wno-undef
+                                            -Wno-unused-parameter)
+
+    WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebCore -Wno-sign-compare
+                                            -Wno-undef
+                                            -Wno-unused-parameter)
+endif ()

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -168,7 +168,15 @@
 
         Checked<type, OverflowCrashLogger> nvalue; // to hold a not overflowed value.
         Checked<type, OverflowCrashLogger> ovalue; // to hold an overflowed value.
+
+#if COMPILER(GCC)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
         bool unused;
+#if COMPILER(GCC)
+#pragma GCC diagnostic pop
+#endif
 
         _value = 75;
         type _largeValue = 100;

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -96,6 +96,8 @@
         nullptr,
         // set_property
         nullptr,
+        // padding
+        nullptr
     };
 
     void registerDBusObject()

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -23,7 +23,6 @@
 #include "WebViewTest.h"
 #include <wtf/glib/GRefPtr.h>
 
-static const char* webExtensionsUserData = "Web Extensions user data";
 static WebKitTestBus* bus;
 static GUniquePtr<char> scriptDialogResult;
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -290,7 +290,7 @@
 static void formControlsAssociatedCallback(WebKitWebPage* webPage, GPtrArray* formElements, WebKitWebExtension* extension)
 {
     GString* formIdsBuilder = g_string_new(nullptr);
-    for (int i = 0; i < formElements->len; ++i) {
+    for (guint i = 0; i < formElements->len; ++i) {
         g_assert(WEBKIT_DOM_IS_ELEMENT(g_ptr_array_index(formElements, i)));
         auto domElement = WEBKIT_DOM_ELEMENT(g_ptr_array_index(formElements, i));
         GUniquePtr<char> elementID(webkit_dom_element_get_id(domElement));

Modified: trunk/Tools/TestWebKitAPI/glib/CMakeLists.txt (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/glib/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/glib/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -51,6 +51,10 @@
         LIBRARY_OUTPUT_DIRECTORY ${TEST_LIBRARY_DIR}
     )
     target_link_libraries(${extension_name} ${WebKitGLibAPITestExtension_LIBRARIES})
+
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(${extension_name} -Wno-unused-parameter)
+    endif ()
 endmacro()
 
 macro(ADD_WK2_TEST test_name)
@@ -63,6 +67,10 @@
         RUNTIME_OUTPUT_DIRECTORY ${TEST_BINARY_DIR}
     )
     target_link_libraries(${test_name} ${WebKitGLibAPITest_LIBRARIES})
+
+    if (COMPILER_IS_GCC_OR_CLANG)
+        WEBKIT_ADD_TARGET_CXX_FLAGS(${test_name} -Wno-unused-parameter)
+    endif ()
 endmacro()
 
 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
@@ -85,6 +93,10 @@
 add_library(WebKitGLibAPITestsCore STATIC ${WebKitGLibAPITests_SOURCES})
 target_link_libraries(WebKitGLibAPITestsCore WebKit2)
 
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(WebKitGLibAPITestsCore -Wno-unused-parameter)
+endif ()
+
 add_custom_command(
     OUTPUT ${TEST_RESOURCES_DIR}/webkitglib-tests-resources.gresource
     DEPENDS ${TOOLS_DIR}/TestWebKitAPI/Tests/WebKitGLib/resources/webkitglib-tests.gresource.xml

Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h (220402 => 220403)


--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h	2017-08-08 15:03:48 UTC (rev 220403)
@@ -56,15 +56,13 @@
 #define MAKE_GLIB_TEST_FIXTURE_WITH_SETUP_TEARDOWN(ClassName, setup, teardown) \
     static void setUp(ClassName* fixture, gconstpointer data) \
     { \
-        if (setup) \
-            setup(); \
+        setup(); \
         new (fixture) ClassName; \
     } \
     static void tearDown(ClassName* fixture, gconstpointer data) \
     { \
         fixture->~ClassName(); \
-        if (teardown) \
-            teardown(); \
+        teardown(); \
     } \
     static void add(const char* suiteName, const char* testName, void (*testFunc)(ClassName*, const void*)) \
     { \
@@ -173,6 +171,7 @@
             return resourcesDir.get();
         }
         }
+        RELEASE_ASSERT_NOT_REACHED();
     }
 
     void addLogFatalFlag(unsigned flag)

Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (220402 => 220403)


--- trunk/Tools/WebKitTestRunner/CMakeLists.txt	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt	2017-08-08 15:03:48 UTC (rev 220403)
@@ -116,6 +116,11 @@
 target_link_libraries(WebKitTestRunner ${WebKitTestRunner_LIBRARIES})
 add_dependencies(WebKitTestRunner WebKitTestRunnerBindings)
 
+if (COMPILER_IS_GCC_OR_CLANG)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(TestRunnerInjectedBundle -Wno-unused-parameter)
+    WEBKIT_ADD_TARGET_CXX_FLAGS(WebKitTestRunner -Wno-unused-parameter)
+endif ()
+
 if (NOT APPLE)
     add_dependencies(WebKit2 ${ForwardingHeadersForWebKitTestRunner_NAME})
-endif ()
\ No newline at end of file
+endif ()

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (220402 => 220403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -52,7 +52,7 @@
 };
 
 #if ENABLE(CONTEXT_MENUS)
-static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*)
 {
     MenuItemPrivateData* privateData = static_cast<MenuItemPrivateData*>(JSObjectGetPrivate(thisObject));
     WKBundlePageClickMenuItem(privateData->m_page, privateData->m_item.get());
@@ -81,7 +81,7 @@
     delete static_cast<MenuItemPrivateData*>(JSObjectGetPrivate(object));
 }
 
-static JSValueRef staticConvertMenuItemToType(JSContextRef context, JSObjectRef object, JSType type, JSValueRef* exception)
+static JSValueRef staticConvertMenuItemToType(JSContextRef context, JSObjectRef object, JSType type, JSValueRef*)
 {
     if (kJSTypeString == type)
         return getMenuItemTitleCallback(context, object, 0, 0);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (220402 => 220403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -467,6 +467,8 @@
 #if ENABLE(DASHBOARD_SUPPORT)
     auto& injectedBundle = InjectedBundle::singleton();
     WKBundleSetUseDashboardCompatibilityMode(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+#else
+    UNUSED_PARAM(enabled);
 #endif
 }
     

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp (220402 => 220403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -112,7 +112,7 @@
         arguments[0] = toJS(jsContext, WTF::getPtr(WTR::AccessibilityUIElement::create(accessible)));
         arguments[1] = notificationNameArgument;
         size_t numOfExtraArgs = extraArgs.size();
-        for (int i = 0; i < numOfExtraArgs; i++)
+        for (size_t i = 0; i < numOfExtraArgs; i++)
             arguments[i + 2] = extraArgs[i];
         if (elementNotificationHandler != notificationHandlers.end()) {
             // Listener for one element. As arguments, it gets the notification name
@@ -256,7 +256,7 @@
         return false;
 
     // AtkObject signals.
-    for (int i = 0; i < listenerIds.size(); i++) {
+    for (size_t i = 0; i < listenerIds.size(); i++) {
         ASSERT(listenerIds[i]);
         atk_remove_global_event_listener(listenerIds[i]);
     }

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (220402 => 220403)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -1415,7 +1415,7 @@
     StringBuilder builder;
     builder.append("AXHelp: ");
 
-    for (int targetCount = 0; targetCount < targetList->len; targetCount++) {
+    for (guint targetCount = 0; targetCount < targetList->len; targetCount++) {
         if (AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, targetCount))) {
             GUniquePtr<gchar> text(atk_text_get_text(ATK_TEXT(target), 0, -1));
             if (targetCount)
@@ -1756,7 +1756,7 @@
     AtkAttributeSet* attributeSet;
     AtkText* text = ATK_TEXT(m_element.get());
     gint start = 0, end = 0;
-    for (int i = location; i < location + length; i = end) {
+    for (unsigned i = location; i < location + length; i = end) {
         AtkAttributeSet* attributeSet = atk_text_get_run_attributes(text, i, &start, &end);
         GUniquePtr<gchar> substring(replaceCharactersForResults(atk_text_get_text(text, start, end)));
         builder.append(String::format("\n\tRange attributes for '%s':\n\t\t", substring.get()));

Modified: trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp (220402 => 220403)


--- trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp	2017-08-08 13:29:30 UTC (rev 220402)
+++ trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp	2017-08-08 15:03:48 UTC (rev 220403)
@@ -505,7 +505,7 @@
 
 void EventSenderProxy::updateTouchPoint(int index, int x, int y)
 {
-    ASSERT(index >= 0 && index < m_touchEvents.size());
+    ASSERT(index >= 0 && static_cast<size_t>(index) < m_touchEvents.size());
 
     const auto& event = m_touchEvents[index];
     ASSERT(event);
@@ -551,7 +551,7 @@
 
 void EventSenderProxy::releaseTouchPoint(int index)
 {
-    ASSERT(index >= 0 && index < m_touchEvents.size());
+    ASSERT(index >= 0 && static_cast<size_t>(index) < m_touchEvents.size());
 
     const auto& event = m_touchEvents[index];
     event->type = GDK_TOUCH_END;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to