Bug 130174 - [GTK] Fix unused parameter warnings in the GObject WebKitDOM bindings
Summary: [GTK] Fix unused parameter warnings in the GObject WebKitDOM bindings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Martin Robinson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-12 20:27 PDT by Martin Robinson
Modified: 2014-03-14 08:32 PDT (History)
3 users (show)

See Also:


Attachments
Patch (41.59 KB, patch)
2014-03-12 20:30 PDT, Martin Robinson
dbates: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Robinson 2014-03-12 20:27:44 PDT
These warnings are prevalent when building with CMake.
Comment 1 Martin Robinson 2014-03-12 20:30:52 PDT
Created attachment 226572 [details]
Patch
Comment 2 Daniel Bates 2014-03-12 22:19:44 PDT
Comment on attachment 226572 [details]
Patch

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

OK.

> Source/WebCore/bindings/gobject/WebKitDOMObject.cpp:28
> +    switch (propertyId) {
>      default:
> -        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
> +        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
>          break;
>      }

The switch statement is unnecessary as we always execute the code for the default case.

> Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm:661
> +        push(@txtGetProps, "#else\n") if $conditionalString;
> +        push(@txtGetProps, "    UNUSED_PARAM(value);\n") if $conditionalString;
> +        push(@txtGetProps, "${conditionGuardEnd}\n") if $conditionalString;

Unless you feel the duplication of the if conditional ("if $conditionalString") improves the readability of this code, I would write this as:

if ($conditionalString) {
    push(@txtGetProps, "#else\n");
    push(@txtGetProps, "    UNUSED_PARAM(value);\n");
    push(@txtGetProps, "${conditionGuardEnd}\n");
}

> Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm:674
> +            push(@txtSetProps, "#else\n") if $conditionalString;
> +            push(@txtSetProps, "    UNUSED_PARAM(value);\n") if $conditionalString;
> +            push(@txtSetProps, "${conditionGuardEnd}\n") if $conditionalString;

Similarly, I would write this as:

if ($conditionalString) {
    push(@txtSetProps, "#else\n");
    push(@txtSetProps, "    UNUSED_PARAM(value);\n");
    push(@txtSetProps, "${conditionGuardEnd}\n");
}

> Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm:797
> +        push(@cBodyProperties, "UNUSED_PARAM(request);\n");

Nit: We should indent "UNUSED_PARAM(request);".

> Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestNode.cpp:101
> +UNUSED_PARAM(request);

Nit: This line should be indented 4 spaces.
Comment 3 Carlos Garcia Campos 2014-03-13 01:05:05 PDT
Comment on attachment 226572 [details]
Patch

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

Thank you!

> Source/WebCore/bindings/gobject/DOMObjectCache.cpp:59
> -static void weakRefNotify(gpointer data, GObject* zombie)
> +static void weakRefNotify(gpointer data, GObject* /* zombie */)

I think e can simply avoid the parameter name in this case.

>> Source/WebCore/bindings/gobject/WebKitDOMObject.cpp:28
>>      }
> 
> The switch statement is unnecessary as we always execute the code for the default case.

The whole function is unnecessary :-) We can simply remove it and not give any imp for GObjectClass::get_property, since the only property this object has is not readable.
Comment 4 Martin Robinson 2014-03-13 07:37:33 PDT
Comment on attachment 226572 [details]
Patch

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

>>> Source/WebCore/bindings/gobject/WebKitDOMObject.cpp:28
>>>      }
>> 
>> The switch statement is unnecessary as we always execute the code for the default case.
> 
> The whole function is unnecessary :-) We can simply remove it and not give any imp for GObjectClass::get_property, since the only property this object has is not readable.

I hope you don't mind if I don't take the suggestion to remove the method entirely. I don't have time to rebuild and test right now, but I want to land this get it off my plate. The DOM bindings and code generator need *a lot* of cleanup, so we should definitely think about running through them again pre-3.0.
Comment 5 Carlos Garcia Campos 2014-03-13 07:49:46 PDT
(In reply to comment #4)
> (From update of attachment 226572 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=226572&action=review
> 
> >>> Source/WebCore/bindings/gobject/WebKitDOMObject.cpp:28
> >>>      }
> >> 
> >> The switch statement is unnecessary as we always execute the code for the default case.
> > 
> > The whole function is unnecessary :-) We can simply remove it and not give any imp for GObjectClass::get_property, since the only property this object has is not readable.
> 
> I hope you don't mind if I don't take the suggestion to remove the method entirely. I don't have time to rebuild and test right now, but I want to land this get it off my plate. The DOM bindings and code generator need *a lot* of cleanup, so we should definitely think about running through them again pre-3.0.

Sure, go ahead and fix the warnings :-)
Comment 6 Martin Robinson 2014-03-14 08:32:12 PDT
Committed r165618: <http://trac.webkit.org/changeset/165618>