Fix warnings and Clang compile errors, bug 707049. r=waldo
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 31 Dec 2011 12:39:05 -0700
changeset 84845 905e6efc3cce0423d71912a892cd2bb85e3f3437
parent 84844 b73c54dfb1d0450a856725c3d1ea85bec07cb337
child 84846 29f66fc7e017ba5a4b5df172555dc3c6020c31b5
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs707049
milestone12.0a1
Fix warnings and Clang compile errors, bug 707049. r=waldo
js/src/jscntxt.h
js/src/jsprvtd.h
js/src/jsscope.cpp
js/src/jsscope.h
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -1474,19 +1474,16 @@ class AutoGCRooter {
  *   should generally replace those arguments with handles and avoid any
  *   explicit rooting. This has two benefits. First, when several such
  *   functions call each other then redundant rooting of multiple copies of the
  *   GC thing can be avoided. Second, if the caller does not pass a rooted
  *   value a compile error will be generated, which is quicker and easier to
  *   fix than when relying on a separate rooting analysis.
  */
 
-template <typename T>
-struct RootMethods { };
-
 template <> struct RootMethods<const jsid>
 {
     static jsid initial() { return JSID_VOID; }
     static ThingRootKind kind() { return THING_ROOT_ID; }
     static bool poisoned(jsid id) { return IsPoisonedId(id); }
 };
 
 template <> struct RootMethods<jsid>
--- a/js/src/jsprvtd.h
+++ b/js/src/jsprvtd.h
@@ -290,16 +290,19 @@ enum ThingRootKind
     THING_ROOT_ID,
     THING_ROOT_VALUE,
     THING_ROOT_LIMIT
 };
 
 template <typename T> class Root;
 template <typename T> class RootedVar;
 
+template <typename T>
+struct RootMethods { };
+
 /*
  * Reference to a stack location rooted for GC. See "Moving GC Stack Rooting"
  * comment in jscntxt.h.
  */
 template <typename T>
 class Handle
 {
   public:
@@ -320,18 +323,18 @@ class Handle
 
   private:
     const T *ptr;
     T value() { return *ptr; }
 
     template <typename S>
     void testAssign() {
 #ifdef DEBUG
-        T a;
-        S b;
+        T a = RootMethods<T>::initial();
+        S b = RootMethods<S>::initial();
         a = b;
 #endif
     }
 };
 
 typedef Handle<JSObject*>          HandleObject;
 typedef Handle<JSFunction*>        HandleFunction;
 typedef Handle<Shape*>             HandleShape;
--- a/js/src/jsscope.cpp
+++ b/js/src/jsscope.cpp
@@ -1268,18 +1268,18 @@ StackBaseShape::hash(const StackBaseShap
 }
 
 /* static */ inline bool
 StackBaseShape::match(UnownedBaseShape *key, const StackBaseShape *lookup)
 {
     return key->flags == lookup->flags
         && key->clasp == lookup->clasp
         && key->parent == lookup->parent
-        && (void *) key->rawGetter == lookup->rawGetter
-        && (void *) key->rawSetter == lookup->rawSetter;
+        && key->rawGetter == lookup->rawGetter
+        && key->rawSetter == lookup->rawSetter;
 }
 
 /* Root for stack allocated base shapes. */
 class RootStackBaseShape
 {
     Root<const JSObject*> parentRoot;
     Maybe<RootObject> getterRoot;
     Maybe<RootObject> setterRoot;
--- a/js/src/jsscope.h
+++ b/js/src/jsscope.h
@@ -52,16 +52,17 @@
 
 #include "jscntxt.h"
 #include "jsobj.h"
 #include "jsprvtd.h"
 #include "jspubtd.h"
 #include "jspropertytree.h"
 
 #include "js/HashTable.h"
+#include "mozilla/Attributes.h"
 
 #ifdef _MSC_VER
 #pragma warning(push)
 #pragma warning(disable:4800)
 #pragma warning(push)
 #pragma warning(disable:4100) /* Silence unreferenced formal parameter warnings */
 #endif
 
@@ -703,20 +704,17 @@ struct Shape : public js::gc::Cell
 
     /* Get a shape identical to this one, without parent/kids information. */
     Shape(const StackShape &other, uint32_t nfixed);
 
     /* Used by EmptyShape (see jsscopeinlines.h). */
     Shape(UnownedBaseShape *base, uint32_t nfixed);
 
     /* Copy constructor disabled, to avoid misuse of the above form. */
-    Shape(const Shape &other);
-
-    /* Not defined: Shapes must not be stack allocated. */
-    ~Shape();
+    Shape(const Shape &other) MOZ_DELETE;
 
     /*
      * Whether this shape has a valid slot value. This may be true even if
      * !hasSlot() (see SlotInfo comment above), and may be false even if
      * hasSlot() if the shape is being constructed and has not had a slot
      * assigned yet. After construction, hasSlot() implies !hasMissingSlot().
      */
     bool hasMissingSlot() const { return maybeSlot() == SHAPE_INVALID_SLOT; }