Backed out changeset 8d8165293e9b (bug 976372) because of Windows debug bustage on a CLOSED TREE

This commit is contained in:
Ehsan Akhgari 2014-02-24 23:01:54 -05:00
parent db4827dbd4
commit e9da09b721
4 changed files with 70 additions and 3 deletions

View File

@ -3189,6 +3189,30 @@ 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
@ -8718,6 +8742,7 @@ 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

View File

@ -2588,6 +2588,30 @@ 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

View File

@ -447,12 +447,20 @@ 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;
}
@ -582,7 +590,7 @@ static int32_t* GetRefCount(void* aPtr)
}
}
#if defined(NS_IMPL_REFCNT_LOGGING)
#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
static int32_t* GetCOMPtrCount(void* aPtr)
{
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
@ -717,6 +725,7 @@ 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 {
@ -724,6 +733,12 @@ 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
@ -1150,7 +1165,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)
#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
// Get the most-derived object.
void *object = dynamic_cast<void *>(aObject);
@ -1191,7 +1206,7 @@ NS_LogCOMPtrAddRef(void* aCOMPtr, nsISupports* aObject)
EXPORT_XPCOM_API(void)
NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject)
{
#if defined(NS_IMPL_REFCNT_LOGGING)
#if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
// Get the most-derived object.
void *object = dynamic_cast<void *>(aObject);

View File

@ -15,6 +15,9 @@
/* 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
*/