GCC 4.6 build warning: "nsJSEnvironment.cpp:2248:12: warning: variable 'flags' set but not used [-Wunused-but-set-variable]"

RESOLVED FIXED in mozilla9

Status

()

Core
DOM
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: dholbert, Assigned: mrbkap)

Tracking

(Blocks: 1 bug)

Trunk
mozilla9
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Filing bug on this build warning, seen in GCC 4.6 on x86_64 linux:

/mozilla/dom/base/nsJSEnvironment.cpp: In member function 'virtual nsresult nsJSContext::CreateOuterObject(nsIScriptGlobalObject*, nsIScriptGlobalObject*)':
/mozilla/dom/base/nsJSEnvironment.cpp:2248:12: warning: variable 'flags' set but not used [-Wunused-but-set-variable]

The code in question:
> 2241 nsresult
> 2242 nsJSContext::CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
> 2243                                nsIScriptGlobalObject *aCurrentInner)
> 2244 {
[...]
> 2248   PRUint32 flags = 0;
> 2249 
> 2250   if (chromeWindow) {
> 2251     // Flag this window's global object and objects under it as "system",
> 2252     // for optional automated XPCNativeWrapper construction when chrome JS
> 2253     // views a content DOM.
> 2254     flags = nsIXPConnect::FLAG_SYSTEM_GLOBAL_OBJECT;

It looks like we're expecting |flags| to have an effect, but clearly (per the GCC warning) its value is never read.

This changed here, as part of bug 586083:
https://hg.mozilla.org/mozilla-central/diff/ad65187427e8/dom/base/nsJSEnvironment.cpp#l1.91

That cset removed the only use of |flags| -- specifically, it replaced a call to...
  xpc->InitClassesWithNewWrappedGlobal(..., flags, ...)
...with...
  xpc->WrapNative(...)

mrbkap: Do you know if we still should be using |flags| at all, or if we can just drop it entirely?
(Assignee)

Comment 1

6 years ago
We can drop it entirely. I'll have a patch in a second.
(Assignee)

Comment 2

6 years ago
Created attachment 557962 [details] [diff] [review]
patch
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #557962 - Flags: review?(jst)

Updated

6 years ago
Attachment #557962 - Flags: review?(jst) → review+

Comment 3

6 years ago
http://hg.mozilla.org/mozilla-central/rev/3a37edcaa27f
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
You need to log in before you can comment on or make changes to this bug.