From 32e2ca0af53dcbf17a16807db48df38fd9d11473 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 24 Feb 2014 21:06:06 -0500 Subject: [PATCH] Bug 976372 - Remove support for compilers which lack support for dynamic_cast; r=dbaron --HG-- extra : rebase_source : 83a23e3b8fa4462eb70a1844b555c7605162a497 --- configure.in | 25 ------------------------- js/src/configure.in | 24 ------------------------ xpcom/base/nsTraceRefcntImpl.cpp | 21 +++------------------ xpcom/xpcom-config.h.in | 3 --- 4 files changed, 3 insertions(+), 70 deletions(-) diff --git a/configure.in b/configure.in index f85e7bd6180b..6169e907c49d 100644 --- a/configure.in +++ b/configure.in @@ -3189,30 +3189,6 @@ if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING) fi -dnl See if a dynamic_cast to void* gives the most derived object. -AC_CACHE_CHECK(for C++ dynamic_cast to void*, - ac_cv_cpp_dynamic_cast_void_ptr, - [AC_TRY_RUN([class X { int i; public: virtual ~X() { } }; - class Y { int j; public: virtual ~Y() { } }; - class Z : public X, public Y { int k; }; - - int main() { - Z mdo; - X *subx = (X*)&mdo; - Y *suby = (Y*)&mdo; - return !((((void*)&mdo != (void*)subx) && - ((void*)&mdo == dynamic_cast(subx))) || - (((void*)&mdo != (void*)suby) && - ((void*)&mdo == dynamic_cast(suby)))); - }], - ac_cv_cpp_dynamic_cast_void_ptr=yes, - ac_cv_cpp_dynamic_cast_void_ptr=no, - ac_cv_cpp_dynamic_cast_void_ptr=no)]) -if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then - AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR) -fi - - dnl note that this one is reversed - if the test fails, then dnl we require implementations of unused virtual methods. Which dnl really blows because it means we'll have useless vtable @@ -8742,7 +8718,6 @@ dnl The following defines are used by xpcom _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES CPP_THROW_NEW HAVE_CPP_AMBIGUITY_RESOLVING_USING -HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR HAVE_CPP_PARTIAL_SPECIALIZATION HAVE_CPP_TROUBLE_COMPARING_TO_ZERO NEED_CPP_UNUSED_IMPLEMENTATIONS diff --git a/js/src/configure.in b/js/src/configure.in index da9767c61613..4cf87d03c4c5 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2588,30 +2588,6 @@ if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING) fi -dnl See if a dynamic_cast to void* gives the most derived object. -AC_CACHE_CHECK(for C++ dynamic_cast to void*, - ac_cv_cpp_dynamic_cast_void_ptr, - [AC_TRY_RUN([class X { int i; public: virtual ~X() { } }; - class Y { int j; public: virtual ~Y() { } }; - class Z : public X, public Y { int k; }; - - int main() { - Z mdo; - X *subx = (X*)&mdo; - Y *suby = (Y*)&mdo; - return !((((void*)&mdo != (void*)subx) && - ((void*)&mdo == dynamic_cast(subx))) || - (((void*)&mdo != (void*)suby) && - ((void*)&mdo == dynamic_cast(suby)))); - }], - ac_cv_cpp_dynamic_cast_void_ptr=yes, - ac_cv_cpp_dynamic_cast_void_ptr=no, - ac_cv_cpp_dynamic_cast_void_ptr=no)]) -if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then - AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR) -fi - - dnl note that this one is reversed - if the test fails, then dnl we require implementations of unused virtual methods. Which dnl really blows because it means we'll have useless vtable diff --git a/xpcom/base/nsTraceRefcntImpl.cpp b/xpcom/base/nsTraceRefcntImpl.cpp index 5abd688d7da0..c28dc9ecf77e 100644 --- a/xpcom/base/nsTraceRefcntImpl.cpp +++ b/xpcom/base/nsTraceRefcntImpl.cpp @@ -455,20 +455,12 @@ GetBloatEntry(const char* aTypeName, uint32_t aInstanceSize) static int DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure) { serialNumberRecord* record = reinterpret_cast(aHashEntry->value); -#ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR fprintf((FILE*) aClosure, "%" PRIdPTR " @%p (%d references; %d from COMPtrs)\n", record->serialNumber, NS_INT32_TO_PTR(aHashEntry->key), record->refCount, record->COMPtrCount); -#else - fprintf((FILE*) aClosure, "%" PRIdPTR - " @%p (%d references)\n", - record->serialNumber, - NS_INT32_TO_PTR(aHashEntry->key), - record->refCount); -#endif return HT_ENUMERATE_NEXT; } @@ -598,7 +590,7 @@ static int32_t* GetRefCount(void* aPtr) } } -#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR) +#if defined(NS_IMPL_REFCNT_LOGGING) static int32_t* GetCOMPtrCount(void* aPtr) { PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr); @@ -733,7 +725,6 @@ static void InitTraceLog(void) const char* classes = getenv("XPCOM_MEM_LOG_CLASSES"); -#ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR if (classes) { (void)InitLog("XPCOM_MEM_COMPTR_LOG", "nsCOMPtr", &gCOMPtrLog); } else { @@ -741,12 +732,6 @@ static void InitTraceLog(void) fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n"); } } -#else - const char* comptr_log = getenv("XPCOM_MEM_COMPTR_LOG"); - if (comptr_log) { - fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but it will not work without dynamic_cast\n"); - } -#endif if (classes) { // if XPCOM_MEM_LOG_CLASSES was set to some value, the value is interpreted @@ -1173,7 +1158,7 @@ NS_LogDtor(void* aPtr, const char* aType, uint32_t aInstanceSize) EXPORT_XPCOM_API(void) NS_LogCOMPtrAddRef(void* aCOMPtr, nsISupports* aObject) { -#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR) +#if defined(NS_IMPL_REFCNT_LOGGING) // Get the most-derived object. void *object = dynamic_cast(aObject); @@ -1214,7 +1199,7 @@ NS_LogCOMPtrAddRef(void* aCOMPtr, nsISupports* aObject) EXPORT_XPCOM_API(void) NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject) { -#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR) +#if defined(NS_IMPL_REFCNT_LOGGING) // Get the most-derived object. void *object = dynamic_cast(aObject); diff --git a/xpcom/xpcom-config.h.in b/xpcom/xpcom-config.h.in index 9f918954d5a7..ac57a379cfb9 100644 --- a/xpcom/xpcom-config.h.in +++ b/xpcom/xpcom-config.h.in @@ -15,9 +15,6 @@ /* Define if the c++ compiler can resolve ambiguity with |using| */ #undef HAVE_CPP_AMBIGUITY_RESOLVING_USING -/* 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 has trouble comparing a constant * reference to a templatized class to zero */