summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2011-01-23 01:01:28 +0200
committerTor Lillqvist <tlillqvist@novell.com>2011-01-23 01:05:45 +0200
commita9eb49a9ad0f3aa8bee6ff536c0256b948f31dd1 (patch)
tree41aba200b3a40346f816ab825608ec215defdacd /cppu
parent8bf1ce17bc554c329c2902be394720709df8168d (diff)
If CPPU_LEAK_STATIC_DATA is defined, don't bother with assertions
Re-introduce the possibility to define CPPU_LEAK_STATIC_DATA. This time use it to bypass just the assertions that check that the type description counts really are zero at the end of the TypeDescriptor_Init_Impl destructor. Add more informative debugging printout of which counts are non-zero. Define CPPU_LEAK_STATIC_DATA for x64 Windows for now. But we do get the same assertions also on x86 Windows if cppu is built with OSL_DEBUG_LEVEL>1.
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/typelib/typelib.cxx19
-rw-r--r--cppu/util/target.pmk4
2 files changed, 23 insertions, 0 deletions
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index dd2f38b49..4e22da6a0 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -29,6 +29,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_cppu.hxx"
+#if OSL_DEBUG_LEVEL > 1
+#include <stdio.h>
+#endif
+
#include <hash_map>
#include <list>
#include <set>
@@ -335,7 +339,21 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
delete pWeakMap;
pWeakMap = 0;
}
+#ifndef CPPU_LEAK_STATIC_DATA
#if OSL_DEBUG_LEVEL > 1
+#define MYASSERT(x) if (x != 0) fprintf(stderr, "### "#x" = %d, should be zero!!!\n", x);
+ MYASSERT (nTypeDescriptionCount );
+ MYASSERT( nCompoundTypeDescriptionCount );
+ MYASSERT( nUnionTypeDescriptionCount );
+ MYASSERT( nIndirectTypeDescriptionCount );
+ MYASSERT( nArrayTypeDescriptionCount );
+ MYASSERT( nEnumTypeDescriptionCount );
+ MYASSERT( nInterfaceMethodTypeDescriptionCount );
+ MYASSERT( nInterfaceAttributeTypeDescriptionCount );
+ MYASSERT( nInterfaceTypeDescriptionCount );
+ MYASSERT( nTypeDescriptionReferenceCount );
+#undef MYASSERT
+
OSL_ASSERT( nTypeDescriptionCount == 0 );
OSL_ASSERT( nCompoundTypeDescriptionCount == 0 );
OSL_ASSERT( nUnionTypeDescriptionCount == 0 );
@@ -351,6 +369,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
#endif
delete pCallbacks;
pCallbacks = 0;
+#endif // CPPU_LEAK_STATIC_DATA
if( pMutex )
{
diff --git a/cppu/util/target.pmk b/cppu/util/target.pmk
index 3befcb154..a94ea7c8d 100644
--- a/cppu/util/target.pmk
+++ b/cppu/util/target.pmk
@@ -51,3 +51,7 @@ CFLAGS += -Ob0
.ENDIF
.ENDIF
+
+.IF "$(COM)$(CPU)" == "MSCX"
+CFLAGS += -DCPPU_LEAK_STATIC_DATA
+.ENDIF