Bug 1280295 - Remove MOZ_HAVE_REF_QUALIFIERS. r=froydnj

This commit is contained in:
Chris Peterson 2017-01-03 22:42:33 -08:00
parent 53d2c558be
commit 20bc668a02
4 changed files with 2 additions and 35 deletions

View File

@ -97,15 +97,10 @@ public:
~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(); }

View File

@ -551,22 +551,6 @@
#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 */
/**

View File

@ -283,10 +283,7 @@ public:
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
@ -299,7 +296,6 @@ public:
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.
@ -310,7 +306,6 @@ public:
// 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

View File

@ -747,13 +747,8 @@ public:
//
// 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.
@ -761,7 +756,6 @@ public:
// Needed to avoid the deleted operator above
explicit operator bool() const { return !!mRawPtr; }
#endif
T* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN
{
@ -1468,5 +1462,4 @@ RefPtr<T>::operator=(const nsCOMPtr_helper& aHelper)
return *this;
}
#endif // !defined(nsCOMPtr_h___)