Changeset 220403 in webkit


Ignore:
Timestamp:
Aug 8, 2017 8:03:48 AM (7 years ago)
Author:
Michael Catanzaro
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/JavaScriptCore:

  • 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):

Location:
trunk
Files:
1 added
46 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r219602 r220403  
    127127set(WebCoreTestSupport_LIBRARY_TYPE STATIC)
    128128
     129set(CMAKE_POSITION_INDEPENDENT_CODE True)
     130
    129131# -----------------------------------------------------------------------------
    130132# Install JavaScript shell
  • trunk/ChangeLog

    r220336 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        This turned out to be a massive pain. I didn't want to merely check options before using
     9        them: I also wanted to organize the code to avoid setting similar flags in different places.
     10        Right now we set a bunch of global flags in OptionsCommon.cmake, and a bunch more flags in
     11        WEBKIT_SET_EXTRA_COMPILER_FLAGS on a per-target basis.
     12
     13        Setting flags per-target seems better in general, e.g. because it makes it very easy to
     14        disable warnings for particular ThirdParty targets. But it turns out that all the flags set
     15        on a per-target basis get passed to both the C compiler and the C++ compiler, so it's
     16        impossible to pass C++-only flags there. That's terrible. It's possible to make the flags
     17        language-conditional using generator expressions, but that doesn't work for the Visual
     18        Studio backend, so we would have to drop support for that (not going to happen). The CMake
     19        documentation suggests that C and C++ files ought to be built in separate targets to avoid
     20        this. It's a mess, basically.
     21
     22        So I've wound up removing WEBKIT_SET_EXTRA_COMPILER_FLAGS and adding most of those flags to
     23        CMAKE_C_FLAGS and CMAKE_CXX_FLAGS instead. Really the only disadvantage of this is we now
     24        have to suppress individual warnings when building ANGLESupport in WebCore. That's not the
     25        end of the world. The only remaining useful feature of WEBKIT_SET_EXTRA_COMPILER_FLAGS was
     26        to add -fPIC to static library targets, but turns out CMake does that for us if we just set
     27        the variable CMAKE_POSITION_INDEPENDENT_CODE, so we can get rid of it completely.
     28
     29        Of course there are also macros for setting target-specific compiler flags, which we
     30        frequently need in order to suppress specific warnings, particularly warnings coming from
     31        third-party libraries like ANGLE and gtest. But remember the footgun: these macros will test
     32        the flag against only one compiler, but must work with both C and C++ compilers unless the
     33        build target exclusively contains targets built with just one of those compilers. Yuck.
     34
     35        * CMakeLists.txt:
     36        * Source/CMakeLists.txt:
     37        * Source/PlatformGTK.cmake:
     38        * Source/cmake/OptionsCommon.cmake:
     39        * Source/cmake/WebKitCommon.cmake:
     40        * Source/cmake/WebKitCompilerFlags.cmake: Added.
     41        * Source/cmake/WebKitMacros.cmake:
     42
    1432017-08-07  Brian Burg  <bburg@apple.com>
    244
  • trunk/Source/CMakeLists.txt

    r219605 r220403  
    4444
    4545WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
    46 
    47 # -----------------------------------------------------------------------------
    48 # Set compiler flags for all targets
    49 # -----------------------------------------------------------------------------
    50 if (NOT USE_SYSTEM_MALLOC)
    51     WEBKIT_SET_EXTRA_COMPILER_FLAGS(bmalloc ${ADDITIONAL_COMPILER_FLAGS})
    52 endif ()
    53 WEBKIT_SET_EXTRA_COMPILER_FLAGS(WTF ${ADDITIONAL_COMPILER_FLAGS})
    54 WEBKIT_SET_EXTRA_COMPILER_FLAGS(JavaScriptCore ${ADDITIONAL_COMPILER_FLAGS})
    55 
    56 if (ENABLE_WEBCORE)
    57     WEBKIT_SET_EXTRA_COMPILER_FLAGS(PAL ${ADDITIONAL_COMPILER_FLAGS})
    58     WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCoreTestSupport ${ADDITIONAL_COMPILER_FLAGS})
    59     WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCore ${ADDITIONAL_COMPILER_FLAGS})
    60     WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCoreDerivedSources ${ADDITIONAL_COMPILER_FLAGS})
    61 endif ()
    62 
    63 if (ENABLE_WEBKIT_LEGACY)
    64     # FIXME: Rename this target to WebKitLegacy.
    65     WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebKit ${ADDITIONAL_COMPILER_FLAGS})
    66 endif ()
    67 
    68 if (ENABLE_WEBKIT)
    69     # FIXME: Rename this target to WebKit.
    70     WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebKit2 ${ADDITIONAL_COMPILER_FLAGS})
    71 endif ()
  • trunk/Source/JavaScriptCore/API/tests/PingPongStackOverflowTest.cpp

    r216914 r220403  
    143143        "undefined instanceof PingPongStackOverflowObject;";
    144144
    145     JSValueRef scriptResult = nullptr;
    146145    JSValueRef exception = nullptr;
    147146    JSStringRef script = JSStringCreateWithUTF8CString(scriptString);
     
    162161
    163162    exception = nullptr;
    164     scriptResult = JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
     163    JSEvaluateScript(context, script, nullptr, nullptr, 1, &exception);
    165164
    166165    if (!exception) {
  • trunk/Source/JavaScriptCore/API/tests/testapi.c

    r218936 r220403  
    11351135}
    11361136
     1137#if COMPILER(GCC)
     1138#pragma GCC diagnostic push
     1139#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
     1140#endif
    11371141static void checkConstnessInJSObjectNames()
    11381142{
     
    11421146    val.name = "something";
    11431147}
     1148#if COMPILER(GCC)
     1149#pragma GCC diagnostic pop
     1150#endif
    11441151
    11451152#ifdef __cplusplus
  • trunk/Source/JavaScriptCore/ChangeLog

    r220401 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * API/tests/PingPongStackOverflowTest.cpp:
     9        (testPingPongStackOverflow):
     10        * API/tests/testapi.c:
     11        * b3/testb3.cpp:
     12        (JSC::B3::testPatchpointLotsOfLateAnys):
     13
    1142017-08-06  Yusuke Suzuki  <utatane.tea@gmail.com>
    215
  • trunk/Source/JavaScriptCore/b3/testb3.cpp

    r219898 r220403  
    84828482    root->appendNewControlValue(proc, Return, Origin(), patchpoint);
    84838483
    8484     CHECK(compileAndRun<int>(proc) == (things.size() * (things.size() - 1)) / 2);
     8484    CHECK(static_cast<size_t>(compileAndRun<int>(proc)) == (things.size() * (things.size() - 1)) / 2);
    84858485}
    84868486
  • trunk/Source/PlatformGTK.cmake

    r219486 r220403  
    2525        OUTPUT "${CMAKE_BINARY_DIR}/${_stamp_name}"
    2626        DEPENDS ${DocumentationDependencies}
    27         COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=${CMAKE_C_FLAGS} ${CMAKE_SOURCE_DIR}/Tools/gtk/generate-gtkdoc ${_extra_args}
     27        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}
    2828        COMMAND touch ${_stamp_name}
    2929        WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
     30        VERBATIM
    3031    )
    3132endmacro()
  • trunk/Source/ThirdParty/ChangeLog

    r219578 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * brotli/CMakeLists.txt:
     9        * gtest/CMakeLists.txt:
     10        * woff2/CMakeLists.txt:
     11        * xdgmime/CMakeLists.txt:
     12
    1132017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
    214
  • trunk/Source/ThirdParty/brotli/CMakeLists.txt

    r219578 r220403  
    1616add_definitions(-DBROTLI_BUILD_PORTABLE)
    1717add_library(brotli STATIC ${BROTLI_SOURCES})
    18 WEBKIT_SET_EXTRA_COMPILER_FLAGS(brotli)
    1918
    2019if (COMPILER_IS_GCC_OR_CLANG)
    21     WEBKIT_ADD_TARGET_PROPERTIES(brotli COMPILE_FLAGS "-Wno-cast-align -Wno-implicit-fallthrough")
     20    WEBKIT_ADD_TARGET_C_FLAGS(brotli -Wno-cast-align
     21                                     -Wno-implicit-fallthrough)
    2222endif ()
  • trunk/Source/ThirdParty/gtest/CMakeLists.txt

    r211050 r220403  
    3636add_definitions(-DGTEST_HAS_RTTI=0)
    3737
     38WEBKIT_ADD_TARGET_CXX_FLAGS(gtest -Wno-undef
     39                                  -Wno-suggest-attribute=format)
     40
    3841# FIXME: This works around compatibility problems in the old version of the third-pary
    3942# googletest source code checkout. It should be removed once we upgrade to a newer version.
  • trunk/Source/ThirdParty/woff2/CMakeLists.txt

    r219578 r220403  
    1717add_library(woff2 STATIC ${WOFF2_SOURCES})
    1818target_link_libraries(woff2 brotli)
    19 WEBKIT_SET_EXTRA_COMPILER_FLAGS(woff2)
    2019
    2120if (COMPILER_IS_GCC_OR_CLANG)
    22     WEBKIT_ADD_TARGET_PROPERTIES(woff2 COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-variable -Wno-unused-parameter")
     21    WEBKIT_ADD_TARGET_CXX_FLAGS(woff2 -Wno-cast-align
     22                                      -Wno-implicit-fallthrough
     23                                      -Wno-sign-compare
     24                                      -Wno-unused-variable
     25                                      -Wno-unused-parameter
     26                                      -Wno-unused-but-set-variable)
    2327endif ()
    24 
    25 if (CMAKE_COMPILER_IS_GNUCXX)
    26     WEBKIT_ADD_TARGET_PROPERTIES(woff2 COMPILE_FLAGS "-Wno-unused-but-set-variable")
    27 endif ()
  • trunk/Source/ThirdParty/xdgmime/CMakeLists.txt

    r219578 r220403  
    2020add_definitions(-DXDG_PREFIX=_wk_xdg)
    2121add_library(xdgmime STATIC ${XDGMIME_SOURCES})
    22 WEBKIT_SET_EXTRA_COMPILER_FLAGS(xdgmime)
    2322
    2423if (COMPILER_IS_GCC_OR_CLANG)
    25     WEBKIT_ADD_TARGET_PROPERTIES(xdgmime COMPILE_FLAGS "-Wno-sign-compare -Wno-unused-parameter")
     24    WEBKIT_ADD_TARGET_C_FLAGS(xdgmime -Wno-sign-compare
     25                                      -Wno-unused-parameter)
    2626endif ()
  • trunk/Source/WTF/ChangeLog

    r220368 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * wtf/Compiler.h:
     9
    1102017-08-07  Filip Pizlo  <fpizlo@apple.com>
    211
  • trunk/Source/WTF/wtf/Compiler.h

    r219791 r220403  
    103103#endif
    104104
    105 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
    106 
    107105#endif /* COMPILER(GCC) */
    108106
  • trunk/Source/WebCore/CMakeLists.txt

    r220344 r220403  
    40214021string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
    40224022if (CMAKE_COMPILER_IS_GNUCXX AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|x86)$")
    4023     WEBKIT_ADD_TARGET_PROPERTIES(WebCore COMPILE_FLAGS "-fno-tree-sra")
     4023    WEBKIT_ADD_TARGET_CXX_FLAGS(WebCore -fno-tree-sra)
    40244024endif ()
    40254025
     
    40424042if (ENABLE_GRAPHICS_CONTEXT_3D AND NOT WIN32)
    40434043    add_library(ANGLESupport STATIC ${ANGLESupport_SOURCES})
    4044 
    4045     # Suppress null conversion warnings for sources in Source/ThirdParty/ANGLE
    4046     if (COMPILER_IS_CLANG)
    4047         WEBKIT_ADD_TARGET_PROPERTIES(ANGLESupport COMPILE_FLAGS "-Wno-null-conversion")
    4048     endif ()
    40494044
    40504045    # Enable the ESSL and GLSL translators.
     
    40634058    )
    40644059    list(APPEND WebCore_LIBRARIES ANGLESupport)
    4065     WEBKIT_SET_EXTRA_COMPILER_FLAGS(ANGLESupport IGNORECXX_WARNINGS)
     4060
     4061    if (COMPILER_IS_GCC_OR_CLANG)
     4062        WEBKIT_ADD_TARGET_CXX_FLAGS(ANGLESupport -Wno-implicit-fallthrough
     4063                                                 -Wno-null-conversion
     4064                                                 -Wno-suggest-attribute=format
     4065                                                 -Wno-unused-function
     4066                                                 -Wno-unused-parameter)
     4067    endif ()
    40664068endif ()
    40674069
  • trunk/Source/WebCore/ChangeLog

    r220402 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * CMakeLists.txt:
     9        * PlatformGTK.cmake:
     10        * PlatformWPE.cmake:
     11
    1122017-08-08  Zan Dobersek  <zdobersek@igalia.com>
    213
  • trunk/Source/WebCore/PlatformGTK.cmake

    r219676 r220403  
    273273    add_library(WebCorePlatformGTK2 ${WebCore_LIBRARY_TYPE} ${WebCorePlatformGTK_SOURCES})
    274274    add_dependencies(WebCorePlatformGTK2 WebCore)
    275     WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCorePlatformGTK2)
    276275    set_property(TARGET WebCorePlatformGTK2
    277276        APPEND
     
    304303add_library(WebCorePlatformGTK ${WebCore_LIBRARY_TYPE} ${WebCorePlatformGTK_SOURCES})
    305304add_dependencies(WebCorePlatformGTK WebCore)
    306 WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCorePlatformGTK)
    307305target_include_directories(WebCorePlatformGTK PRIVATE
    308306    ${WebCore_INCLUDE_DIRECTORIES}
  • trunk/Source/WebCore/PlatformWPE.cmake

    r220264 r220403  
    194194add_library(WebCorePlatformWPE ${WebCore_LIBRARY_TYPE} ${WebCorePlatformWPE_SOURCES})
    195195add_dependencies(WebCorePlatformWPE WebCore)
    196 WEBKIT_SET_EXTRA_COMPILER_FLAGS(WebCorePlatformWPE)
    197196target_include_directories(WebCorePlatformWPE PRIVATE
    198197    ${WebCore_INCLUDE_DIRECTORIES}
  • trunk/Source/WebDriver/ChangeLog

    r220394 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * WebDriverService.cpp:
     9        (WebDriver::WebDriverService::run):
     10        * glib/SessionHostGlib.cpp:
     11
    1122017-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
    213
  • trunk/Source/WebDriver/WebDriverService.cpp

    r220388 r220403  
    5454{
    5555    String portString;
    56     for (unsigned i = 1 ; i < argc; ++i) {
     56    for (int i = 1 ; i < argc; ++i) {
    5757        const char* arg = argv[i];
    5858        if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) {
  • trunk/Source/WebDriver/glib/SessionHostGlib.cpp

    r220329 r220403  
    6363const GDBusInterfaceVTable SessionHost::s_interfaceVTable = {
    6464    // method_call
    65     [](GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName, const gchar* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData) {
     65    [](GDBusConnection*, const gchar*, const gchar*, const gchar*, const gchar* methodName, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer userData) {
    6666        auto* sessionHost = static_cast<SessionHost*>(userData);
    6767        if (!g_strcmp0(methodName, "SetTargetList")) {
     
    9595    // set_property
    9696    nullptr,
     97    // padding
     98    nullptr
    9799};
    98100
  • trunk/Source/WebKit/CMakeLists.txt

    r220334 r220403  
    881881endif ()
    882882
    883 # Suppress unused parameter warnings for sources in WebKit2.
    884 if (COMPILER_IS_GCC_OR_CLANG)
    885     WEBKIT_ADD_TARGET_PROPERTIES(WebKit2 COMPILE_FLAGS "-Wno-unused-parameter")
    886 endif ()
    887 
    888883if (WebKit2_VERSION_SCRIPT)
    889884    WEBKIT_ADD_TARGET_PROPERTIES(WebKit2 LINK_FLAGS "${WebKit2_VERSION_SCRIPT}")
     
    912907    install(TARGETS StorageProcess DESTINATION "${LIBEXEC_INSTALL_DIR}")
    913908
     909    if (COMPILER_IS_GCC_OR_CLANG)
     910        WEBKIT_ADD_TARGET_CXX_FLAGS(StorageProcess -Wno-unused-parameter)
     911    endif ()
     912
    914913    if (WebKit2_StorageProcess_OUTPUT_NAME)
    915914        set_target_properties(StorageProcess PROPERTIES OUTPUT_NAME ${WebKit2_StorageProcess_OUTPUT_NAME})
    916915    endif ()
     916endif ()
     917
     918# Suppress unused parameter warnings for sources in WebKit2.
     919if (COMPILER_IS_GCC_OR_CLANG)
     920    WEBKIT_ADD_TARGET_CXX_FLAGS(WebKit2 -Wno-unused-parameter)
     921    WEBKIT_ADD_TARGET_CXX_FLAGS(WebProcess -Wno-unused-parameter)
     922    WEBKIT_ADD_TARGET_CXX_FLAGS(NetworkProcess -Wno-unused-parameter)
    917923endif ()
    918924
     
    924930    install(TARGETS PluginProcess DESTINATION "${LIBEXEC_INSTALL_DIR}")
    925931
     932    if (COMPILER_IS_GCC_OR_CLANG)
     933        WEBKIT_ADD_TARGET_CXX_FLAGS(PluginProcess -Wno-unused-parameter)
     934    endif ()
     935
    926936    if (WebKit2_PluginProcess_OUTPUT_NAME)
    927937      set_target_properties(PluginProcess PROPERTIES OUTPUT_NAME ${WebKit2_PluginProcess_OUTPUT_NAME})
  • trunk/Source/WebKit/ChangeLog

    r220394 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * CMakeLists.txt:
     9        * PlatformGTK.cmake:
     10
    1112017-08-07  Carlos Garcia Campos  <cgarcia@igalia.com>
    212
  • trunk/Source/WebKit/PlatformGTK.cmake

    r220387 r220403  
    10671067
    10681068    install(TARGETS WebKitPluginProcess2 DESTINATION "${LIBEXEC_INSTALL_DIR}")
     1069
     1070    if (COMPILER_IS_GCC_OR_CLANG)
     1071        WEBKIT_ADD_TARGET_CXX_FLAGS(WebKitPluginProcess2 -Wno-unused-parameter)
     1072    endif ()
    10691073endif () # ENABLE_PLUGIN_PROCESS_GTK2
    10701074
     
    10901094add_webkit2_prefix_header(webkit2gtkinjectedbundle)
    10911095target_link_libraries(webkit2gtkinjectedbundle WebKit2)
     1096
     1097if (COMPILER_IS_GCC_OR_CLANG)
     1098    WEBKIT_ADD_TARGET_CXX_FLAGS(webkit2gtkinjectedbundle -Wno-unused-parameter)
     1099endif ()
    10921100
    10931101# Add ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} to LD_LIBRARY_PATH or DYLD_LIBRARY_PATH
  • trunk/Source/cmake/OptionsCommon.cmake

    r219580 r220403  
    11add_definitions(-DBUILDING_WITH_CMAKE=1)
    22add_definitions(-DHAVE_CONFIG_H=1)
    3 
    4 # CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS only matters with GCC >= 4.7.0.  Since this
    5 # version, -P does not output empty lines, which currently breaks make_names.pl in
    6 # WebCore. Investigating whether make_names.pl should be changed instead is left as an exercise to
    7 # the reader.
    8 if (MSVC)
    9     set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "/nologo /EP /TP")
    10     set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS})
    11 else ()
    12     set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "-E -P -x c++")
    13     set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS "-E -x c++")
    14 endif ()
    15 
    16 set(CODE_GENERATOR_PREPROCESSOR "\"${CMAKE_CXX_COMPILER}\" ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
    17 set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "\"${CMAKE_CXX_COMPILER}\" ${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS}")
    183
    194option(USE_THIN_ARCHIVES "Produce all static libraries as thin archives" ON)
     
    3015set_property(GLOBAL PROPERTY USE_FOLDERS ON)
    3116define_property(TARGET PROPERTY FOLDER INHERITED BRIEF_DOCS "folder" FULL_DOCS "IDE folder name")
    32 
    33 if (CMAKE_GENERATOR STREQUAL "Ninja")
    34     if (COMPILER_IS_CLANG)
    35         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
    36         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
    37     else ()
    38         if (CMAKE_COMPILER_IS_GNUCC)
    39             set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
    40         endif ()
    41         if (CMAKE_COMPILER_IS_GNUCXX)
    42             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
    43         endif ()
    44     endif ()
    45 endif ()
    46 
    47 # FIXME: Some warning flags should probably be set in WEBKIT_SET_EXTRA_COMPILER_FLAGS instead.
    48 # But language-specific warnings probably cannot be moved there.
    49 if (COMPILER_IS_GCC_OR_CLANG)
    50     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
    51     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
    52 
    53     if (COMPILER_IS_CLANG_CL)
    54         # clang-cl.exe impersonates cl.exe so some clang arguments like -fno-rtti are
    55         # represented using cl.exe's options and should not be passed as flags, so
    56         # we do not add -fno-rtti or -fno-exceptions for clang-cl
    57 
    58         # FIXME: These warnings should be addressed
    59         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-undef -Wno-macro-redefined -Wno-unknown-pragmas -Wno-nonportable-include-path -Wno-unknown-argument")
    60         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-undef -Wno-macro-redefined -Wno-unknown-pragmas -Wno-nonportable-include-path -Wno-unknown-argument")
    61     else ()
    62         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions")
    63         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -fno-exceptions -fno-rtti")
    64 
    65         if (WIN32)
    66             set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields -Wno-unknown-pragmas")
    67             add_definitions(-D{CMAKE_CXX_FLAGS} -mno-ms-bitfields -Wno-unknown-pragmas)
    68             add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
    69         endif ()
    70     endif ()
    71 
    72     if (NOT (COMPILER_IS_CLANG AND "${CLANG_VERSION}" VERSION_LESS 4.0.0))
    73         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-expansion-to-defined")
    74         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-expansion-to-defined")
    75     endif ()
    76 
    77     if (CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER "7.0")
    78         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type")
    79     endif ()
    80 endif ()
    81 
    82 # Ensure that the default include system directories are added to the list of CMake implicit includes.
    83 # This workarounds an issue that happens when using GCC 6 and using system includes (-isystem).
    84 # For more details check: https://bugs.webkit.org/show_bug.cgi?id=161697
    85 macro(DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _compiler _flags _result)
    86     file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n")
    87     separate_arguments(_buildFlags UNIX_COMMAND "${_flags}")
    88     execute_process(COMMAND ${_compiler} ${_buildFlags} -v -E -x ${_lang} -dD dummy
    89                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles OUTPUT_QUIET
    90                     ERROR_VARIABLE _gccOutput)
    91     file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
    92     if ("${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list")
    93         set(${_result} ${CMAKE_MATCH_1})
    94         string(REPLACE "\n" " " ${_result} "${${_result}}")
    95         separate_arguments(${_result})
    96     endif ()
    97 endmacro()
    98 
    99 if (CMAKE_COMPILER_IS_GNUCC)
    100    DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c" "${CMAKE_C_COMPILER}" "${CMAKE_C_FLAGS}" SYSTEM_INCLUDE_DIRS)
    101    set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
    102 endif ()
    103 
    104 if (CMAKE_COMPILER_IS_GNUCXX)
    105    DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c++" "${CMAKE_CXX_COMPILER}" "${CMAKE_CXX_FLAGS}" SYSTEM_INCLUDE_DIRS)
    106    set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
    107 endif ()
    10817
    10918# Detect Cortex-A53 core if CPU is ARM64 and OS is Linux.
     
    12837        message(FATAL_ERROR "WTF_CPU_ARM64_CORTEXA53 set without WTF_CPU_ARM64")
    12938    endif ()
    130     CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-835769 CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
    131     if (CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
    132         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769")
    133         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-835769")
    134         message(STATUS "Enabling Cortex-A53 workaround for compiler and disabling GNU gold linker, because it doesn't support this workaround.")
    135     endif ()
     39    WEBKIT_PREPEND_GLOBAL_COMPILER_FLAG(-mfix-cortex-a53-835769)
    13640endif ()
    13741
     
    17276set(ENABLE_DEBUG_FISSION_DEFAULT OFF)
    17377if (USE_LD_GOLD AND CMAKE_BUILD_TYPE STREQUAL "Debug")
    174     CHECK_CXX_ACCEPTS_FLAG(-gsplit-dwarf CXX_ACCEPTS_GSPLIT_DWARF)
    175     if (CXX_ACCEPTS_GSPLIT_DWARF)
     78    check_cxx_compiler_flag(-gsplit-dwarf CXX_COMPILER_SUPPORTS_GSPLIT_DWARF)
     79    if (CXX_COMPILER_SUPPORTS_GSPLIT_DWARF)
    17680        set(ENABLE_DEBUG_FISSION_DEFAULT ON)
    17781    endif ()
     
    18892    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
    18993    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
    190 endif ()
    191 
    192 if (COMPILER_IS_CLANG)
    193     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
    194     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
    195 endif ()
    196 
    197 string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
    198 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "x86_64")
    199     # To avoid out of memory when building with debug option in 32bit system.
    200     # See https://bugs.webkit.org/show_bug.cgi?id=77327
    201     set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-Wl,--no-keep-memory ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
    202 endif ()
    203 
    204 if (NOT MSVC)
    205     string(REGEX MATCHALL "-fsanitize=[^ ]*" ENABLED_COMPILER_SANITIZERS ${CMAKE_CXX_FLAGS})
    206 endif ()
    207 
    208 if (UNIX AND NOT APPLE AND NOT ENABLED_COMPILER_SANITIZERS)
    209     set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
    21094endif ()
    21195
  • trunk/Source/cmake/WebKitCommon.cmake

    r220091 r220403  
    3838
    3939    # To prevent multiple inclusion, most modules should be included once here.
     40    include(CheckCCompilerFlag)
     41    include(CheckCXXCompilerFlag)
    4042    include(CheckCXXSourceCompiles)
    4143    include(CheckFunctionExists)
     
    4749    include(CMakeParseArguments)
    4850    include(ProcessorCount)
    49     include(TestCXXAcceptsFlag)
    5051
    5152    include(WebKitPackaging)
    5253    include(WebKitMacros)
    5354    include(WebKitFS)
     55    include(WebKitCompilerFlags)
    5456    include(WebKitFeatures)
    5557
  • trunk/Source/cmake/WebKitMacros.cmake

    r219580 r220403  
    177177endmacro()
    178178
    179 # Sets extra compile flags for a target, depending on the compiler being used.
    180 # Currently, only GCC is supported.
    181 macro(WEBKIT_SET_EXTRA_COMPILER_FLAGS _target)
    182     set(options ENABLE_WERROR IGNORECXX_WARNINGS)
    183     CMAKE_PARSE_ARGUMENTS("OPTION" "${options}" "" "" ${ARGN})
    184     if (COMPILER_IS_GCC_OR_CLANG)
    185         get_target_property(OLD_COMPILE_FLAGS ${_target} COMPILE_FLAGS)
    186         if (${OLD_COMPILE_FLAGS} STREQUAL "OLD_COMPILE_FLAGS-NOTFOUND")
    187             set(OLD_COMPILE_FLAGS "")
    188         endif ()
    189 
    190         if (NOT WIN32)
    191             get_target_property(TARGET_TYPE ${_target} TYPE)
    192             if (${TARGET_TYPE} STREQUAL "STATIC_LIBRARY") # -fPIC is automatically added to shared libraries
    193                 set(OLD_COMPILE_FLAGS "-fPIC ${OLD_COMPILE_FLAGS}")
    194             endif ()
    195         endif ()
    196 
    197         # Suppress -Wparentheses-equality warning of Clang
    198         if (COMPILER_IS_CLANG)
    199             set(OLD_COMPILE_FLAGS "-Wno-parentheses-equality ${OLD_COMPILE_FLAGS}")
    200         endif ()
    201 
    202         # Enable warnings by default
    203         if (NOT ${OPTION_IGNORECXX_WARNINGS})
    204             set(OLD_COMPILE_FLAGS "-Wall -Wextra -Wcast-align -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wundef -Wwrite-strings ${OLD_COMPILE_FLAGS}")
    205         endif ()
    206 
    207         # Enable errors on warning
    208         if (OPTION_ENABLE_WERROR)
    209             set(OLD_COMPILE_FLAGS "-Werror ${OLD_COMPILE_FLAGS}")
    210         endif ()
    211 
    212         set_target_properties(${_target} PROPERTIES
    213             COMPILE_FLAGS "${OLD_COMPILE_FLAGS}")
    214 
    215         unset(OLD_COMPILE_FLAGS)
    216     endif ()
    217 endmacro()
    218 
    219179# Append the given flag to the target property.
    220180# Builds on top of get_target_property() and set_target_properties()
  • trunk/Tools/ChangeLog

    r220393 r220403  
     12017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        [CMake] Properly test if compiler supports compiler flags
     4        https://bugs.webkit.org/show_bug.cgi?id=174490
     5
     6        Reviewed by Konstantin Tokarev.
     7
     8        * DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt:
     9        * MiniBrowser/gtk/CMakeLists.txt:
     10        * TestRunnerShared/Bindings/JSWrapper.cpp:
     11        (WTR::JSWrapper::initialize):
     12        * TestWebKitAPI/CMakeLists.txt:
     13        * TestWebKitAPI/PlatformGTK.cmake:
     14        * TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp:
     15        (TestWebKitAPI::CheckedArithmeticTester::run):
     16        * TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp:
     17        * TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp:
     18        * TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp:
     19        (formControlsAssociatedCallback):
     20        * TestWebKitAPI/glib/CMakeLists.txt:
     21        * TestWebKitAPI/glib/WebKitGLib/TestMain.h:
     22        (Test::getResourcesDir):
     23        * WebKitTestRunner/CMakeLists.txt:
     24        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
     25        (WTR::menuItemClickCallback):
     26        (WTR::staticConvertMenuItemToType):
     27        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     28        (WTR::TestRunner::setUseDashboardCompatibilityMode):
     29        * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp:
     30        (WTR::AccessibilityNotificationHandler::disconnectAccessibilityCallbacks):
     31        * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
     32        (WTR::AccessibilityUIElement::helpText const):
     33        (WTR::AccessibilityUIElement::attributedStringForRange):
     34        * WebKitTestRunner/gtk/EventSenderProxyGtk.cpp:
     35        (WTR::EventSenderProxy::updateTouchPoint):
     36        (WTR::EventSenderProxy::releaseTouchPoint):
     37
    1382017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
    239
  • trunk/Tools/DumpRenderTree/TestNetscapePlugIn/CMakeLists.txt

    r219578 r220403  
    5656target_link_libraries(TestNetscapePlugIn ${WebKitTestNetscapePlugIn_LIBRARIES})
    5757set_target_properties(TestNetscapePlugIn PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins)
    58 WEBKIT_SET_EXTRA_COMPILER_FLAGS(TestNetscapePlugIn)
    5958
    60 # Suppress unused parameter warnings for sources in WebKit2.
    61 WEBKIT_ADD_TARGET_PROPERTIES(TestNetscapePlugIn COMPILE_FLAGS "-Wno-unused-parameter")
     59WEBKIT_ADD_TARGET_CXX_FLAGS(TestNetscapePlugIn -Wno-unused-parameter)
  • trunk/Tools/MiniBrowser/gtk/CMakeLists.txt

    r209665 r220403  
    6262target_link_libraries(MiniBrowser ${MiniBrowser_LIBRARIES})
    6363
     64WEBKIT_ADD_TARGET_CXX_FLAGS(MiniBrowser -Wno-unused-parameter)
     65
    6466install(TARGETS MiniBrowser DESTINATION "${LIBEXEC_INSTALL_DIR}")
  • trunk/Tools/TestRunnerShared/Bindings/JSWrapper.cpp

    r204877 r220403  
    6262}
    6363
    64 void JSWrapper::initialize(JSContextRef ctx, JSObjectRef object)
     64void JSWrapper::initialize(JSContextRef, JSObjectRef object)
    6565{
    6666    JSWrappable* wrappable = unwrapObject(object);
  • trunk/Tools/TestWebKitAPI/CMakeLists.txt

    r220284 r220403  
    152152    target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
    153153    add_dependencies(TestWebKitAPIInjectedBundle WTF ${ForwardingHeadersForTestWebKitAPI_NAME})
     154
     155    if (COMPILER_IS_GCC_OR_CLANG)
     156        WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKitAPIInjectedBundle -Wno-dangling-else
     157                                                                -Wno-sign-compare
     158                                                                -Wno-undef
     159                                                                -Wno-unused-parameter)
     160    endif ()
    154161endif ()
    155162
     
    186193    RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}
    187194)
     195
     196if (COMPILER_IS_GCC_OR_CLANG)
     197    WEBKIT_ADD_TARGET_CXX_FLAGS(TestWTF -Wno-dangling-else
     198                                        -Wno-sign-compare
     199                                        -Wno-undef
     200                                        -Wno-unused-parameter)
     201endif ()
    188202
    189203if (ENABLE_WEBKIT)
     
    199213
    200214    add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
    201 endif ()
     215
     216    if (COMPILER_IS_GCC_OR_CLANG)
     217        WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKitAPIBase -Wno-sign-compare
     218                                                      -Wno-undef
     219                                                      -Wno-unused-parameter)
     220    endif ()
     221endif ()
  • trunk/Tools/TestWebKitAPI/PlatformGTK.cmake

    r219865 r220403  
    157157    ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/WorkQueueGLib.cpp
    158158)
     159
     160if (COMPILER_IS_GCC_OR_CLANG)
     161    WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKit2 -Wno-sign-compare
     162                                            -Wno-undef
     163                                            -Wno-unused-parameter)
     164
     165    WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebCore -Wno-sign-compare
     166                                            -Wno-undef
     167                                            -Wno-unused-parameter)
     168endif ()
  • trunk/Tools/TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp

    r188210 r220403  
    169169        Checked<type, OverflowCrashLogger> nvalue; // to hold a not overflowed value.
    170170        Checked<type, OverflowCrashLogger> ovalue; // to hold an overflowed value.
     171
     172#if COMPILER(GCC)
     173#pragma GCC diagnostic push
     174#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
     175#endif
    171176        bool unused;
     177#if COMPILER(GCC)
     178#pragma GCC diagnostic pop
     179#endif
    172180
    173181        _value = 75;
  • trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAutomationSession.cpp

    r220329 r220403  
    9797        // set_property
    9898        nullptr,
     99        // padding
     100        nullptr
    99101    };
    100102
  • trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebExtensions.cpp

    r218686 r220403  
    2424#include <wtf/glib/GRefPtr.h>
    2525
    26 static const char* webExtensionsUserData = "Web Extensions user data";
    2726static WebKitTestBus* bus;
    2827static GUniquePtr<char> scriptDialogResult;
  • trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/WebExtensionTest.cpp

    r220007 r220403  
    291291{
    292292    GString* formIdsBuilder = g_string_new(nullptr);
    293     for (int i = 0; i < formElements->len; ++i) {
     293    for (guint i = 0; i < formElements->len; ++i) {
    294294        g_assert(WEBKIT_DOM_IS_ELEMENT(g_ptr_array_index(formElements, i)));
    295295        auto domElement = WEBKIT_DOM_ELEMENT(g_ptr_array_index(formElements, i));
  • trunk/Tools/TestWebKitAPI/glib/CMakeLists.txt

    r218686 r220403  
    5252    )
    5353    target_link_libraries(${extension_name} ${WebKitGLibAPITestExtension_LIBRARIES})
     54
     55    if (COMPILER_IS_GCC_OR_CLANG)
     56        WEBKIT_ADD_TARGET_CXX_FLAGS(${extension_name} -Wno-unused-parameter)
     57    endif ()
    5458endmacro()
    5559
     
    6468    )
    6569    target_link_libraries(${test_name} ${WebKitGLibAPITest_LIBRARIES})
     70
     71    if (COMPILER_IS_GCC_OR_CLANG)
     72        WEBKIT_ADD_TARGET_CXX_FLAGS(${test_name} -Wno-unused-parameter)
     73    endif ()
    6674endmacro()
    6775
     
    8593add_library(WebKitGLibAPITestsCore STATIC ${WebKitGLibAPITests_SOURCES})
    8694target_link_libraries(WebKitGLibAPITestsCore WebKit2)
     95
     96if (COMPILER_IS_GCC_OR_CLANG)
     97    WEBKIT_ADD_TARGET_CXX_FLAGS(WebKitGLibAPITestsCore -Wno-unused-parameter)
     98endif ()
    8799
    88100add_custom_command(
  • trunk/Tools/TestWebKitAPI/glib/WebKitGLib/TestMain.h

    r218686 r220403  
    5757    static void setUp(ClassName* fixture, gconstpointer data) \
    5858    { \
    59         if (setup) \
    60             setup(); \
     59        setup(); \
    6160        new (fixture) ClassName; \
    6261    } \
     
    6463    { \
    6564        fixture->~ClassName(); \
    66         if (teardown) \
    67             teardown(); \
     65        teardown(); \
    6866    } \
    6967    static void add(const char* suiteName, const char* testName, void (*testFunc)(ClassName*, const void*)) \
     
    174172        }
    175173        }
     174        RELEASE_ASSERT_NOT_REACHED();
    176175    }
    177176
  • trunk/Tools/WebKitTestRunner/CMakeLists.txt

    r209665 r220403  
    117117add_dependencies(WebKitTestRunner WebKitTestRunnerBindings)
    118118
     119if (COMPILER_IS_GCC_OR_CLANG)
     120    WEBKIT_ADD_TARGET_CXX_FLAGS(TestRunnerInjectedBundle -Wno-unused-parameter)
     121    WEBKIT_ADD_TARGET_CXX_FLAGS(WebKitTestRunner -Wno-unused-parameter)
     122endif ()
     123
    119124if (NOT APPLE)
    120125    add_dependencies(WebKit2 ${ForwardingHeadersForWebKitTestRunner_NAME})
  • trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp

    r218106 r220403  
    5353
    5454#if ENABLE(CONTEXT_MENUS)
    55 static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     55static JSValueRef menuItemClickCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*)
    5656{
    5757    MenuItemPrivateData* privateData = static_cast<MenuItemPrivateData*>(JSObjectGetPrivate(thisObject));
     
    8282}
    8383
    84 static JSValueRef staticConvertMenuItemToType(JSContextRef context, JSObjectRef object, JSType type, JSValueRef* exception)
     84static JSValueRef staticConvertMenuItemToType(JSContextRef context, JSObjectRef object, JSType type, JSValueRef*)
    8585{
    8686    if (kJSTypeString == type)
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r220311 r220403  
    468468    auto& injectedBundle = InjectedBundle::singleton();
    469469    WKBundleSetUseDashboardCompatibilityMode(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
     470#else
     471    UNUSED_PARAM(enabled);
    470472#endif
    471473}
  • trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp

    r215985 r220403  
    113113        arguments[1] = notificationNameArgument;
    114114        size_t numOfExtraArgs = extraArgs.size();
    115         for (int i = 0; i < numOfExtraArgs; i++)
     115        for (size_t i = 0; i < numOfExtraArgs; i++)
    116116            arguments[i + 2] = extraArgs[i];
    117117        if (elementNotificationHandler != notificationHandlers.end()) {
     
    257257
    258258    // AtkObject signals.
    259     for (int i = 0; i < listenerIds.size(); i++) {
     259    for (size_t i = 0; i < listenerIds.size(); i++) {
    260260        ASSERT(listenerIds[i]);
    261261        atk_remove_global_event_listener(listenerIds[i]);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp

    r218809 r220403  
    14161416    builder.append("AXHelp: ");
    14171417
    1418     for (int targetCount = 0; targetCount < targetList->len; targetCount++) {
     1418    for (guint targetCount = 0; targetCount < targetList->len; targetCount++) {
    14191419        if (AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, targetCount))) {
    14201420            GUniquePtr<gchar> text(atk_text_get_text(ATK_TEXT(target), 0, -1));
     
    17571757    AtkText* text = ATK_TEXT(m_element.get());
    17581758    gint start = 0, end = 0;
    1759     for (int i = location; i < location + length; i = end) {
     1759    for (unsigned i = location; i < location + length; i = end) {
    17601760        AtkAttributeSet* attributeSet = atk_text_get_run_attributes(text, i, &start, &end);
    17611761        GUniquePtr<gchar> substring(replaceCharactersForResults(atk_text_get_text(text, start, end)));
  • trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp

    r218106 r220403  
    506506void EventSenderProxy::updateTouchPoint(int index, int x, int y)
    507507{
    508     ASSERT(index >= 0 && index < m_touchEvents.size());
     508    ASSERT(index >= 0 && static_cast<size_t>(index) < m_touchEvents.size());
    509509
    510510    const auto& event = m_touchEvents[index];
     
    552552void EventSenderProxy::releaseTouchPoint(int index)
    553553{
    554     ASSERT(index >= 0 && index < m_touchEvents.size());
     554    ASSERT(index >= 0 && static_cast<size_t>(index) < m_touchEvents.size());
    555555
    556556    const auto& event = m_touchEvents[index];
Note: See TracChangeset for help on using the changeset viewer.