Bug 976372 - Remove support for compilers which lack support for dynamic_cast<void*>; r=dbaron

--HG--
extra : rebase_source : 83a23e3b8fa4462eb70a1844b555c7605162a497
This commit is contained in:
Ehsan Akhgari 2014-02-24 21:06:06 -05:00
Родитель c102d49715
Коммит 32e2ca0af5
4 изменённых файлов: 3 добавлений и 70 удалений

Просмотреть файл

@ -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<void*>(subx))) ||
(((void*)&mdo != (void*)suby) &&
((void*)&mdo == dynamic_cast<void*>(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

Просмотреть файл

@ -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<void*>(subx))) ||
(((void*)&mdo != (void*)suby) &&
((void*)&mdo == dynamic_cast<void*>(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

Просмотреть файл

@ -455,20 +455,12 @@ GetBloatEntry(const char* aTypeName, uint32_t aInstanceSize)
static int DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
{
serialNumberRecord* record = reinterpret_cast<serialNumberRecord *>(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<void *>(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<void *>(aObject);

Просмотреть файл

@ -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
*/