Bug 710473 - Backout the nsDerivedSafe part from bug 666414 to make PGO builds on Windows work again; r=roc (cause he volunteered) a=xul-diet
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 13 Dec 2011 20:03:24 -0500
changeset 84176 221eccfa6a3fc8678d9130d6ab26c974b484dd6d
parent 84175 ceffbd680e2c9122d51662f5c1a78188aee7930b
child 84177 70dea177b9d9e1ec583a3c8e2092daf20414d5b6
child 84203 6c5cb98336ba33324ff761763fb69d3022648f14
child 84639 80339f4dbaab84b960273e2b762ad79695551e3a
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)
reviewersroc, xul-diet
bugs710473, 666414
milestone11.0a1
first release with
nightly linux32
221eccfa6a3f / 11.0a1 / 20111214031134 / files
nightly linux64
221eccfa6a3f / 11.0a1 / 20111214031134 / files
nightly mac
221eccfa6a3f / 11.0a1 / 20111214031134 / files
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
Bug 710473 - Backout the nsDerivedSafe part from bug 666414 to make PGO builds on Windows work again; r=roc (cause he volunteered) a=xul-diet
xpcom/base/nsAutoPtr.h
xpcom/glue/nsCOMPtr.h
--- a/xpcom/base/nsAutoPtr.h
+++ b/xpcom/base/nsAutoPtr.h
@@ -1044,21 +1044,21 @@ class nsRefPtr
 
             Prefer the implicit use of this operator to calling |get()|, except where
             necessary to resolve ambiguity.
           */
         {
           return get();
         }
 
-      nsCOMPtr_base::nsDerivedSafe<T>*
+      T*
       operator->() const
         {
           NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsRefPtr with operator->().");
-          return reinterpret_cast<nsCOMPtr_base::nsDerivedSafe<T>*> (get());
+          return get();
         }
 
       // This operator is needed for gcc <= 4.0.* and for Sun Studio; it
       // causes internal compiler errors for some MSVC versions.  (It's not
       // clear to me whether it should be needed.)
 #ifndef _MSC_VER
       template <class U, class V>
       U&
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -424,55 +424,16 @@ nsCOMPtr_base
       
         template <class T> class Foo { ... };
         template <> class Foo<void*> { ... };
         template <class T> class Foo<T*> : private Foo<void*> { ... };
     */
   {
     public:
 
-      template <class T>
-      class
-        NS_STACK_CLASS
-      nsDerivedSafe : public T
-          /*
-            No client should ever see or have to type the name of this class.  It is the
-            artifact that makes it a compile-time error to call |AddRef| and |Release|
-            on a |nsCOMPtr|.  DO NOT USE THIS TYPE DIRECTLY IN YOUR CODE.
-
-            See |nsCOMPtr::operator->| and |nsRefPtr::operator->|.
-          */
-        {
-          private:
-            NS_METHOD_(nsrefcnt) AddRef();
-            NS_METHOD_(nsrefcnt) Release();
-            //using T::AddRef;
-            //using T::Release;
-            /*
-             We could use |using| above, except that gcc 4.2 on Mac has a bug
-             which causes |using| be unable to make the function private in
-             templated derived classes (see bug 689397).
-            */
-
-            ~nsDerivedSafe(); // NOT TO BE IMPLEMENTED
-            /* 
-              This dtor is added to make this class compatible with GCC 4.6.
-              If the destructor for T is private, nsDerivedSafe's unimplemented destructor 
-              will be implicitly-declared by the compiler as deleted.
-              Therefore this explicit dtor exists to avoid that deletion. See bug 689301.
-            */
-
-          protected:
-            nsDerivedSafe(); // NOT TO BE IMPLEMENTED
-              /*
-                This ctor exists to avoid compile errors and warnings about nsDerivedSafe using the
-                default ctor but inheriting classes without an empty ctor.  See bug 209667.
-              */
-        };
-
       nsCOMPtr_base( nsISupports* rawPtr = 0 )
           : mRawPtr(rawPtr)
         {
           // nothing else to do here
         }
 
       NS_COM_GLUE NS_CONSTRUCTOR_FASTCALL ~nsCOMPtr_base();
 
@@ -835,21 +796,21 @@ class nsCOMPtr MOZ_FINAL
 
             Prefer the implicit use of this operator to calling |get()|, except where
             necessary to resolve ambiguity.
           */
         {
           return get();
         }
 
-      nsCOMPtr_base::nsDerivedSafe<T>*
+      T*
       operator->() const
         {
           NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
-          return reinterpret_cast<nsCOMPtr_base::nsDerivedSafe<T>*> (get());
+          return get();
         }
 
       nsCOMPtr<T>*
       get_address()
           // This is not intended to be used by clients.  See |address_of|
           // below.
         {
           return this;
@@ -1142,21 +1103,21 @@ class nsCOMPtr<nsISupports>
 
             Prefer the implicit use of this operator to calling |get()|, except where
             necessary to resolve ambiguity.
           */
         {
           return get();
         }
 
-      nsDerivedSafe<nsISupports>*
+      nsISupports*
       operator->() const
         {
           NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
-          return reinterpret_cast<nsCOMPtr_base::nsDerivedSafe<nsISupports>*> (get());
+          return get();
         }
 
       nsCOMPtr<nsISupports>*
       get_address()
           // This is not intended to be used by clients.  See |address_of|
           // below.
         {
           return this;