Closed Bug 1304305 Opened 8 years ago Closed 8 years ago

mozglue/misc/TimeStamp_posix.cpp:58:23: warning: unused variable 'kNsPerUs' [-Wunused-const-variable]

Categories

(Core :: mozglue, defect)

Unspecified
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1303212
Tracking Status
firefox52 --- affected

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Fix -Wunused-const-variable warning-as-error in mozglue/misc/TimeStamp_posix.cpp. 

For some reason, this warning wasn't a problem until I updated to Xcode 8 and macOS Sierra 10.12 today.
Attachment #8793221 - Flags: review?(mh+mozilla)
I noticed this too, and came looking to see if someone had already filed this bug. I looked into it a bit further, and I think a proper fix needs more than just ifdef'ing out the declaration of kNsPerUs in TimeStamp_posix.cpp.

The manpage says 10.12 introduced clock_gettime(3), which now makes us set HAVE_CLOCK_MONOTONIC when building there. Right now, TimeStamp_posix.cpp doesn't know anything about darwin, so with the proposed change, it looks like TimeStamp::ComputeProcessUptime will be a no-op on OS X (when it previously wasn't). We probably need to either make it so we don't set HAVE_CLOCK_MONOTONIC on 10.12, or fix TimeStamp_posix.cpp to be darwin-aware. Which one is right I suppose depends on if we can trust OS X 10.12's implementation of clock_gettime :)

Taking a look at TimeStamp_darwin.cpp, it looks like ComputeProcessUptime is pretty similar to the BSD versions in TimeStamp_posix.cpp (which makes sense). I can try to fix this a bit later today under the assumption we can trust 10.12's clock_gettime (I don't know how to check that).
Comment on attachment 8793221 [details] [diff] [review]
Wunused-const-variable_TimeStamp_posix.patch

Thanks, Nicholas. I'll take down my review request.
Attachment #8793221 - Flags: review?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #3)
> See bug 1303212

Looks like the fix for that (config-time check) might be the right path for this, too - there's way more in TimeStamp_posix.cpp that's darwin-unfriendly than I saw at first glance (lots of uses of /proc, which is notably absent on my mac). We're probably better off just always setting HAVE_CLOCK_MONOTONIC to false on OS X/macOS until we remove support for all versions prior to 10.12 (which I presume won't be for a while).
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: