Bug 18346

Summary: [GTK] Remove build warnings
Product: WebKit Reporter: Luca Bruno <lethalman88>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Trivial CC: alp, gustavo
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
removing some build warnings to make the build prettier
alp: review-
reworked patch alp: review+

Description Luca Bruno 2008-04-07 11:24:24 PDT
A list of warnings from the gtk trunk buildbot:

WebKit/gtk/webkit/webkitwebview.cpp:1134: warning: passing 'double' for argument 1 to 'void WebCore::Settings::setDefaultFontSize(int)'
WebKit/gtk/webkit/webkitwebview.cpp:1135: warning: passing 'double' for argument 1 to 'void WebCore::Settings::setDefaultFixedFontSize(int)'
WebKit/gtk/webkit/webkitwebview.cpp:1136: warning: passing 'double' for argument 1 to 'void WebCore::Settings::setMinimumFontSize(int)'
WebKit/gtk/webkit/webkitwebview.cpp:1137: warning: passing 'double' for argument 1 to 'void WebCore::Settings::setMinimumLogicalFontSize(int)'
WebCore/platform/gtk/RenderThemeGtk.cpp:165: warning: converting to 'gint' from 'double'
WebCore/platform/gtk/RenderThemeGtk.cpp:166: warning: converting to 'gint' from 'double'
WebCore/platform/gtk/RenderThemeGtk.cpp:167: warning: passing 'double' for argument 1 to 'WebCore::IntPoint::IntPoint(int, int)'
WebCore/platform/gtk/RenderThemeGtk.cpp:167: warning: passing 'double' for argument 2 to 'WebCore::IntPoint::IntPoint(int, int)'
WebCore/platform/gtk/ScrollViewGtk.cpp:523: warning: passing 'float' for argument 1 to 'void WebCore::ScrollView::scrollBy(int, int)'
WebCore/platform/gtk/ScrollViewGtk.cpp:523: warning: passing 'float' for argument 2 to 'void WebCore::ScrollView::scrollBy(int, int)'
WebCore/platform/gtk/gtk2drawing.c:1613: warning: unused variable 'shadow_type'
WebCore/platform/gtk/gtk2drawing.c:1828: warning: passing argument 7 of 'gtk_paint_extension' discards qualifiers from pointer target type
WebCore/platform/gtk/gtk2drawing.c:1894: warning: passing argument 7 of 'gtk_paint_extension' discards qualifiers from pointer target type
WebCore/platform/gtk/gtk2drawing.c:1910: warning: passing argument 7 of 'gtk_paint_box_gap' discards qualifiers from pointer target type
WebCore/platform/gtk/gtk2drawing.c:1919: warning: passing argument 7 of 'gtk_paint_extension' discards qualifiers from pointer target type
WebCore/platform/gtk/gtk2drawing.c:1935: warning: passing argument 7 of 'gtk_paint_box_gap' discards qualifiers from pointer target type
WebCore/platform/gtk/gtk2drawing.c:1962: warning: passing argument 7 of 'gtk_paint_box_gap' discards qualifiers from pointer target type
WebCore/platform/gtk/gtk2drawing.c:1972: warning: unused variable 'shadow_type'
WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp:884: warning: passing 'double' for argument 1 to 'WebCore::IntPoint::IntPoint(int, int)'
WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp:884: warning: passing 'double' for argument 2 to 'WebCore::IntPoint::IntPoint(int, int)'
WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp:98: warning: comparison between signed and unsigned integer expressions
WebCore/plugins/gtk/PluginDatabaseGtk.cpp:50: warning: missing sentinel in function call
WebCore/plugins/gtk/PluginDatabaseGtk.cpp:61: warning: unused variable 'directory'
WebCore/platform/network/curl/ResourceHandleCurl.cpp:81: warning: 'WTF::HashSet<WebCore::String, WebCore::StringHash, WTF::HashTraits<WebCore::String> >& WebCore::allowsAnyHTTPSCertificateHosts()' defined but not used
WebCore/platform/network/curl/ResourceHandleManager.cpp:322: warning: unused variable 'err'
Comment 1 Luca Ferretti 2008-06-02 01:22:23 PDT
Also add warnings in bug #19353 and #19354
Comment 2 Luca Ferretti 2008-06-02 01:23:24 PDT
New warning in gtkk2drawing.c

