gc/Root.h:523:35: error: variable ‘sink’ set but not used [-Werror=unused-but-set-variable]

RESOLVED WORKSFORME

Status

()

defect
RESOLVED WORKSFORME
7 years ago
7 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks 1 bug)

Trunk
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

New g++-4.7 build error today, in my --enable-warnings-as-errors build:
{
dist/include/gc/Root.h: In static member function ‘static void js::RootSink<JSStableString*>::dispose(JSStableString*)’:

dist/include/gc/Root.h:523:35: error: variable ‘sink’ set but not used [-Werror=unused-but-set-variable]
}

This warning's being treated as an error because /netwerk/base/src/ is FAIL_ON_WARNINGS, and various .cpp files there include IPCMessageUtils.h which includes jsapi.h which includes Root.h.  So, any build-warnings in Root.h trigger build-errors when building netwerk/base/src .cpp files.

The code in question is:
522     static void dispose(JSStableString *ptr) {
523         JSStableString * volatile sink;
524         sink = ptr;
525     }

I don't really understand what that code is trying to do, but we could easily silence the warning by adding "(void)sink;" at the end there, to "use" the variable as far as GCC is concerned.
Posted patch fixSplinter Review
Given that bug 787703 (which added this code) is a security bug, I'm going to just assume that this code is doing the right thing & that we just need to silence the warning.
Assignee: general → dholbert
Status: NEW → ASSIGNED
Attachment #675626 - Flags: review?(terrence)
Comment on attachment 675626 [details] [diff] [review]
fix

Stealing review. This is fine.
Attachment #675626 - Flags: review?(terrence) → review+
Thanks! Landed:
  https://hg.mozilla.org/mozilla-central/rev/792a91b91020
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Backed out together with the original patch:

https://hg.mozilla.org/integration/mozilla-inbound/rev/df94ebb4b929
Resolution: FIXED → WONTFIX
Resolution: WONTFIX → WORKSFORME
You need to log in before you can comment on or make changes to this bug.