WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
130174
[GTK] Fix unused parameter warnings in the GObject WebKitDOM bindings
https://bugs.webkit.org/show_bug.cgi?id=130174
Summary
[GTK] Fix unused parameter warnings in the GObject WebKitDOM bindings
Martin Robinson
Reported
2014-03-12 20:27:44 PDT
These warnings are prevalent when building with CMake.
Attachments
Patch
(41.59 KB, patch)
2014-03-12 20:30 PDT
,
Martin Robinson
dbates
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Martin Robinson
Comment 1
2014-03-12 20:30:52 PDT
Created
attachment 226572
[details]
Patch
Daniel Bates
Comment 2
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.
Carlos Garcia Campos
Comment 3
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.
Martin Robinson
Comment 4
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.
Carlos Garcia Campos
Comment 5
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 :-)
Martin Robinson
Comment 6
2014-03-14 08:32:12 PDT
Committed
r165618
: <
http://trac.webkit.org/changeset/165618
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug