bug 708231 - fix set-but-unused warnings reported by GCC 4.6 in jsexn.cpp. r=evilpies
authorIgor Bukanov <igor@mir2.org>
Wed, 07 Dec 2011 16:21:40 +0100
changeset 83810 70ca58127396844824186b0b3468d467072a2b51
parent 83809 6edca769b33a95a78b92b0cb1112e1fd59a7fc53
child 83811 e37f232c2e6d6f65ffabd41bc1ffe9b1c5b82dce
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpies
bugs708231
milestone11.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 708231 - fix set-but-unused warnings reported by GCC 4.6 in jsexn.cpp. r=evilpies
js/src/jsexn.cpp
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -855,27 +855,26 @@ exn_toString(JSContext *cx, uintN argc, 
 /*
  * Return a string that may eval to something similar to the original object.
  */
 static JSBool
 exn_toSource(JSContext *cx, uintN argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
-    JSObject *obj = ToObject(cx, &vp[1]);
+    JSObject *obj = ToObject(cx, &args.thisv());
     if (!obj)
         return false;
 
-    if (!obj->getProperty(cx, cx->runtime->atomState.nameAtom, vp))
+    Value nameVal;
+    JSString *name;
+    if (!obj->getProperty(cx, cx->runtime->atomState.nameAtom, &nameVal) ||
+        !(name = js_ValueToString(cx, nameVal))) {
         return false;
-
-    JSString *name = js_ValueToString(cx, *vp);
-    if (!name)
-        return false;
-    vp->setString(name);
+    }
 
     Value messageVal;
     JSString *message;
     if (!obj->getProperty(cx, cx->runtime->atomState.messageAtom, &messageVal) ||
         !(message = js_ValueToSource(cx, messageVal)))
     {
         return false;
     }
@@ -920,17 +919,17 @@ exn_toSource(JSContext *cx, uintN argc, 
     }
 
     if (!sb.append("))"))
         return false;
 
     JSString *str = sb.finishString();
     if (!str)
         return false;
-    vp->setString(str);
+    args.rval().setString(str);
     return true;
 }
 #endif
 
 static JSFunctionSpec exception_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN(js_toSource_str,   exn_toSource,           0,0),
 #endif