Closed Bug 997026 Opened 10 years ago Closed 10 years ago

Fix clang -Wunused-const-variable warnings in xpcom

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31
Tracking Status
firefox30 --- wontfix
firefox31 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

(Whiteboard: [qa-])

Attachments

(2 files)

xpcom/glue/nsID.cpp:9:19 [-Wunused-const-variable] unused variable 'gIDFormat'                                                                        xpcom/glue/nsID.cpp:12:19 [-Wunused-const-variable] unused variable 'gIDFormat2'
xpcom/glue/nsVoidArray.cpp:20:22 [-Wunused-const-variable] unused variable 'kAutoClearCompactSizeFactor'

gIDFormat and gIDFormat2 are only used #ifndef XPCOM_GLUE_AVOID_NSPR:

https://hg.mozilla.org/mozilla-central/annotate/dd50745d7f35/xpcom/glue/nsID.cpp#l88
Attachment #8407338 - Flags: review?(nfroyd)
startupcache/StartupCache.cpp:89:22 [-Wunused-const-variable] unused variable 'kZipReaderCID'
Attachment #8407340 - Flags: review?(nfroyd)
Attachment #8407340 - Flags: review?(nfroyd) → review+
Comment on attachment 8407338 [details] [diff] [review]
fix_xpcom_Wunused-const-variable.patch

Review of attachment 8407338 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the changes below.

::: xpcom/glue/nsID.cpp
@@ +6,5 @@
>  #include "nsID.h"
>  #include "prprf.h"
>  #include "nsMemory.h"
>  
> +#ifndef XPCOM_GLUE_AVOID_NSPR

Can you just move this whole block down to the existing #ifndef block, please?  That will make it a whole lot easier to see what's going on.

gIDFormat2 appears to be unused regardless, can you delete that while you're at it?

@@ +12,1 @@
>  static const char gIDFormat[] = 

Please nuke the trailing whitespace here too.
Attachment #8407338 - Flags: review?(nfroyd) → review+
Landed with recommended changes:
* Moved gIDFormat definition
* Removed unused gIDFormat2
* Removed trailing whitespace

https://hg.mozilla.org/integration/mozilla-inbound/rev/1a3585a1b4a5
https://hg.mozilla.org/integration/mozilla-inbound/rev/2bfdbce8d055
https://hg.mozilla.org/mozilla-central/rev/1a3585a1b4a5
https://hg.mozilla.org/mozilla-central/rev/2bfdbce8d055
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Whiteboard: [qa-]
Depends on: 1054191
No longer depends on: 1054191
You need to log in before you can comment on or make changes to this bug.