author | Matheus Kerschbaum <matjk7@gmail.com> |
Fri, 26 Aug 2011 00:35:13 +0100 | |
changeset 75998 | 3d4b14bd24e3c7527b7dcc941bb49f0a879c8584 |
parent 75997 | 706c0a4feec232daab369c002d8af05c2e2fe2b9 |
child 75999 | 03076dd9a84d6eef2c9913c1a144688d7d92bfc4 |
push id | 1531 |
push user | bmo@edmorley.co.uk |
push date | Sun, 28 Aug 2011 20:22:29 +0000 |
treeherder | mozilla-inbound@ca5a3569462d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ted |
bugs | 680625 |
milestone | 9.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
|
--- a/configure.in +++ b/configure.in @@ -3845,42 +3845,16 @@ AC_CACHE_CHECK(whether partial template template <class T> class Foo<T*> {};, return 0;, ac_cv_cpp_partial_specialization=yes, ac_cv_cpp_partial_specialization=no)]) if test "$ac_cv_cpp_partial_specialization" = yes ; then AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION) 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 can resolve const ambiguities for templates, - ac_cv_can_resolve_const_ambiguity, - [AC_TRY_COMPILE([ - template <class T> class ptrClass { - public: T* ptr; - }; - - template <class T> T* a(ptrClass<T> *arg) { - return arg->ptr; - } - - template <class T> - const T* a(const ptrClass<T> *arg) { - return arg->ptr; - } - ], - [ ptrClass<int> i; - a(&i); ], - ac_cv_can_resolve_const_ambiguity=yes, - ac_cv_can_resolve_const_ambiguity=no)]) -if test "$ac_cv_can_resolve_const_ambiguity" = no ; then - AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY) -fi - dnl Check to see if we can resolve ambiguity with |using|. AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity, ac_cv_cpp_ambiguity_resolving_using, [AC_TRY_COMPILE(class X { public: int go(const X&) {return 3;} int jo(const X&) {return 3;} }; class Y : public X { @@ -8958,17 +8932,16 @@ AC_SUBST(ac_configure_args) dnl Spit out some output dnl ======================================================== dnl The following defines are used by xpcom _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES CPP_THROW_NEW HAVE_CPP_2BYTE_WCHAR_T HAVE_CPP_AMBIGUITY_RESOLVING_USING -HAVE_CPP_BOOL HAVE_CPP_CHAR16_T HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX HAVE_CPP_PARTIAL_SPECIALIZATION HAVE_CPP_TROUBLE_COMPARING_TO_ZERO HAVE_STATVFS NEED_CPP_UNUSED_IMPLEMENTATIONS NEW_H
--- a/js/src/configure.in +++ b/js/src/configure.in @@ -3765,42 +3765,16 @@ AC_CACHE_CHECK(whether partial template template <class T> class Foo<T*> {};, return 0;, ac_cv_cpp_partial_specialization=yes, ac_cv_cpp_partial_specialization=no)]) if test "$ac_cv_cpp_partial_specialization" = yes ; then AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION) 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 can resolve const ambiguities for templates, - ac_cv_can_resolve_const_ambiguity, - [AC_TRY_COMPILE([ - template <class T> class ptrClass { - public: T* ptr; - }; - - template <class T> T* a(ptrClass<T> *arg) { - return arg->ptr; - } - - template <class T> - const T* a(const ptrClass<T> *arg) { - return arg->ptr; - } - ], - [ ptrClass<int> i; - a(&i); ], - ac_cv_can_resolve_const_ambiguity=yes, - ac_cv_can_resolve_const_ambiguity=no)]) -if test "$ac_cv_can_resolve_const_ambiguity" = no ; then - AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY) -fi - dnl Check to see if we can resolve ambiguity with |using|. AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity, ac_cv_cpp_ambiguity_resolving_using, [AC_TRY_COMPILE(class X { public: int go(const X&) {return 3;} int jo(const X&) {return 3;} }; class Y : public X {
--- a/parser/html/nsHtml5RefPtr.h +++ b/parser/html/nsHtml5RefPtr.h @@ -240,47 +240,32 @@ class nsHtml5RefPtr T* operator->() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsHtml5RefPtr with operator->()."); return get(); } -#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY - // broken version for IRIX - - nsHtml5RefPtr<T>* - get_address() const - // This is not intended to be used by clients. See |address_of| - // below. - { - return const_cast<nsHtml5RefPtr<T>*>(this); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - nsHtml5RefPtr<T>* get_address() // This is not intended to be used by clients. See |address_of| // below. { return this; } const nsHtml5RefPtr<T>* get_address() const // This is not intended to be used by clients. See |address_of| // below. { return this; } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - public: T& operator*() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsHtml5RefPtr with operator*()."); return *get(); } @@ -291,48 +276,32 @@ class nsHtml5RefPtr return reinterpret_cast<T**>(begin_assignment()); #else assign_assuming_AddRef(0); return reinterpret_cast<T**>(&mRawPtr); #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 -nsHtml5RefPtr<T>* -address_of( const nsHtml5RefPtr<T>& aPtr ) - { - return aPtr.get_address(); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> inline nsHtml5RefPtr<T>* address_of( nsHtml5RefPtr<T>& aPtr ) { return aPtr.get_address(); } template <class T> inline const nsHtml5RefPtr<T>* address_of( const nsHtml5RefPtr<T>& aPtr ) { return aPtr.get_address(); } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> class nsHtml5RefPtrGetterAddRefs /* ... This class is designed to be used for anonymous temporary objects in the argument list of calls that return COM interface pointers, e.g., @@ -389,165 +358,165 @@ getter_AddRefs( nsHtml5RefPtr<T>& aSmart } // Comparing two |nsHtml5RefPtr|s template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsHtml5RefPtr<T>& lhs, const nsHtml5RefPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsHtml5RefPtr<T>& lhs, const nsHtml5RefPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs.get()); } // Comparing an |nsHtml5RefPtr| to a raw pointer template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsHtml5RefPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( const U* lhs, const nsHtml5RefPtr<T>& rhs ) { return static_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsHtml5RefPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const U* lhs, const nsHtml5RefPtr<T>& rhs ) { return static_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } // To avoid ambiguities caused by the presence of builtin |operator==|s // creating a situation where one of the |operator==| defined above // has a better conversion for one argument and the builtin has a // better conversion for the other argument, define additional // |operator==| without the |const| on the raw pointer. // See bug 65664 for details. #ifndef NSCAP_DONT_PROVIDE_NONCONST_OPEQ template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsHtml5RefPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) == const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( U* lhs, const nsHtml5RefPtr<T>& rhs ) { return const_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsHtml5RefPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) != const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( U* lhs, const nsHtml5RefPtr<T>& rhs ) { return const_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } #endif // Comparing an |nsHtml5RefPtr| to |0| template <class T> inline -NSCAP_BOOL +bool operator==( const nsHtml5RefPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( NSCAP_Zero* lhs, const nsHtml5RefPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } template <class T> inline -NSCAP_BOOL +bool operator!=( const nsHtml5RefPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr != 0| { return static_cast<const void*>(lhs.get()) != reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator!=( NSCAP_Zero* lhs, const nsHtml5RefPtr<T>& rhs ) // specifically to allow |0 != smartPtr| { return reinterpret_cast<const void*>(lhs) != static_cast<const void*>(rhs.get()); } #ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO // We need to explicitly define comparison operators for `int' // because the compiler is lame. template <class T> inline -NSCAP_BOOL +bool operator==( const nsHtml5RefPtr<T>& lhs, int rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( int lhs, const nsHtml5RefPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } #endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
--- a/xpcom/base/nsAutoPtr.h +++ b/xpcom/base/nsAutoPtr.h @@ -192,47 +192,32 @@ class nsAutoPtr U& operator->*(U V::* aMember) { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsAutoPtr with operator->*()."); return get()->*aMember; } #endif -#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY - // broken version for IRIX - - nsAutoPtr<T>* - get_address() const - // This is not intended to be used by clients. See |address_of| - // below. - { - return const_cast<nsAutoPtr<T>*>(this); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - nsAutoPtr<T>* get_address() // This is not intended to be used by clients. See |address_of| // below. { return this; } const nsAutoPtr<T>* get_address() const // This is not intended to be used by clients. See |address_of| // below. { return this; } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - public: T& operator*() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsAutoPtr with operator*()."); return *get(); } @@ -243,48 +228,32 @@ class nsAutoPtr return reinterpret_cast<T**>(begin_assignment()); #else assign(0); return reinterpret_cast<T**>(&mRawPtr); #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 -nsAutoPtr<T>* -address_of( const nsAutoPtr<T>& aPtr ) - { - return aPtr.get_address(); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> inline nsAutoPtr<T>* address_of( nsAutoPtr<T>& aPtr ) { return aPtr.get_address(); } template <class T> inline const nsAutoPtr<T>* address_of( const nsAutoPtr<T>& aPtr ) { return aPtr.get_address(); } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> class nsAutoPtrGetterTransfers /* ... This class is designed to be used for anonymous temporary objects in the argument list of calls that return COM interface pointers, e.g., @@ -341,165 +310,165 @@ getter_Transfers( nsAutoPtr<T>& aSmartPt } // Comparing two |nsAutoPtr|s template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsAutoPtr<T>& lhs, const nsAutoPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsAutoPtr<T>& lhs, const nsAutoPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs.get()); } // Comparing an |nsAutoPtr| to a raw pointer template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsAutoPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( const U* lhs, const nsAutoPtr<T>& rhs ) { return static_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsAutoPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const U* lhs, const nsAutoPtr<T>& rhs ) { return static_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } // To avoid ambiguities caused by the presence of builtin |operator==|s // creating a situation where one of the |operator==| defined above // has a better conversion for one argument and the builtin has a // better conversion for the other argument, define additional // |operator==| without the |const| on the raw pointer. // See bug 65664 for details. #ifndef NSCAP_DONT_PROVIDE_NONCONST_OPEQ template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsAutoPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) == const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( U* lhs, const nsAutoPtr<T>& rhs ) { return const_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsAutoPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) != const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( U* lhs, const nsAutoPtr<T>& rhs ) { return const_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } #endif // Comparing an |nsAutoPtr| to |0| template <class T> inline -NSCAP_BOOL +bool operator==( const nsAutoPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( NSCAP_Zero* lhs, const nsAutoPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } template <class T> inline -NSCAP_BOOL +bool operator!=( const nsAutoPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr != 0| { return static_cast<const void*>(lhs.get()) != reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator!=( NSCAP_Zero* lhs, const nsAutoPtr<T>& rhs ) // specifically to allow |0 != smartPtr| { return reinterpret_cast<const void*>(lhs) != static_cast<const void*>(rhs.get()); } #ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO // We need to explicitly define comparison operators for `int' // because the compiler is lame. template <class T> inline -NSCAP_BOOL +bool operator==( const nsAutoPtr<T>& lhs, int rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( int lhs, const nsAutoPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } #endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO) @@ -612,47 +581,32 @@ class nsAutoArrayPtr T* operator->() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsAutoArrayPtr with operator->()."); return get(); } -#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY - // broken version for IRIX - - nsAutoArrayPtr<T>* - get_address() const - // This is not intended to be used by clients. See |address_of| - // below. - { - return const_cast<nsAutoArrayPtr<T>*>(this); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - nsAutoArrayPtr<T>* get_address() // This is not intended to be used by clients. See |address_of| // below. { return this; } const nsAutoArrayPtr<T>* get_address() const // This is not intended to be used by clients. See |address_of| // below. { return this; } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - public: T& operator*() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsAutoArrayPtr with operator*()."); return *get(); } @@ -663,48 +617,32 @@ class nsAutoArrayPtr return reinterpret_cast<T**>(begin_assignment()); #else assign(0); return reinterpret_cast<T**>(&mRawPtr); #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 -nsAutoArrayPtr<T>* -address_of( const nsAutoArrayPtr<T>& aPtr ) - { - return aPtr.get_address(); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> inline nsAutoArrayPtr<T>* address_of( nsAutoArrayPtr<T>& aPtr ) { return aPtr.get_address(); } template <class T> inline const nsAutoArrayPtr<T>* address_of( const nsAutoArrayPtr<T>& aPtr ) { return aPtr.get_address(); } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> class nsAutoArrayPtrGetterTransfers /* ... This class is designed to be used for anonymous temporary objects in the argument list of calls that return COM interface pointers, e.g., @@ -761,165 +699,165 @@ getter_Transfers( nsAutoArrayPtr<T>& aSm } // Comparing two |nsAutoArrayPtr|s template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsAutoArrayPtr<T>& lhs, const nsAutoArrayPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsAutoArrayPtr<T>& lhs, const nsAutoArrayPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs.get()); } // Comparing an |nsAutoArrayPtr| to a raw pointer template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsAutoArrayPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( const U* lhs, const nsAutoArrayPtr<T>& rhs ) { return static_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsAutoArrayPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const U* lhs, const nsAutoArrayPtr<T>& rhs ) { return static_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } // To avoid ambiguities caused by the presence of builtin |operator==|s // creating a situation where one of the |operator==| defined above // has a better conversion for one argument and the builtin has a // better conversion for the other argument, define additional // |operator==| without the |const| on the raw pointer. // See bug 65664 for details. #ifndef NSCAP_DONT_PROVIDE_NONCONST_OPEQ template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsAutoArrayPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) == const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( U* lhs, const nsAutoArrayPtr<T>& rhs ) { return const_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsAutoArrayPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) != const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( U* lhs, const nsAutoArrayPtr<T>& rhs ) { return const_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } #endif // Comparing an |nsAutoArrayPtr| to |0| template <class T> inline -NSCAP_BOOL +bool operator==( const nsAutoArrayPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( NSCAP_Zero* lhs, const nsAutoArrayPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } template <class T> inline -NSCAP_BOOL +bool operator!=( const nsAutoArrayPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr != 0| { return static_cast<const void*>(lhs.get()) != reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator!=( NSCAP_Zero* lhs, const nsAutoArrayPtr<T>& rhs ) // specifically to allow |0 != smartPtr| { return reinterpret_cast<const void*>(lhs) != static_cast<const void*>(rhs.get()); } #ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO // We need to explicitly define comparison operators for `int' // because the compiler is lame. template <class T> inline -NSCAP_BOOL +bool operator==( const nsAutoArrayPtr<T>& lhs, int rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( int lhs, const nsAutoArrayPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } #endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO) @@ -1126,47 +1064,32 @@ class nsRefPtr U& operator->*(U V::* aMember) { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsRefPtr with operator->*()."); return get()->*aMember; } #endif -#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY - // broken version for IRIX - - nsRefPtr<T>* - get_address() const - // This is not intended to be used by clients. See |address_of| - // below. - { - return const_cast<nsRefPtr<T>*>(this); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - nsRefPtr<T>* get_address() // This is not intended to be used by clients. See |address_of| // below. { return this; } const nsRefPtr<T>* get_address() const // This is not intended to be used by clients. See |address_of| // below. { return this; } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - public: T& operator*() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsRefPtr with operator*()."); return *get(); } @@ -1177,48 +1100,32 @@ class nsRefPtr return reinterpret_cast<T**>(begin_assignment()); #else assign_assuming_AddRef(0); return reinterpret_cast<T**>(&mRawPtr); #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 -nsRefPtr<T>* -address_of( const nsRefPtr<T>& aPtr ) - { - return aPtr.get_address(); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> inline nsRefPtr<T>* address_of( nsRefPtr<T>& aPtr ) { return aPtr.get_address(); } template <class T> inline const nsRefPtr<T>* address_of( const nsRefPtr<T>& aPtr ) { return aPtr.get_address(); } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> class nsRefPtrGetterAddRefs /* ... This class is designed to be used for anonymous temporary objects in the argument list of calls that return COM interface pointers, e.g., @@ -1275,165 +1182,165 @@ getter_AddRefs( nsRefPtr<T>& aSmartPtr ) } // Comparing two |nsRefPtr|s template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsRefPtr<T>& lhs, const nsRefPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsRefPtr<T>& lhs, const nsRefPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs.get()); } // Comparing an |nsRefPtr| to a raw pointer template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsRefPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( const U* lhs, const nsRefPtr<T>& rhs ) { return static_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsRefPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const U* lhs, const nsRefPtr<T>& rhs ) { return static_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } // To avoid ambiguities caused by the presence of builtin |operator==|s // creating a situation where one of the |operator==| defined above // has a better conversion for one argument and the builtin has a // better conversion for the other argument, define additional // |operator==| without the |const| on the raw pointer. // See bug 65664 for details. #ifndef NSCAP_DONT_PROVIDE_NONCONST_OPEQ template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsRefPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) == const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( U* lhs, const nsRefPtr<T>& rhs ) { return const_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsRefPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) != const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( U* lhs, const nsRefPtr<T>& rhs ) { return const_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } #endif // Comparing an |nsRefPtr| to |0| template <class T> inline -NSCAP_BOOL +bool operator==( const nsRefPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( NSCAP_Zero* lhs, const nsRefPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } template <class T> inline -NSCAP_BOOL +bool operator!=( const nsRefPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr != 0| { return static_cast<const void*>(lhs.get()) != reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator!=( NSCAP_Zero* lhs, const nsRefPtr<T>& rhs ) // specifically to allow |0 != smartPtr| { return reinterpret_cast<const void*>(lhs) != static_cast<const void*>(rhs.get()); } #ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO // We need to explicitly define comparison operators for `int' // because the compiler is lame. template <class T> inline -NSCAP_BOOL +bool operator==( const nsRefPtr<T>& lhs, int rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( int lhs, const nsRefPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } #endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
--- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -118,26 +118,16 @@ #else #define NS_MAY_ALIAS_PTR(t) t* #endif #if defined(NSCAP_DISABLE_DEBUG_PTR_TYPES) #define NSCAP_FEATURE_USE_BASE #endif - -#ifdef HAVE_CPP_BOOL - typedef bool NSCAP_BOOL; -#else - typedef PRBool NSCAP_BOOL; -#endif - - - - /* The following three macros (|NSCAP_ADDREF|, |NSCAP_RELEASE|, and |NSCAP_LOG_ASSIGNMENT|) allow external clients the ability to add logging or other interesting debug facilities. In fact, if you want |nsCOMPtr| to participate in the standard logging facility, you provide (e.g., in "nsTraceRefcnt.h") suitable definitions #define NSCAP_ADDREF(this, ptr) NS_ADDREF(ptr) #define NSCAP_RELEASE(this, ptr) NS_RELEASE(ptr) @@ -815,47 +805,32 @@ nsCOMPtr T* operator->() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->()."); return get(); } -#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY - // broken version for IRIX - - nsCOMPtr<T>* - get_address() const - // This is not intended to be used by clients. See |address_of| - // below. - { - return const_cast<nsCOMPtr<T>*>(this); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - nsCOMPtr<T>* get_address() // This is not intended to be used by clients. See |address_of| // below. { return this; } const nsCOMPtr<T>* get_address() const // This is not intended to be used by clients. See |address_of| // below. { return this; } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - public: T& operator*() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*()."); return *get(); } @@ -1137,47 +1112,32 @@ class nsCOMPtr<nsISupports> nsISupports* operator->() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->()."); return get(); } -#ifdef CANT_RESOLVE_CPP_CONST_AMBIGUITY - // broken version for IRIX - - nsCOMPtr<nsISupports>* - get_address() const - // This is not intended to be used by clients. See |address_of| - // below. - { - return const_cast<nsCOMPtr<nsISupports>*>(this); - } - -#else // CANT_RESOLVE_CPP_CONST_AMBIGUITY - nsCOMPtr<nsISupports>* get_address() // This is not intended to be used by clients. See |address_of| // below. { return this; } const nsCOMPtr<nsISupports>* get_address() const // This is not intended to be used by clients. See |address_of| // below. { return this; } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - public: nsISupports& operator*() const { NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*()."); return *get(); } @@ -1280,48 +1240,32 @@ nsCOMPtr<T>::begin_assignment() { assign_assuming_AddRef(0); union { T** mT; void** mVoid; } result; result.mT = &mRawPtr; return result.mVoid; } #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>* address_of( nsCOMPtr<T>& aPtr ) { return aPtr.get_address(); } template <class T> inline const nsCOMPtr<T>* address_of( const nsCOMPtr<T>& aPtr ) { return aPtr.get_address(); } -#endif // CANT_RESOLVE_CPP_CONST_AMBIGUITY - template <class T> class nsGetterAddRefs /* ... This class is designed to be used for anonymous temporary objects in the argument list of calls that return COM interface pointers, e.g., @@ -1444,61 +1388,61 @@ CallQueryInterface( T* aSource, nsGetter static_cast<DestinationType**>(aDestination)); } // Comparing two |nsCOMPtr|s template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs ) { return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs.get()); } // Comparing an |nsCOMPtr| to a raw pointer template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsCOMPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) == rhs; } template <class T, class U> inline -NSCAP_BOOL +bool operator==( const U* lhs, const nsCOMPtr<T>& rhs ) { return lhs == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsCOMPtr<T>& lhs, const U* rhs ) { return static_cast<const T*>(lhs.get()) != rhs; } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const U* lhs, const nsCOMPtr<T>& rhs ) { return lhs != static_cast<const T*>(rhs.get()); } // To avoid ambiguities caused by the presence of builtin |operator==|s // creating a situation where one of the |operator==| defined above // has a better conversion for one argument and the builtin has a @@ -1513,119 +1457,119 @@ operator!=( const U* lhs, const nsCOMPtr #ifndef NSCAP_DONT_PROVIDE_NONCONST_OPEQ #define NSCAP_DONT_PROVIDE_NONCONST_OPEQ #endif #endif #ifndef NSCAP_DONT_PROVIDE_NONCONST_OPEQ template <class T, class U> inline -NSCAP_BOOL +bool operator==( const nsCOMPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) == const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator==( U* lhs, const nsCOMPtr<T>& rhs ) { return const_cast<const U*>(lhs) == static_cast<const T*>(rhs.get()); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( const nsCOMPtr<T>& lhs, U* rhs ) { return static_cast<const T*>(lhs.get()) != const_cast<const U*>(rhs); } template <class T, class U> inline -NSCAP_BOOL +bool operator!=( U* lhs, const nsCOMPtr<T>& rhs ) { return const_cast<const U*>(lhs) != static_cast<const T*>(rhs.get()); } #endif // Comparing an |nsCOMPtr| to |0| class NSCAP_Zero; template <class T> inline -NSCAP_BOOL +bool operator==( const nsCOMPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } template <class T> inline -NSCAP_BOOL +bool operator!=( const nsCOMPtr<T>& lhs, NSCAP_Zero* rhs ) // specifically to allow |smartPtr != 0| { return static_cast<const void*>(lhs.get()) != reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator!=( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs ) // specifically to allow |0 != smartPtr| { return reinterpret_cast<const void*>(lhs) != static_cast<const void*>(rhs.get()); } #ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO // We need to explicitly define comparison operators for `int' // because the compiler is lame. template <class T> inline -NSCAP_BOOL +bool operator==( const nsCOMPtr<T>& lhs, int rhs ) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs); } template <class T> inline -NSCAP_BOOL +bool operator==( int lhs, const nsCOMPtr<T>& rhs ) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get()); } #endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO) // Comparing any two [XP]COM objects for identity inline -NSCAP_BOOL +bool SameCOMIdentity( nsISupports* lhs, nsISupports* rhs ) { return nsCOMPtr<nsISupports>( do_QueryInterface(lhs) ) == nsCOMPtr<nsISupports>( do_QueryInterface(rhs) ); } template <class SourceType, class DestinationType>
--- a/xpcom/string/public/nsCharTraits.h +++ b/xpcom/string/public/nsCharTraits.h @@ -72,22 +72,16 @@ #define NS_ERROR(msg) #else #ifndef nsDebug_h__ #include "nsDebug.h" // for NS_ASSERTION #endif #endif -#ifdef HAVE_CPP_BOOL - typedef bool nsCharTraits_bool; -#else - typedef PRBool nsCharTraits_bool; -#endif - /* * Some macros for converting PRUnichar (UTF-16) to and from Unicode scalar * values. * * Note that UTF-16 represents all Unicode scalar values up to U+10FFFF by * using "surrogate pairs". These consist of a high surrogate, i.e. a code * point in the range U+D800 - U+DBFF, and a low surrogate, i.e. a code point * in the range U+DC00 - U+DFFF, like this: @@ -179,34 +173,34 @@ struct nsCharTraits<PRUnichar> static int_type to_int_type( char_type c ) { return int_type( static_cast<unsigned_char_type>(c) ); } static - nsCharTraits_bool + bool eq_int_type( int_type lhs, int_type rhs ) { return lhs == rhs; } // |char_type| comparisons: static - nsCharTraits_bool + bool eq( char_type lhs, char_type rhs ) { return lhs == rhs; } static - nsCharTraits_bool + bool lt( char_type lhs, char_type rhs ) { return lhs < rhs; } // operations on s[n] arrays: @@ -465,34 +459,34 @@ struct nsCharTraits<char> static int_type to_int_type( char_type c ) { return int_type( static_cast<unsigned_char_type>(c) ); } static - nsCharTraits_bool + bool eq_int_type( int_type lhs, int_type rhs ) { return lhs == rhs; } // |char_type| comparisons: static - nsCharTraits_bool + bool eq( char_type lhs, char_type rhs ) { return lhs == rhs; } static - nsCharTraits_bool + bool lt( char_type lhs, char_type rhs ) { return lhs < rhs; } // operations on s[n] arrays:
--- a/xpcom/xpcom-config.h.in +++ b/xpcom/xpcom-config.h.in @@ -9,19 +9,16 @@ #undef CPP_THROW_NEW /* Define if the c++ compiler supports a 2-byte wchar_t */ #undef HAVE_CPP_2BYTE_WCHAR_T /* Define if the c++ compiler can resolve ambiguity with |using| */ #undef HAVE_CPP_AMBIGUITY_RESOLVING_USING -/* Define if the c++ compiler has builtin Bool type */ -#undef HAVE_CPP_BOOL - /* Define if the c++ compiler supports char16_t */ #undef HAVE_CPP_CHAR16_T /* Define if a dyanmic_cast to void* gives the most derived object */ #undef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR /* Define if the c++ compiler supports the modern template * specialization syntax