Closed Bug 832554 Opened 7 years ago Closed 7 years ago

Fix android build warnings for -Wunused-function (e.g. gfxFontMissingGlyphs.cpp:148:1: warning: 'void DrawHexChar(gfxContext*, const gfxPoint&, uint32_t)' defined but not used)

Categories

(Core :: Graphics: Text, defect)

ARM
Android
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file, 1 obsolete file)

Build warning on Android:
{
gfx/thebes/gfxFontMissingGlyphs.cpp:148:1: warning: 'void DrawHexChar(gfxContext*, const gfxPoint&, uint32_t)' defined but not used [-Wunused-function]
}

This function is only used in an "#ifndef MOZ_GFX_OPTIMIZE_MOBILE" chunk, ever since this cset...
https://hg.mozilla.org/mozilla-central/rev/082875fdb725
...so we should make the function-definition #ifndef MOZ_GFX_OPTIMIZE_MOBILE as well.
Attached patch fix v1 (obsolete) — Splinter Review
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #704150 - Flags: review?(vladimir)
I found two more instances of this -- that is, two more static helper functions in the same directory that are currently defined unconditionally but aren't called if ANDROID or MOZ_GFX_OPTIMIZE_MOBILE are defined.

Bundling those into this bug, as well. The three warnings (including the one from comment 0) are:
{
../../../gfx/thebes/gfxFontMissingGlyphs.cpp:148:1: warning: 'void DrawHexChar(gfxContext*, const gfxPoint&, uint32_t)' defined but not used [-Wunused-function]

../../../gfx/thebes/gfxFT2Fonts.cpp:43:1: warning: 'PRLogModuleInfo* GetFontLog()' defined but not used [-Wunused-function]

../../../gfx/thebes/gfxUtils.cpp:216:1: warning: 'already_AddRefed<gfxDrawable> CreateSamplingRestrictedDrawable(gfxDrawable*, gfxContext*, const gfxMatrix&, const gfxRect&, const gfxRect&, gfxASurface::gfxImageFormat)' defined but not used [-Wunused-function]
}
Summary: Android build warning: gfxFontMissingGlyphs.cpp:148:1: warning: 'void DrawHexChar(gfxContext*, const gfxPoint&, uint32_t)' defined but not used [-Wunused-function] → Fix android build warnings for -Wunused-function (e.g. gfxFontMissingGlyphs.cpp:148:1: warning: 'void DrawHexChar(gfxContext*, const gfxPoint&, uint32_t)' defined but not used)
OS: Linux → Android
Hardware: x86_64 → ARM
Comment on attachment 704663 [details] [diff] [review]
fix v2

This is the kind of stuff I would rather just silence the compiler. It should be optimized out of the compilation unit at build time.

But I don't object to this change.
Attachment #704663 - Flags: review?(bgirard) → review+
(In reply to Benoit Girard (:BenWa) from comment #4)
> This is the kind of stuff I would rather just silence the compiler

Well -- in code without #ifdefs, this warning would be telling you "Here's a static function that's never called, anywhere. Either you meant to call it and forgot (BUG!), or it's dead code. (not a big problem, but worth cleaning up)"

That's a very useful thing for the compiler to tell you about.

(Unfortunately, since the compiler sees code after #ifdef-processing has happened, I'm not sure it can distinguish that situation from this situation where there are a bunch of platform-specific #ifdefs enabling/disabling various chunks of code.)
and: thanks for the quick review turnaround! :)
https://hg.mozilla.org/mozilla-central/rev/33e8b01d811a
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.