Last Comment Bug 682946 - GCC 4.6 build warning: "nsJSEnvironment.cpp:2248:12: warning: variable 'flags' set but not used [-Wunused-but-set-variable]"
: GCC 4.6 build warning: "nsJSEnvironment.cpp:2248:12: warning: variable 'flags...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla9
Assigned To: Blake Kaplan (:mrbkap) (please use needinfo!)
:
Mentors:
Depends on:
Blocks: buildwarning 586083
  Show dependency treegraph
 
Reported: 2011-08-29 13:05 PDT by Daniel Holbert [:dholbert]
Modified: 2011-09-04 16:59 PDT (History)
2 users (show)
emorley: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (1.24 KB, patch)
2011-09-02 15:28 PDT, Blake Kaplan (:mrbkap) (please use needinfo!)
jst: review+
Details | Diff | Review

Description Daniel Holbert [:dholbert] 2011-08-29 13:05:11 PDT
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?
Comment 1 Blake Kaplan (:mrbkap) (please use needinfo!) 2011-09-02 15:28:06 PDT
We can drop it entirely. I'll have a patch in a second.
Comment 2 Blake Kaplan (:mrbkap) (please use needinfo!) 2011-09-02 15:28:48 PDT
Created attachment 557962 [details] [diff] [review]
patch
Comment 3 Ed Morley [:emorley] 2011-09-04 16:59:33 PDT
http://hg.mozilla.org/mozilla-central/rev/3a37edcaa27f

Note You need to log in before you can comment on or make changes to this bug.