Closed Bug 682946 Opened 13 years ago Closed 13 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: dholbert, Assigned: mrbkap)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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?
We can drop it entirely. I'll have a patch in a second.
Attached patch patchSplinter Review
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #557962 - Flags: review?(jst)
Attachment #557962 - Flags: review?(jst) → review+
http://hg.mozilla.org/mozilla-central/rev/3a37edcaa27f
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: