Bug 7384

Summary: Turn off -Wno-unused-param for JavaScriptCore and get rid of unused params
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: JavaScriptCoreAssignee: Maciej Stachowiak <mjs>
Status: RESOLVED FIXED    
Severity: Normal CC: faure
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on:    
Bug Blocks: 7383    
Attachments:
Description Flags
turn on unused param warning, fix warnings darin: review+

Maciej Stachowiak
Reported 2006-02-20 06:44:18 PST
Turn off -Wno-unused-param for JavaScriptCore and get rid of unused params. We should to do this because KDE has the warning enabled and we don't want to make them spew warnings.
Attachments
turn on unused param warning, fix warnings (54.86 KB, patch)
2006-02-22 00:04 PST, Maciej Stachowiak
darin: review+
Maciej Stachowiak
Comment 1 2006-02-22 00:04:11 PST
Created attachment 6659 [details] turn on unused param warning, fix warnings
Darin Adler
Comment 2 2006-02-22 09:33:39 PST
Comment on attachment 6659 [details] turn on unused param warning, fix warnings What I don't like about this pattern: (void)other is that you can then subsequently use the "other" variable; so such a line doesn't mean that the variable is unused, it just means that someone quieted an unused variable warning at some point. I much prefer the technique of leaving out the parameter because it really *does* mean that the variable is unused. I see the (void) technique being used here, presumably in cases where the ifdef would be more complicated without it. I'd prefer not to use it at all. That having been said, the patch seems fine to land. We can revisit that later. r=me
Maciej Stachowiak
Comment 3 2006-02-22 22:06:35 PST
(In reply to comment #2) > (From update of attachment 6659 [details] [edit]) > What I don't like about this pattern: > > (void)other I don't like it either. I only used it when the parameter could not be removed, for one of the following reasons: - it was a plain C file so omitting parameters would be illegal (I think) - it was an ObjC method parameter, those can't be omitted - it was a parameter used in only one branch of an ifdef Do you have alternate recommendations for any of these cases? For ifdefs I could ifdef the whole function, for the other cases I don't think there is much I can do.
David Faure
Comment 4 2006-02-23 08:31:12 PST
Qt defines the Q_UNUSED macro for this (and ACE defines a similar ACE_UNUSED), so that from reading the source it's clear what the line is for. Yes it doesn't mean that the variable is actually unused (e.g. in all cases), but it simply means "it's ok if this variable is unused in this method". Of course if it's used that's ok too. But I prefer this rather than omitting argument names, since doing that obfuscates the code (in the worst case you could have a foo(int,int,int,int,int) method, e.g. as a virtual method reimplementation so you can't remove the unused args). So my suggestion would be to define a macro like KXML_UNUSED or WK_UNUSED.
Note You need to log in before you can comment on or make changes to this bug.