Bug 1280295 - Remove MOZ_HAVE_REF_QUALIFIERS. r=froydnj
authorChris Peterson <cpeterson@mozilla.com>
Tue, 03 Jan 2017 22:42:33 -0800
changeset 375170 49ee681bcb6cf43ce069fd63e2bf82ae3769af7c
parent 375169 8c207c957193fa2604cb20661594464d7e3aec77
child 375171 b4e24c1409619d871cea3bd7cc0fb4e9247b4405
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1280295
milestone53.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 1280295 - Remove MOZ_HAVE_REF_QUALIFIERS. r=froydnj
layout/base/ArenaRefPtr.h
mfbt/Attributes.h
mfbt/RefPtr.h
xpcom/glue/nsCOMPtr.h
--- a/layout/base/ArenaRefPtr.h
+++ b/layout/base/ArenaRefPtr.h
@@ -92,25 +92,20 @@ public:
   ArenaRefPtr<T>& operator=(T* aRhs)
   {
     assign(aRhs);
     return *this;
   }
 
   ~ArenaRefPtr() { assign(nullptr); }
 
-#ifdef MOZ_HAVE_REF_QUALIFIERS
   operator T*() const & { return get(); }
   operator T*() const && = delete;
   explicit operator bool() const { return !!mPtr; }
   bool operator!() const { return !mPtr; }
-#else
-  operator T*() const { return get(); }
-#endif
-
   T* operator->() const { return mPtr.operator->(); }
   T& operator*() const { return *get(); }
 
   T* get() const { return mPtr; }
 
 private:
   void AssertValidType();
 
--- a/mfbt/Attributes.h
+++ b/mfbt/Attributes.h
@@ -546,32 +546,16 @@
 #  define MOZ_IS_CLASS_INIT /* nothing */
 #  define MOZ_NON_PARAM /* nothing */
 #  define MOZ_NON_AUTOABLE /* nothing */
 #  define MOZ_REQUIRED_BASE_METHOD /* nothing */
 #endif /* MOZ_CLANG_PLUGIN */
 
 #define MOZ_RAII MOZ_NON_TEMPORARY_CLASS MOZ_STACK_CLASS
 
-/*
- * MOZ_HAVE_REF_QUALIFIERS is defined for compilers that support C++11's rvalue
- * qualifier, "&&".
- */
-#if defined(_MSC_VER) && _MSC_VER >= 1900
-#  define MOZ_HAVE_REF_QUALIFIERS
-#elif defined(__clang__)
-// All supported Clang versions
-#  define MOZ_HAVE_REF_QUALIFIERS
-#elif defined(__GNUC__)
-#  include "mozilla/Compiler.h"
-#  if MOZ_GCC_VERSION_AT_LEAST(4, 8, 1)
-#    define MOZ_HAVE_REF_QUALIFIERS
-#  endif
-#endif
-
 #endif /* __cplusplus */
 
 /**
  * Printf style formats.  MOZ_FORMAT_PRINTF can be used to annotate a
  * function or method that is "printf-like"; this will let (some)
  * compilers check that the arguments match the template string.
  *
  * This macro takes two arguments.  The first argument is the argument
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -278,44 +278,39 @@ public:
   /*
     Prefer the implicit conversion provided automatically by |operator T*() const|.
     Use |get()| to resolve ambiguity or to get a castable pointer.
   */
   {
     return const_cast<T*>(mRawPtr);
   }
 
-  operator T*() const
-#ifdef MOZ_HAVE_REF_QUALIFIERS
-  &
-#endif
+  operator T*() const &
   /*
     ...makes an |RefPtr| act like its underlying raw pointer type whenever it
     is used in a context where a raw pointer is expected.  It is this operator
     that makes an |RefPtr| substitutable for a raw pointer.
 
     Prefer the implicit use of this operator to calling |get()|, except where
     necessary to resolve ambiguity.
   */
   {
     return get();
   }
 
-#ifdef MOZ_HAVE_REF_QUALIFIERS
   // Don't allow implicit conversion of temporary RefPtr to raw pointer,
   // because the refcount might be one and the pointer will immediately become
   // invalid.
   operator T*() const && = delete;
 
   // These are needed to avoid the deleted operator above.  XXX Why is operator!
   // needed separately?  Shouldn't the compiler prefer using the non-deleted
   // operator bool instead of the deleted operator T*?
   explicit operator bool() const { return !!mRawPtr; }
   bool operator!() const { return !mRawPtr; }
-#endif
 
   T*
   operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN
   {
     MOZ_ASSERT(mRawPtr != nullptr,
                "You can't dereference a NULL RefPtr with operator->().");
     return get();
   }
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -742,31 +742,25 @@ public:
   T* get() const { return reinterpret_cast<T*>(mRawPtr); }
 
   // Makes an nsCOMPtr act like its underlying raw pointer type whenever it is
   // used in a context where a raw pointer is expected. It is this operator
   // that makes an nsCOMPtr substitutable for a raw pointer.
   //
   // Prefer the implicit use of this operator to calling |get()|, except where
   // necessary to resolve ambiguity.
-  operator T*() const
-#ifdef MOZ_HAVE_REF_QUALIFIERS
-  &
-#endif
-  { return get(); }
+  operator T*() const & { return get(); }
 
-#ifdef MOZ_HAVE_REF_QUALIFIERS
   // Don't allow implicit conversion of temporary nsCOMPtr to raw pointer,
   // because the refcount might be one and the pointer will immediately become
   // invalid.
   operator T*() const && = delete;
 
   // Needed to avoid the deleted operator above
   explicit operator bool() const { return !!mRawPtr; }
-#endif
 
   T* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN
   {
     MOZ_ASSERT(mRawPtr != nullptr,
                "You can't dereference a NULL nsCOMPtr with operator->().");
     return get();
   }
 
@@ -1463,10 +1457,9 @@ RefPtr<T>::operator=(const nsCOMPtr_help
   void* newRawPtr;
   if (NS_FAILED(aHelper(NS_GET_TEMPLATE_IID(T), &newRawPtr))) {
     newRawPtr = nullptr;
   }
   assign_assuming_AddRef(static_cast<T*>(newRawPtr));
   return *this;
 }
 
-
 #endif // !defined(nsCOMPtr_h___)