gecko-dev/js
Jim Blandy 4760e9f4b7 Bug 921586: Avoid 'may be used uninitialized' warnings in StructuredClone.cpp. r=njn
Specifically, it seems that G++ 4.8.1 is unable to tell that the call to
AutoCompartment::~AutoCompartment is protected by the Maybe::constructed
flag.

The "solution" is not to use Maybe here; although Debugger.cpp uses
Maybe<AutoCompartment> everywhere, it gets away with it because it always
actually constructs the Maybe(?!?).

It's a shame to let the compiler's stupidity shape the code, but that
particular warning is valuable elsewhere, so I feel that we shouldn't just
disable the warning.

In file included from /home/jimb/moz/dbg/js/src/jsobjinlines.h:20:0,
                 from /home/jimb/moz/dbg/js/src/vm/StructuredClone.cpp:44:
/home/jimb/moz/dbg/js/src/jscompartmentinlines.h: In function ‘bool JS_StructuredClone(JSContext*, JS::Value, JS::Value*, const JSStructuredCloneCallbacks*, void*)’:
/home/jimb/moz/dbg/js/src/jscompartmentinlines.h:45:35: warning: ‘ac.js::AutoCompartment::origin_’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     cx_->leaveCompartment(origin_);
                                   ^
/home/jimb/moz/dbg/js/src/vm/StructuredClone.cpp:1521:41: note: ‘ac.js::AutoCompartment::origin_’ was declared here
         mozilla::Maybe<AutoCompartment> ac;
                                         ^
In file included from /home/jimb/moz/dbg/js/src/jsobjinlines.h:20:0,
                 from /home/jimb/moz/dbg/js/src/vm/StructuredClone.cpp:44:
/home/jimb/moz/dbg/js/src/jscompartmentinlines.h:45:35: warning: ‘ac.js::AutoCompartment::cx_’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     cx_->leaveCompartment(origin_);
                                   ^
/home/jimb/moz/dbg/js/src/vm/StructuredClone.cpp:1521:41: note: ‘ac.js::AutoCompartment::cx_’ was declared here
         mozilla::Maybe<AutoCompartment> ac;
                                         ^
2013-10-28 12:37:17 -07:00
..
ductwork/debugger Bug 929905 - Consolidate sources in moz.build. r=gps 2013-10-25 08:23:05 +09:00
examples Bug 876776 - Import latest version of js/examples/jorendb.js. DONTBUILD 2013-06-04 12:14:17 -07:00
ipc Bug 880330 - Remove the old options API; r=bholley 2013-10-28 12:59:04 +01:00
jsd Bug 880330 - Refactor jsd to use the new options API; r=sphink 2013-10-28 12:52:27 +01:00
public Bug 929800 - Handlify the structured clone interface; r=sfink,smaug 2013-10-22 17:18:32 -07:00
src Bug 921586: Avoid 'may be used uninitialized' warnings in StructuredClone.cpp. r=njn 2013-10-28 12:37:17 -07:00
xpconnect Bug 929297 - Part 2: Avoid calling amIAddonManager in reporters off the main process. r=njn 2013-10-28 04:53:00 +00:00