WebCore/platform/gtk/gtk2drawing.c: In function &#8216;moz_gtk_toolbar_paint&#8217;:
WebCore/platform/gtk/gtk2drawing.c:1613: warning: unused variable &#8216;shadow_type&#8217;
WebCore/platform/gtk/gtk2drawing.c: In function &#8216;moz_gtk_menu_bar_paint&#8217;:
WebCore/platform/gtk/gtk2drawing.c:1972: warning: unused variable &#8216;shadow_type&#8217;
Comment 3 Luca Ferretti 2008-06-02 01:25:58 PDT
Warnings from PNGImageDecoder.cpp

Decoder.cpp' || echo './'`WebCore/platform/image-decoders/png/PNGImageDecoder.cpp
WebCore/platform/image-decoders/png/PNGImageDecoder.cpp: In member function &#8216;void WebCore::PNGImageDecoder::headerAvailable()&#8217;:
WebCore/platform/image-decoders/png/PNGImageDecoder.cpp:235: warning: comparison between signed and unsigned integer expressions
WebCore/platform/image-decoders/png/PNGImageDecoder.cpp:235: warning: comparison between signed and unsigned integer expressions
Comment 4 Luca Ferretti 2008-06-02 01:27:01 PDT
Warning in SimpleFontDataGtk.cpp

WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp: In member function &#8216;virtual bool WebCore::SimpleFontData::containsCharacters(const UChar*, int) const&#8217;:
WebCore/platform/graphics/gtk/SimpleFontDataGtk.cpp:98: warning: comparison between signed and unsigned integer expressions
Comment 5 Luca Ferretti 2008-06-02 01:28:02 PDT
Warnings in VideoSinkGstreamer.cpp

WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp:43: warning: deprecated conversion from string constant to &#8216;gchar*&#8217;
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp:43: warning: deprecated conversion from string constant to &#8216;gchar*&#8217;
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp:43: warning: deprecated conversion from string constant to &#8216;gchar*&#8217;
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp:43: warning: deprecated conversion from string constant to &#8216;gchar*&#8217;
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp: In function &#8216;gboolean webkit_video_sink_set_caps(GstBaseSink*, GstCaps*)&#8217;:
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp:184: warning: comparison between signed and unsigned integer expressions
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp: In function &#8216;void webkit_video_sink_finalize(GObject*)&#8217;:
WebCore/platform/graphics/gtk/VideoSinkGStreamer.cpp:211: warning: unused variable &#8216;sink&#8217;
Comment 6 Gustavo Noronha (kov) 2008-09-05 15:19:42 PDT
I'm not sure this bug report helps a lot; some of these build warnings are history now. Still, I was going to open a bug report to post my patch that does remove some warnings, and thought I'd use this one.
Comment 7 Gustavo Noronha (kov) 2008-09-05 15:24:14 PDT
Created attachment 23204 [details]
removing some build warnings to make the build prettier

some work in cleaning build warnings for GTK+-related stuff
Comment 8 Alp Toker 2008-09-05 19:19:07 PDT
Comment on attachment 23204 [details]
removing some build warnings to make the build prettier

