Bug 150031 - [GTK] Fix MacCLang build errors in Tools
Summary: [GTK] Fix MacCLang build errors in Tools
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords:
Depends on:
Blocks: 126492
  Show dependency treegraph
 
Reported: 2015-10-12 09:31 PDT by Philippe Normand
Modified: 2015-10-30 01:33 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.72 KB, patch)
2015-10-12 09:38 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (2.87 KB, patch)
2015-10-22 08:29 PDT, Philippe Normand
cgarcia: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 2015-10-12 09:31:27 PDT
.
Comment 1 Philippe Normand 2015-10-12 09:38:13 PDT
Created attachment 262892 [details]
Patch
Comment 2 Carlos Garcia Campos 2015-10-13 00:55:52 PDT
Comment on attachment 262892 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=262892&action=review

I don't understand why the casts are needed.

> Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:64
> +    gtk_widget_destroy(GTK_WIDGET(m_window));

isn't m_window a GtkWidget* already? 

typedef GtkWidget *PlatformWindow;

> Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:70
> +    m_window = reinterpret_cast<PlatformWindow>(gtk_window_new(GTK_WINDOW_TOPLEVEL));
> +    m_view = reinterpret_cast<PlatformWKView>(WKViewCreate(configuration));

I don't understand why we need the casts, gtk_window_new() returns a GtkWidget* and WKViewCreate a WKViewRef
Comment 3 Philippe Normand 2015-10-13 00:58:03 PDT
CLang errors out without the casts... I'll post the error messages here.
Comment 4 Philippe Normand 2015-10-21 09:05:41 PDT
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:62:5: error: no matching function for call to 'gtk_widget_destroy'
    gtk_widget_destroy(m_window);
    ^~~~~~~~~~~~~~~~~~
../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:639:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *')
void gtk_widget_destroy (GtkWidget *widget);
     ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:67:14: error: assigning to 'PlatformWindow' (aka 'NSWindow *') from incompatible type 'GtkWidget *' (aka '_GtkWidget *')
    m_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:68:14: error: use of undeclared identifier 'WKViewCreate'; did you mean 'WKSizeCreate'?
    m_view = WKViewCreate(configuration);
             ^~~~~~~~~~~~
             WKSizeCreate
../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:50: note: 'WKSizeCreate' declared here
__attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size);
                                                 ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:68:27: error: no viable conversion from 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize'
    m_view = WKViewCreate(configuration);
                          ^~~~~~~~~~~~~
../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'const WKSize &'
struct WKSize {
       ^
../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit move constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize &&'
struct WKSize {
       ^
../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:70: note: passing argument to parameter 'size' here
__attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size);
                                                                     ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:71:5: error: no matching function for call to 'gtk_widget_show'
    gtk_widget_show(m_window);
    ^~~~~~~~~~~~~~~
../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *')
void gtk_widget_show (GtkWidget *widget);
     ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:76:12: error: use of undeclared identifier 'WKViewGetPage'
    return WKViewGetPage(m_view);
           ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:109:9: error: no matching function for call to 'gtk_widget_show'
        gtk_widget_show(m_window);
        ^~~~~~~~~~~~~~~
../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *')
void gtk_widget_show (GtkWidget *widget);
     ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:117:9: error: no matching function for call to 'gtk_widget_show'
        gtk_widget_show(m_window);
        ^~~~~~~~~~~~~~~
../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *')
void gtk_widget_show (GtkWidget *widget);
     ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:145:9: error: no matching function for call to 'gtk_widget_show'
        gtk_widget_show(m_window);
        ^~~~~~~~~~~~~~~
../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *')
void gtk_widget_show (GtkWidget *widget);
     ^
../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:161:9: error: no matching function for call to 'gtk_widget_show'
        gtk_widget_show(m_window);
        ^~~~~~~~~~~~~~~
../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:646:6: note: candidate function not viable: cannot convert argument of incomplete type 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *')
void gtk_widget_show (GtkWidget *widget);
     ^
10 errors generated.
[4446/4564] Building CXX object Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o
FAILED: /usr/local/opt/ccache/libexec/c++   -DBUILDING_GTK__=1 -DBUILDING_WITH_CMAKE=1 -DDATA_DIR=\"share\" -DFONTS_CONF_DIR=\"/Users/philn/dev/WebKit/Tools/WebKitTestRunner/gtk/fonts\" -DGETTEXT_PACKAGE=\"WebKit2GTK-4.0\" -DHAVE_CONFIG_H=1 -DTOP_LEVEL_DIR=\"/Users/philn/dev/WebKit\" -DUSER_AGENT_GTK_MAJOR_VERSION=602 -DUSER_AGENT_GTK_MINOR_VERSION=1 -DWEBKITGTK_API_VERSION_STRING=\"4.0\" -std=c++11 -fcolor-diagnostics -Qunused-arguments -O3 -DNDEBUG -fno-exceptions -fno-strict-aliasing -fno-rtti -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I../../Tools/WebKitTestRunner -I../../Tools/WebKitTestRunner/InjectedBundle -I../../Tools/WebKitTestRunner/InjectedBundle/Bindings -I../../Tools/WebKitTestRunner/InjectedBundle/atk -I../../Tools/WebKitTestRunner/UIScriptContext -I../../Tools/WebKitTestRunner/UIScriptContext/Bindings -I../../Source/JavaScriptCore -I../../Source/JavaScriptCore/ForwardingHeaders -IDerivedSources/JavaScriptCore -I../../Source/WebCore/editing -I../../Source/WebCore/platform -I../../Source/WebCore/platform/graphics -I../../Source/WebCore/platform/graphics/harfbuzz -I../../Source/WebCore/platform/graphics/harfbuzz/ng -I../../Source/WebCore/platform/network -I../../Source/WebCore/platform/text -I../../Source/WebCore/testing/js -I../../Source/WebKit2/Platform/IPC -I../../Source/WebKit2/Shared -I../../Source/WebKit2/Shared/API/c -I../../Source/WebKit2/Shared/Plugins -I../../Source/WebKit2/UIProcess -I../../Source/WebKit2/UIProcess/API/C/soup -I../../Source/WebKit2/WebProcess/InjectedBundle -I../../Source/WebKit2/WebProcess/InjectedBundle/API/c -I../../Source/WTF -IDerivedSources/InjectedBundle -IDerivedSources/UIScriptContext -I. -I../../Source -IDerivedSources/ForwardingHeaders -I../../Source/WTF/wtf/glib -isystem ../DependenciesGTK/Root/include/libsoup-2.4 -isystem ../DependenciesGTK/Root/include/atk-1.0 -isystem ../DependenciesGTK/Root/include/cairo -isystem ../DependenciesGTK/Root/include/gtk-3.0 -isystem ../DependenciesGTK/Root/include/gio-unix-2.0 -isystem ../DependenciesGTK/Root/include/pango-1.0 -isystem ../DependenciesGTK/Root/include/pixman-1 -isystem ../DependenciesGTK/Root/include/freetype2 -isystem ../DependenciesGTK/Root/include/libxml2 -isystem ../DependenciesGTK/Root/include/gdk-pixbuf-2.0 -isystem ../DependenciesGTK/Root/include/glib-2.0 -isystem ../DependenciesGTK/Root/lib/glib-2.0/include -isystem /usr/local/Cellar/libepoxy/1.3.1/include -isystem /usr/local/Cellar/libpng/1.6.18/include/libpng16 -MMD -MT Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o -MF Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o.d -o Tools/WebKitTestRunner/CMakeFiles/WebKitTestRunner.dir/gtk/PlatformWebViewGtk.cpp.o -c ../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:40:14: error: use of undeclared identifier 'WKViewCreate'; did you mean 'WKSizeCreate'?
    : m_view(WKViewCreate(configuration))
             ^~~~~~~~~~~~
             WKSizeCreate
../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:50: note: 'WKSizeCreate' declared here
__attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size);
                                                 ^
