Bug 956470 - Fix -Wuninitialized warning in ErrorResult.h. r=bz
authorChris Peterson <cpeterson@mozilla.com>
Fri, 03 Jan 2014 20:21:13 -0800
changeset 163060 04f5a7e8f14cbd4ade5c90d3d3244e7546c889d1
parent 163059 fde74e7ea42b8d2420f58e1eb2b8d32a0f6d28bc
child 163061 3410ff3c525fb36dc53125b0c78cd84cd4db0051
push id38383
push usercpeterson@mozilla.com
push dateMon, 13 Jan 2014 03:40:24 +0000
treeherdermozilla-inbound@04f5a7e8f14c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs956470
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 956470 - Fix -Wuninitialized warning in ErrorResult.h. r=bz
dom/bindings/ErrorResult.h
--- a/dom/bindings/ErrorResult.h
+++ b/dom/bindings/ErrorResult.h
@@ -34,17 +34,22 @@ bool
 ThrowErrorMessage(JSContext* aCx, const ErrNum aErrorNumber, ...);
 
 } // namespace dom
 
 class ErrorResult {
 public:
   ErrorResult() {
     mResult = NS_OK;
+
 #ifdef DEBUG
+    // ErrorResult is extremely performance-sensitive code, where literally
+    // every machine instruction matters. Initialize mMessage only to suppress
+    // a debug-only warning from gcc 4.6.
+    mMessage = nullptr;
     mMightHaveUnreportedJSException = false;
 #endif
   }
 
 #ifdef DEBUG
   ~ErrorResult() {
     MOZ_ASSERT_IF(IsTypeError(), !mMessage);
     MOZ_ASSERT(!mMightHaveUnreportedJSException);