Attempt to fix |address_of| bustage on IRIX. r=scc@mozilla.org b=59414
git-svn-id: svn://10.0.0.236/trunk@83454 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2643,6 +2643,19 @@ if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
|
||||
AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
|
||||
fi
|
||||
|
||||
dnl Some compilers have trouble resolving the ambiguity between two
|
||||
dnl functions whose arguments differ only by cv-qualifications.
|
||||
AC_CACHE_CHECK(whether the compiler cannot resolve const ambiguities correctly,
|
||||
ac_cv_cant_resolve_const_ambiguity,
|
||||
[AC_TRY_COMPILE([int a(int *i) { return *i; }
|
||||
const int a(const int *i) { return *i; } ],
|
||||
[ int i; a(&i); ],
|
||||
ac_cv_cant_resolve_const_ambiguity=no,
|
||||
ac_cv_cant_resolve_const_ambiguity=yes)])
|
||||
if test "$ac_cv_cant_resolve_const_ambiguity" = yes ; then
|
||||
AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl We dont do exceptions on unix. The only reason this used to be here
|
||||
dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
|
||||
|
||||
@@ -649,6 +649,17 @@ class nsCOMPtr
|
||||
return get();
|
||||
}
|
||||
|
||||
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
// broken version for IRIX
|
||||
|
||||
nsCOMPtr<T>*
|
||||
get_address() const
|
||||
{
|
||||
return NS_CONST_CAST(nsCOMPtr<T>*, this);
|
||||
}
|
||||
|
||||
#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
nsCOMPtr<T>*
|
||||
get_address()
|
||||
{
|
||||
@@ -661,6 +672,8 @@ class nsCOMPtr
|
||||
return this;
|
||||
}
|
||||
|
||||
#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
// This is going to become private soon, once all users of
|
||||
// nsCOMPtr stop using it. It may even become:
|
||||
// void operator&() const {}
|
||||
@@ -851,6 +864,17 @@ class nsCOMPtr<nsISupports>
|
||||
return get();
|
||||
}
|
||||
|
||||
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
// broken version for IRIX
|
||||
|
||||
nsCOMPtr<nsISupports>*
|
||||
get_address() const
|
||||
{
|
||||
return NS_CONST_CAST(nsCOMPtr<nsISupports>*, this);
|
||||
}
|
||||
|
||||
#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
nsCOMPtr<nsISupports>*
|
||||
get_address()
|
||||
{
|
||||
@@ -863,6 +887,8 @@ class nsCOMPtr<nsISupports>
|
||||
return this;
|
||||
}
|
||||
|
||||
#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
// This is going to become private soon, once all users of
|
||||
// nsCOMPtr stop using it. It may even become:
|
||||
// void operator&() const {}
|
||||
@@ -943,6 +969,20 @@ nsCOMPtr<T>::begin_assignment()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
// This is the broken version for IRIX, which can't handle the version below.
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsCOMPtr<T>*
|
||||
address_of( const nsCOMPtr<T>& aPtr )
|
||||
{
|
||||
return aPtr.get_address();
|
||||
}
|
||||
|
||||
#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsCOMPtr<T>*
|
||||
@@ -959,6 +999,8 @@ address_of( const nsCOMPtr<T>& aPtr )
|
||||
return aPtr.get_address();
|
||||
}
|
||||
|
||||
#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
template <class T>
|
||||
class nsGetterAddRefs
|
||||
/*
|
||||
|
||||
@@ -649,6 +649,17 @@ class nsCOMPtr
|
||||
return get();
|
||||
}
|
||||
|
||||
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
// broken version for IRIX
|
||||
|
||||
nsCOMPtr<T>*
|
||||
get_address() const
|
||||
{
|
||||
return NS_CONST_CAST(nsCOMPtr<T>*, this);
|
||||
}
|
||||
|
||||
#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
nsCOMPtr<T>*
|
||||
get_address()
|
||||
{
|
||||
@@ -661,6 +672,8 @@ class nsCOMPtr
|
||||
return this;
|
||||
}
|
||||
|
||||
#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
// This is going to become private soon, once all users of
|
||||
// nsCOMPtr stop using it. It may even become:
|
||||
// void operator&() const {}
|
||||
@@ -851,6 +864,17 @@ class nsCOMPtr<nsISupports>
|
||||
return get();
|
||||
}
|
||||
|
||||
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
// broken version for IRIX
|
||||
|
||||
nsCOMPtr<nsISupports>*
|
||||
get_address() const
|
||||
{
|
||||
return NS_CONST_CAST(nsCOMPtr<nsISupports>*, this);
|
||||
}
|
||||
|
||||
#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
nsCOMPtr<nsISupports>*
|
||||
get_address()
|
||||
{
|
||||
@@ -863,6 +887,8 @@ class nsCOMPtr<nsISupports>
|
||||
return this;
|
||||
}
|
||||
|
||||
#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
// This is going to become private soon, once all users of
|
||||
// nsCOMPtr stop using it. It may even become:
|
||||
// void operator&() const {}
|
||||
@@ -943,6 +969,20 @@ nsCOMPtr<T>::begin_assignment()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
// This is the broken version for IRIX, which can't handle the version below.
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsCOMPtr<T>*
|
||||
address_of( const nsCOMPtr<T>& aPtr )
|
||||
{
|
||||
return aPtr.get_address();
|
||||
}
|
||||
|
||||
#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsCOMPtr<T>*
|
||||
@@ -959,6 +999,8 @@ address_of( const nsCOMPtr<T>& aPtr )
|
||||
return aPtr.get_address();
|
||||
}
|
||||
|
||||
#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY
|
||||
|
||||
template <class T>
|
||||
class nsGetterAddRefs
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user