>--- a/WebCore/page/gtk/AccessibilityObjectWrapperAtk.cpp
>+++ b/WebCore/page/gtk/AccessibilityObjectWrapperAtk.cpp
>@@ -143,7 +143,7 @@ static AtkObject* webkit_accessible_ref_child(AtkObject* object, gint index)
>     AccessibilityObject* coreObject = core(object);
> 
>     g_return_val_if_fail(index >= 0, NULL);
>-    g_return_val_if_fail(index < coreObject->children().size(), NULL);
>+    g_return_val_if_fail(((size_t)index) < coreObject->children().size(), NULL);
> 
>     AccessibilityObject* coreChild = coreObject->children().at(index).get();
> 

This cast can just be "(size_t)index" without the extra parentheses (or a C++-style cast, even better).

>diff --git a/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp b/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp
>index 37bb734..2832074 100644
>--- a/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp
>+++ b/WebCore/platform/graphics/gtk/SimpleFontDataPango.cpp
>@@ -103,7 +103,7 @@ bool SimpleFontData::containsCharacters(const UChar* characters, int length) con
>     PangoCoverage* available = pango_font_get_coverage(m_font.m_font, pango_language_get_default());
>     pango_coverage_max(requested, available);
> 
>-    for (unsigned i = 0; i < length; i++) {
>+    for (unsigned i = 0; i < (unsigned)length; i++) {
>         if (PANGO_COVERAGE_NONE == pango_coverage_get(requested, i)) {
>             result = false;
>             break;

This can just be for (int i = 0; i < length; i++) since length is an int.

>diff --git a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
>index 8888f2b..00b3057 100644
>--- a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
>+++ b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
>@@ -86,7 +86,7 @@ static const GtkUnicodeMenuEntry bidi_menu_entries[] = {
> 
> static void insertControlCharacter(GtkWidget* widget)
> {
>-    GtkUnicodeMenuEntry* entry = (GtkUnicodeMenuEntry*)g_object_get_data(G_OBJECT(widget), "gtk-unicode-menu-entry");
>+    // GtkUnicodeMenuEntry* entry = (GtkUnicodeMenuEntry*)g_object_get_data(G_OBJECT(widget), "gtk-unicode-menu-entry");
>     notImplemented();
> }
> 

Normally we try to avoid commented-out code but in this case it's the only hint as to what's going on and what the author intended, so I'm OK with your change here to fix the warning.

Looks good to land after suggested changes.
Comment 9 Gustavo Noronha (kov) 2008-09-05 20:13:28 PDT
(In reply to comment #8)
> >diff --git a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
> >index 8888f2b..00b3057 100644
> >--- a/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
> >+++ b/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp
> >@@ -86,7 +86,7 @@ static const GtkUnicodeMenuEntry bidi_menu_entries[] = {
> > 
> > static void insertControlCharacter(GtkWidget* widget)
> > {
> >-    GtkUnicodeMenuEntry* entry = (GtkUnicodeMenuEntry*)g_object_get_data(G_OBJECT(widget), "gtk-unicode-menu-entry");
> >+    // GtkUnicodeMenuEntry* entry = (GtkUnicodeMenuEntry*)g_object_get_data(G_OBJECT(widget), "gtk-unicode-menu-entry");
> >     notImplemented();
> > }
> > 
> 
> Normally we try to avoid commented-out code but in this case it's the only hint
> as to what's going on and what the author intended, so I'm OK with your change
> here to fix the warning.

Yeah, that's why I decided to leave it. I also left some static functions which are generating warnings untouched, as they will probably still be called when the missing implementation comes into place.

> Looks good to land after suggested changes.

Just building webkit again to test that they are correct and will upload a new patch. Thanks for the quick review!
Comment 10 Gustavo Noronha (kov) 2008-09-05 20:27:55 PDT
Created attachment 23210 [details]
reworked patch
Comment 11 Alp Toker 2008-09-05 21:00:41 PDT
Comment on attachment 23210 [details]
reworked patch

Thanks for the cleanup.
Comment 12 Alp Toker 2008-09-05 21:11:59 PDT
Landed in r36123. I'd rather look closely at the double/int cast warnings than simply silencing them, so going ahead and closing this bug to clear pending-commit.