The default bug view has changed. See this FAQ.

GCC 4.6 build warning: thread_helper.h:107:13: warning: ‘bool mozilla::tls::create(mozilla::tls::key*)’ defined but not used [-Wunused-function]

RESOLVED FIXED in mozilla12

Status

()

Core
General
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks: 1 bug)

Trunk
mozilla12
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
We get 15 instances of this build warning when building:

dist/include/thread_helper.h:107:13: warning: ‘bool mozilla::tls::create(mozilla::tls::key*)’ defined but not used [-Wunused-function]

This function is declared as "static", which makes it trigger this warning when it's defined but unused.

At least in some cases, this happens for .cpp files that #include sampler.h, which #includes sps_sampler.h, which #includes thread_helper.h (& thereby gets a static "create" impl) but never uses create().

According to the GCC documentation for this this warning, GCC only warns when _non-inline_ static methods go unused.  So, we should be able to silence this warning (and hint to the compiler to optimize away this method when it's unused) by labeling it "inline".
(Assignee)

Comment 1

5 years ago
Ah, looks like this was already fixed-when-checked-in in the "#if defined(XP_WIN)" chunk of this file:
> 84  static inline bool create(key* mykey) {
but not in the "#else" chunk:
> 107 static bool create(key* mykey) {
http://mxr.mozilla.org/mozilla-central/source/tools/profiler/sps/thread_helper.h?mark=84-84,107-107#84

Also -- as noted in the first comment on bug 714422, clang complains when "static inline" methods go unused, even if GCC doesn't.  So rather than making these methods "static inline", I think we want to *actually* just make them "inline".  I don't think we're getting any benefit from the "static" keyword right now here anyway, right?
(Assignee)

Comment 2

5 years ago
Created attachment 590091 [details] [diff] [review]
fix v1: s/static inline/inline/  & s/static/inline/
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #590091 - Flags: review?(ehsan)

Updated

5 years ago
Attachment #590091 - Flags: review?(ehsan) → review+
(Assignee)

Comment 3

5 years ago
Landed:
  https://hg.mozilla.org/integration/mozilla-inbound/rev/b7684cc4cb78
Target Milestone: --- → mozilla12
https://hg.mozilla.org/mozilla-central/rev/b7684cc4cb78
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.