../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:40:27: error: no viable conversion from 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize'
    : m_view(WKViewCreate(configuration))
                          ^~~~~~~~~~~~~
../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit copy constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'const WKSize &'
struct WKSize {
       ^
../../Source/WebKit2/Shared/API/c/WKGeometry.h:49:8: note: candidate constructor (the implicit move constructor) not viable: cannot convert argument of incomplete type 'WKPageConfigurationRef' (aka 'const OpaqueWKPageConfiguration *') to 'WKSize &&'
struct WKSize {
       ^
../../Source/WebKit2/Shared/API/c/WKGeometry.h:84:70: note: passing argument to parameter 'size' here
__attribute__((visibility("default"))) WKSizeRef WKSizeCreate(WKSize size);
                                                                     ^
../../Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:76:12: error: use of undeclared identifier 'WKViewGetPage'
    return WKViewGetPage(m_view);
           ^
3 errors generated.
Comment 5 Philippe Normand 2015-10-21 09:06:55 PDT
There is something fishy here. I'll rework this patch.
Comment 6 Carlos Garcia Campos 2015-10-22 00:01:40 PDT
(In reply to comment #4)
> ../../Tools/TestWebKitAPI/gtk/PlatformWebViewGtk.cpp:62:5: error: no
> matching function for call to 'gtk_widget_destroy'
>     gtk_widget_destroy(m_window);
>     ^~~~~~~~~~~~~~~~~~
> ../DependenciesGTK/Root/include/gtk-3.0/gtk/gtkwidget.h:639:6: note:
> candidate function not viable: cannot convert argument of incomplete type
> 'PlatformWindow' (aka 'NSWindow *') to 'GtkWidget *' (aka '_GtkWidget *')
> void gtk_widget_destroy (GtkWidget *widget);
>      ^

So, this is the actual problem, PlatformWindow is NSWindow and not GtkWidget as expected. A cast would fix the build, but will not work at runtime.
Comment 7 Philippe Normand 2015-10-22 08:29:22 PDT
Created attachment 263826 [details]
Patch
Comment 8 Michael Catanzaro 2015-10-25 16:48:11 PDT
That looks better, though I wonder why you needed to use BUILDING_GTK_ instead of PLATFORM(GTK)?
Comment 9 Philippe Normand 2015-10-26 00:49:17 PDT
(In reply to comment #8)
> That looks better, though I wonder why you needed to use BUILDING_GTK_
> instead of PLATFORM(GTK)?

It is used below in the same file. I can replace all occurrences with PLATFORM(GTK) if needed...
Comment 10 Philippe Normand 2015-10-30 01:33:36 PDT
Committed r191783: <http://trac.webkit.org/changeset/191783>