diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-11-21 17:30:53 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-11-21 17:32:26 +0100 |
commit | 1276076ac8fcc84df64050f8aa194fa75386a0ea (patch) | |
tree | 258d77877c052464ff113f56355bbcc5d16e80a5 /bridges | |
parent | 329742e6c9da7cd7848d92a6846e3d1249d8d9b4 (diff) |
ibridges: convert all legacy osl/diagnose.h assertions in source/cppu_uno
Change-Id: I4e78fac76b6bb4923e3b680d910afe5bb9640c33
Diffstat (limited to 'bridges')
80 files changed, 431 insertions, 581 deletions
diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx index 5bae75ff87df..8fb27d251074 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx @@ -83,7 +83,7 @@ static typelib_TypeClass cpp2uno_call( ++ovrflw; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)__builtin_alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -310,7 +310,7 @@ static typelib_TypeClass cpp_mediate( void ** gpreg, double * fpreg, void ** ovrflw, sal_uInt64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // gpreg: [ret *], this, [other gpr params] // fpreg: [fpr params] @@ -350,7 +350,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -607,7 +607,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -640,7 +640,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx index 077afb00b085..8d743571b91b 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx @@ -25,7 +25,6 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -59,7 +58,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -147,7 +146,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second); } else { @@ -178,7 +177,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second); } else // taking already generated rtti { @@ -200,7 +199,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -218,7 +217,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); if (! pTypeDescr) terminate(); @@ -244,7 +242,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) terminate(); } @@ -255,14 +252,12 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) { - OSL_ENSURE( header, "### no exception header!!!" ); if (! header) terminate(); typelib_TypeDescription * pExcTypeDescr = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx index 34daa7a69da7..a879fda6f881 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx @@ -179,7 +179,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr && "### expected return type description!"); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -203,7 +203,7 @@ static void cpp_call( INSERT_INT32(&pAdjustedThisPtr, pStack); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); // args void ** pCppArgs = (void **)__builtin_alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -293,7 +293,7 @@ static void cpp_call( try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr->eTypeClass, diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx index 49d41a479ef5..0a6390d5d3db 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx @@ -101,7 +101,7 @@ namespace pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), + static_assert( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); @@ -298,7 +298,7 @@ namespace void ** pCallStack, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); // pCallStack: [ret *], this, params // _this_ ptr is patched cppu_XInterfaceProxy object @@ -320,7 +320,7 @@ namespace typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr(); - OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, + assert( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex && "### illegal vtable index!" ); if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex) { @@ -328,11 +328,11 @@ namespace } // determine called method - OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, + assert( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex && "### illegal vtable index!" ); sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, + assert( nMemberPos < pTypeDescr->nAllMembers && "### illegal member index!" ); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -529,7 +529,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: @@ -563,7 +563,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; } default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx index 3a67648efa06..ee9fb30a07a9 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx @@ -521,7 +521,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: @@ -545,7 +545,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; } default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx index 0aa8f5be5626..e10a444ce5ac 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx @@ -91,7 +91,7 @@ void cpp2uno_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -234,7 +234,7 @@ extern "C" void cpp_vtable_call( int nFunctionIndex, int nVtableOffset, void** pCallStack, void * pReturnValue ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // pCallStack: ret adr, [ret *], this, params void * pThis; @@ -488,7 +488,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -515,7 +515,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx index 838743a51c1f..d20bf42435bc 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/except.cxx @@ -26,8 +26,8 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> +#include <sal/log.hxx> #include <com/sun/star/uno/genfunc.hxx> #include <com/sun/star/uno/RuntimeException.hpp> @@ -262,7 +262,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -281,7 +281,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -330,10 +330,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges.ios", aRE.Message); return; } @@ -348,10 +345,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges.ios", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx index 126860860c6c..ea95642ab58d 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx @@ -355,7 +355,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -383,7 +383,7 @@ static void cpp_call( INSERT_INT32( &pAdjustedThisPtr, nGPR, pGPR, pStack ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -565,7 +565,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers && "### member pos out of range!"); #endif VtableSlot aVtableSlot( @@ -614,7 +614,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers && "### member pos out of range!"); #endif VtableSlot aVtableSlot( diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm64.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm64.cxx index e2210c55e628..8473b61741d3 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm64.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm64.cxx @@ -236,7 +236,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert( pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -435,7 +435,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert( nMemberPos < pTypeDescr->nAllMembers && "### member pos out of range!"); #endif VtableSlot aVtableSlot( @@ -484,7 +484,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers && "### member pos out of range!"); #endif VtableSlot aVtableSlot( diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx index a741277e0f01..5034b0b87ebb 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx @@ -62,9 +62,9 @@ void callVirtualMethod( // parameter list is mixed list of * and values // reference parameters are pointers - OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" ); - OSL_ENSURE( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); - OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" ); + assert(pStackLongs && pAdjustedThisPtr); + static_assert( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); + assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !"); // never called if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something @@ -161,7 +161,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion bool bSimpleReturn = true; @@ -192,7 +192,7 @@ static void cpp_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -263,7 +263,7 @@ static void cpp_call( try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr, bSimpleReturn, diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx index f47f369cb0f8..e95a7b08f970 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx @@ -88,7 +88,7 @@ static typelib_TypeClass cpp2uno_call( nregs++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -331,7 +331,7 @@ static typelib_TypeClass cpp_mediate( void ** gpreg, void ** fpreg, void ** ovrflw, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int64)==sizeof(void *), "### unexpected!"); sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32); sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF); @@ -395,9 +395,9 @@ static typelib_TypeClass cpp_mediate( } // determine called method - OSL_ENSURE( nVtableCall < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" ); + assert(nVtableCall < pTypeDescr->nMapFunctionIndexToMemberIndex); sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -624,7 +624,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -657,7 +657,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx index b745a703b92f..ddf2c060a1e3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx @@ -26,7 +26,6 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -58,7 +57,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -145,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -176,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -199,7 +198,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -216,7 +215,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) terminate(); @@ -242,7 +241,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) terminate(); } @@ -252,14 +250,12 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) { - OSL_ENSURE( header, "### no exception header!!!" ); if (! header) terminate(); typelib_TypeDescription * pExcTypeDescr = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx index 7cbf3a97423d..83055ac78d0e 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx @@ -209,7 +209,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -234,7 +234,7 @@ static void cpp_call( INSERT_INT64( &pAdjustedThisPtr, nRegs, pGPR, pStack ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx index 0d6a754d9187..8bbbe03d0570 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx @@ -22,7 +22,6 @@ #include <rtl/alloc.h> #include <osl/mutex.hxx> -#include <osl/diagnose.h> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -92,8 +91,8 @@ namespace pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), - "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), + "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -289,7 +288,7 @@ namespace void ** pCallStack, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // pCallStack: [ret *], this, params // _this_ ptr is patched cppu_XInterfaceProxy object @@ -326,12 +325,10 @@ namespace } // determine called method - OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, - "### illegal vtable index!" ); + assert(nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex); sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, - "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -530,7 +527,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: @@ -566,7 +563,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; } default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx index e649e40d7d4b..675187cc1e97 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx @@ -25,8 +25,8 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> +#include <sal/log.hxx> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -59,7 +59,7 @@ namespace CPPU_CURRENT_NAMESPACE // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -159,7 +159,7 @@ namespace CPPU_CURRENT_NAMESPACE { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -178,7 +178,7 @@ namespace CPPU_CURRENT_NAMESPACE // be unnecessary and never reached for // Android. But see above... - // OSL_ASSERT (iFind2 != m_generatedRttis.end()); + // assert(iFind2 != m_generatedRttis.end()); // return NULL; #endif char const * rttiName = symName.getStr() +4; @@ -201,7 +201,7 @@ namespace CPPU_CURRENT_NAMESPACE pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -224,7 +224,7 @@ namespace CPPU_CURRENT_NAMESPACE typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -248,7 +248,7 @@ namespace CPPU_CURRENT_NAMESPACE // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -278,7 +278,7 @@ namespace CPPU_CURRENT_NAMESPACE } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -309,10 +309,7 @@ namespace CPPU_CURRENT_NAMESPACE RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message) return; } @@ -328,10 +325,7 @@ namespace CPPU_CURRENT_NAMESPACE RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message) } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx index 8789e9783be3..752137fbedc8 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx @@ -22,7 +22,6 @@ #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" -#include <osl/diagnose.h> #include <uno/data.h> #include <bridges/cpp_uno/shared/bridge.hxx> @@ -403,7 +402,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -431,7 +430,7 @@ static void cpp_call( INSERT_INT32( &pAdjustedThisPtr, nGPR, pGPR, pStack ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -613,7 +612,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( @@ -662,7 +661,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx index 48e2f756c534..95caf16f32b2 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx @@ -94,7 +94,7 @@ namespace nregs++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -385,7 +385,7 @@ namespace fprintf(stderr, "and %x %x\n", (long)(ovrflw[-12]), (long)(ovrflw[-13])); fprintf(stderr, "and %x %x\n", (long)(ovrflw[-14]), (long)(ovrflw[-15])); #endif - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // gpreg: [ret *], this, [other gpr params] // fpreg: [fpr params] @@ -431,12 +431,10 @@ namespace } // determine called method - OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, - "### illegal vtable index!" ); + assert(nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex); sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, - "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -668,7 +666,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: @@ -691,7 +689,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; } default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx index ff00f255cbb4..f982371c8a0a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx @@ -25,8 +25,8 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> +#include <sal/log.hxx> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -59,7 +59,7 @@ namespace CPPU_CURRENT_NAMESPACE // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -146,7 +146,7 @@ namespace CPPU_CURRENT_NAMESPACE { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -177,7 +177,7 @@ namespace CPPU_CURRENT_NAMESPACE pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -200,7 +200,7 @@ namespace CPPU_CURRENT_NAMESPACE typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -224,7 +224,7 @@ namespace CPPU_CURRENT_NAMESPACE // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -254,7 +254,7 @@ namespace CPPU_CURRENT_NAMESPACE } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -279,10 +279,7 @@ namespace CPPU_CURRENT_NAMESPACE RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -299,10 +296,7 @@ namespace CPPU_CURRENT_NAMESPACE OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx index 87db5262bbb0..3460b4f7b2ec 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx @@ -187,7 +187,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion bool bOverflow = false; @@ -213,7 +213,7 @@ static void cpp_call( INSERT_INT32( &pAdjustedThisPtr, nRegs, pGPR, pStack, bOverflow ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -390,7 +390,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( @@ -439,7 +439,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx index 94e502b82279..6efcd0687adf 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx @@ -93,7 +93,7 @@ static typelib_TypeClass cpp2uno_call( ng++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -308,7 +308,7 @@ static typelib_TypeClass cpp_mediate( void ** gpreg, void ** fpreg, long sp, long r8, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int64)==sizeof(void *), "### unexpected!"); sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32); sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF); @@ -372,7 +372,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "members are %d %d\n", nMemberPos, pTypeDescr->nAllMembers); @@ -630,7 +630,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -664,7 +664,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx index b745a703b92f..7495b64fa615 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx @@ -26,7 +26,6 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -58,7 +57,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -145,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -176,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -199,7 +198,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -216,7 +215,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); if (! pTypeDescr) terminate(); @@ -242,7 +240,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) terminate(); } @@ -252,14 +249,12 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) { - OSL_ENSURE( header, "### no exception header!!!" ); if (! header) terminate(); typelib_TypeDescription * pExcTypeDescr = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx index 041adfd92f90..eefe901dcd4d 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx @@ -315,7 +315,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx index 70452c7234e3..c3a3650bf667 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx @@ -20,7 +20,6 @@ #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" -#include <osl/diagnose.h> #include <uno/data.h> #include <typelib/typedescription.hxx> @@ -77,7 +76,7 @@ void cpp2uno_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -218,7 +217,7 @@ extern "C" void cpp_vtable_call( int nFunctionIndex, int nVtableOffset, void** pCallStack, void * pReturnValue ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // pCallStack: ret adr, [ret *], this, params void * pThis; @@ -254,7 +253,7 @@ extern "C" void cpp_vtable_call( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -417,7 +416,7 @@ unsigned char * codeSnippet( break; } unsigned char * p = code; - OSL_ASSERT(sizeof (sal_Int32) == 4); + assert(sizeof (sal_Int32) == 4); // mov function_index, %eax: *p++ = 0xB8; *reinterpret_cast< sal_Int32 * >(p) = functionIndex; @@ -431,7 +430,7 @@ unsigned char * codeSnippet( *reinterpret_cast< sal_Int32 * >(p) = ((unsigned char *) exec) - p - sizeof (sal_Int32) - writetoexecdiff; p += sizeof (sal_Int32); - OSL_ASSERT(p - code <= codeSnippetSize); + assert(p - code <= codeSnippetSize); return code + codeSnippetSize; } @@ -471,7 +470,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -501,7 +500,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx index d1d507168f67..47e570d41719 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx @@ -24,8 +24,8 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> +#include <sal/log.hxx> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -55,7 +55,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -205,7 +205,7 @@ static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -230,7 +230,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -260,7 +260,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -279,10 +279,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -298,10 +295,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx index fabcbc80ffaf..ed05bd043ab0 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx @@ -19,7 +19,6 @@ #include <sal/alloca.h> -#include <osl/diagnose.h> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -53,7 +52,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion bool bSimpleReturn = true; @@ -83,7 +82,7 @@ static void cpp_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -155,7 +154,7 @@ static void cpp_call( try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); CPPU_CURRENT_NAMESPACE::callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr, bSimpleReturn, diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx index 403ec52be813..f798735dbfa1 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx @@ -92,7 +92,7 @@ namespace pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), + static_assert( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); @@ -272,7 +272,7 @@ namespace fprintf(stderr, "and %x %x\n", pCallStack, pRegisterReturn); fprintf(stderr, "and %x %x\n", pCallStack[0], pCallStack[1]); #endif - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); void *pThis = pCallStack[0]; @@ -299,12 +299,10 @@ namespace } // determine called method - OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, - "### illegal vtable index!" ); + assert(nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex); sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, - "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -480,7 +478,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: @@ -508,7 +506,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; } default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx index 186fc96097a0..680c33a02761 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx @@ -25,7 +25,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -59,7 +59,7 @@ namespace CPPU_CURRENT_NAMESPACE // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -146,7 +146,7 @@ namespace CPPU_CURRENT_NAMESPACE { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -177,7 +177,7 @@ namespace CPPU_CURRENT_NAMESPACE pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -200,7 +200,7 @@ namespace CPPU_CURRENT_NAMESPACE typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -224,7 +224,7 @@ namespace CPPU_CURRENT_NAMESPACE // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -254,7 +254,7 @@ namespace CPPU_CURRENT_NAMESPACE } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -279,10 +279,7 @@ namespace CPPU_CURRENT_NAMESPACE RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -298,10 +295,7 @@ namespace CPPU_CURRENT_NAMESPACE RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx index 6652b5fe639e..6699e3cc6aca 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx @@ -165,7 +165,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -192,7 +192,7 @@ static void cpp_call( INSERT_INT32( &pAdjustedThisPtr, pStack ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -365,7 +365,7 @@ void unoInterfaceProxyDispatch( { // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); VtableSlot aVtableSlot( getVtableSlot( @@ -412,7 +412,7 @@ void unoInterfaceProxyDispatch( { // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); VtableSlot aVtableSlot( getVtableSlot( diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx index 3449ee3f0e76..68799e419d73 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx @@ -36,7 +36,6 @@ using namespace com::sun::star::uno; #ifdef BRDEBUG #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> using namespace ::std; using namespace ::osl; @@ -131,7 +130,7 @@ namespace nw++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -381,7 +380,7 @@ namespace void ** gpreg, void ** fpreg, void ** ovrflw, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); #ifdef BRDEBUG fprintf(stderr,"cpp_mediate1 gp=%p,fp=%p,ov=%p\n",gpreg,fpreg,ovrflw); @@ -435,7 +434,7 @@ namespace // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -653,8 +652,8 @@ namespace unsigned long * p = (unsigned long *) code; - // OSL_ASSERT( sizeof (long) == 4 ); - OSL_ASSERT((((unsigned long)code) & 0x3) == 0 ); //aligned to 4 otherwise a mistake + // static_assert( sizeof (long) == 4 ); + assert((((unsigned long)code) & 0x3) == 0 ); //aligned to 4 otherwise a mistake /* generate this code */ /* @@ -765,7 +764,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -798,7 +797,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx index f438f3222238..502d94d24b94 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/except.cxx @@ -24,7 +24,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -56,7 +56,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -143,7 +143,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -174,7 +174,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -197,7 +197,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -221,7 +221,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -251,7 +251,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -270,10 +270,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -289,10 +286,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx index abd8108f9b57..87ccfb4849aa 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx @@ -253,7 +253,7 @@ namespace // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - // OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + // assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -280,7 +280,7 @@ namespace *pPT++ = 'I'; // stack space - // OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + // static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -389,7 +389,7 @@ namespace try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx index 1f7a39b5d97e..b49cab4cf2a8 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx @@ -85,7 +85,7 @@ static typelib_TypeClass cpp2uno_call( ng++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -355,7 +355,7 @@ static typelib_TypeClass cpp_mediate( void ** gpreg, void ** fpreg, void ** ovrflw, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // gpreg: [ret *], this, [other gpr params] // fpreg: [fpr params] @@ -395,7 +395,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -586,8 +586,8 @@ unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex, sal unsigned long * p = (unsigned long *) code; - // OSL_ASSERT( sizeof (long) == 4 ); - OSL_ASSERT((((unsigned long)code) & 0x3) == 0 ); //aligned to 4 otherwise a mistake + // static_assert( sizeof (long) == 4 ); + assert((((unsigned long)code) & 0x3) == 0 ); //aligned to 4 otherwise a mistake /* generate this code */ // # so first save gpr 3 to gpr 10 (aligned to 4) @@ -740,7 +740,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -773,7 +773,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx index 2a362499ae63..fabab503508b 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx @@ -26,7 +26,6 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -58,7 +57,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -145,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -176,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -199,7 +198,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -217,7 +216,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) terminate(); @@ -243,7 +242,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) terminate(); } @@ -253,14 +251,12 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) { - OSL_ENSURE( header, "### no exception header!!!" ); if (! header) terminate(); typelib_TypeDescription * pExcTypeDescr = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx index e73f1f11bc5d..9a34b982ca86 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx @@ -344,7 +344,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - // OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + // assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -371,7 +371,7 @@ static void cpp_call( *pPT++ = 'I'; // stack space - // OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + // static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -479,7 +479,7 @@ static void cpp_call( try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)"); callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx index 5a5b05eda5bd..f982a938f0b6 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx @@ -92,7 +92,7 @@ static typelib_TypeClass cpp2uno_call( ng++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -337,7 +337,7 @@ static typelib_TypeClass cpp_mediate( void ** gpreg, void ** fpreg, long sp, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int64)==sizeof(void *), "### unexpected!"); sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32); sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF); @@ -402,7 +402,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "members are %d %d\n", nMemberPos, pTypeDescr->nAllMembers); @@ -704,7 +704,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -737,7 +737,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx index b745a703b92f..7495b64fa615 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx @@ -26,7 +26,6 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -58,7 +57,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -145,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -176,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -199,7 +198,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -216,7 +215,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); if (! pTypeDescr) terminate(); @@ -242,7 +240,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) terminate(); } @@ -252,14 +249,12 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) { - OSL_ENSURE( header, "### no exception header!!!" ); if (! header) terminate(); typelib_TypeDescription * pExcTypeDescr = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx index 61b67dda1fa2..01bb74abd3ea 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx @@ -311,7 +311,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx index 05e559f28fdd..343d15558566 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx @@ -82,7 +82,7 @@ static typelib_TypeClass cpp2uno_call( ng++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -314,7 +314,7 @@ static typelib_TypeClass cpp_mediate( void ** gpreg, void ** fpreg, void ** ovrflw, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); sal_Int16 nVtableOffset = (nOffsetAndIndex >> 16); sal_Int16 nFunctionIndex = (nOffsetAndIndex & 0xFFFF); @@ -360,7 +360,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!"); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -543,7 +543,7 @@ unsigned char* codeSnippet( unsigned char * code, sal_Int16 nFunctionIndex, sal_ if (! simple_ret_type) nOffsetAndIndex |= 0x8000; - OSL_ASSERT( sizeof (long) == 4 ); + static_assert( sizeof (long) == 4 ); /* generate this code */ // lr %r0,%r13 @@ -641,7 +641,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -674,7 +674,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx index b745a703b92f..ddf2c060a1e3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/except.cxx @@ -26,7 +26,6 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -58,7 +57,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -145,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -176,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -199,7 +198,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -216,7 +215,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) terminate(); @@ -242,7 +241,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) terminate(); } @@ -252,14 +250,12 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) { - OSL_ENSURE( header, "### no exception header!!!" ); if (! header) terminate(); typelib_TypeDescription * pExcTypeDescr = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx index bce4cb200eb3..ed0e6cffd99c 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx @@ -289,7 +289,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr, "### expected return type description!"); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -316,7 +316,7 @@ static void cpp_call( *pPT++ = 'I'; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -425,7 +425,7 @@ static void cpp_call( try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx index 323b9a8ba7e2..b21d4f9a25b7 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx @@ -82,7 +82,7 @@ static typelib_TypeClass cpp2uno_call( ng++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -316,7 +316,7 @@ static typelib_TypeClass cpp_mediate( void ** gpreg, void ** fpreg, void ** ovrflw, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int64)==sizeof(void *), "### unexpected!"); sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32); sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF); @@ -381,7 +381,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -604,7 +604,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -637,7 +637,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx index b745a703b92f..92faed480720 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx @@ -26,7 +26,6 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -58,7 +57,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -145,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert( insertion.second && "### inserting new rtti failed?!"); } else { @@ -176,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -199,7 +198,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -216,7 +215,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) terminate(); @@ -242,7 +241,6 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) terminate(); } @@ -252,14 +250,12 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) void fillUnoException( __cxa_exception * header, uno_Any * pExc, uno_Mapping * pCpp2Uno ) { - OSL_ENSURE( header, "### no exception header!!!" ); if (! header) terminate(); typelib_TypeDescription * pExcTypeDescr = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - OSL_ENSURE( pExcTypeDescr, "### can not get type description for exception!!!" ); if (! pExcTypeDescr) terminate(); diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx index f805f2850d24..45429d0e3b09 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx @@ -214,7 +214,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -239,7 +239,7 @@ static void cpp_call( INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx index 2b7820c65b4f..53d71f93a1fc 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx @@ -68,7 +68,7 @@ static typelib_TypeClass cpp2uno_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -96,7 +96,7 @@ static typelib_TypeClass cpp2uno_call( { if ((reinterpret_cast< long >(pCppStack) & 7) != 0) { - OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) ); + static_assert(sizeof (double) == sizeof (sal_Int64)); void * pDest = alloca( sizeof (sal_Int64) ); *reinterpret_cast< sal_Int32 * >(pDest) = *reinterpret_cast< sal_Int32 const * >(pCppStack); @@ -223,7 +223,7 @@ static typelib_TypeClass cpp_mediate( void ** pCallStack, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // pCallStack: this, params // eventual [ret*] lies at pCallStack -1 @@ -257,7 +257,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -442,7 +442,7 @@ unsigned char * codeSnippet( index |= 0x80000000; } unsigned int * p = reinterpret_cast< unsigned int * >(code); - OSL_ASSERT(sizeof (unsigned int) == 4); + static_assert(sizeof (unsigned int) == 4); // st %o0, [%sp+68]: *p++ = 0xD023A044; // st %o1, [%sp+72]: @@ -471,8 +471,7 @@ unsigned char * codeSnippet( *p++ = 0x81C2C000; // mov %sp, %o1: *p++ = 0x9210000E; - OSL_ASSERT( - reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize); + assert(reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize); return code + codeSnippetSize; } @@ -513,7 +512,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -545,7 +544,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx index 51ad964b9e46..7fc8974b5334 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx @@ -25,7 +25,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -57,7 +57,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -144,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second); } else { @@ -175,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second); } else // taking already generated rtti { @@ -198,7 +198,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -222,7 +222,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -252,7 +252,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti); if (! rtti) { throw RuntimeException( @@ -272,10 +272,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -291,10 +288,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx index 24be4a0a2315..0ac80dc26925 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx @@ -61,10 +61,10 @@ void callVirtualMethod( void * pAdjustedThisPtr, // parameter list is mixed list of * and values // reference parameters are pointers - OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" ); - OSL_ENSURE( (sizeof(void *) == 4) && + assert(pStackLongs && pAdjustedThisPtr); + static_assert( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); - OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" ); + assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !"); // never called if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something @@ -285,7 +285,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -312,7 +312,7 @@ static void cpp_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -336,7 +336,7 @@ static void cpp_call( case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: case typelib_TypeClass_DOUBLE: - OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) ); + static_assert(sizeof (double) == sizeof (sal_Int64)); *reinterpret_cast< sal_Int32 * >(pCppStack) = *reinterpret_cast< sal_Int32 const * >(pUnoArgs[ nPos ]); pCppStack += sizeof (sal_Int32); @@ -390,7 +390,7 @@ static void cpp_call( try { int nStackLongs = (pCppStack - pCppStackStart)/sizeof(sal_Int32); - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic" ); if( nStackLongs & 1 ) // stack has to be 8 byte aligned diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx index 2a6668684912..bdcc8183f56a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx @@ -54,7 +54,7 @@ #include "abi.hxx" -#include <osl/diagnose.h> +#include <sal/log.hxx> using namespace x86_64; @@ -244,10 +244,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c } default: -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "Unhandled case: pType->eTypeClass == %d", pTypeRef->eTypeClass ); -#endif - OSL_ASSERT(false); + SAL_WARN("bridges", "Unhandled case: pType->eTypeClass == " + << pTypeRef->eTypeClass); + assert(false); } return 0; /* Never reached. */ } @@ -287,10 +286,8 @@ bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool return false; break; default: -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "Unhandled case: classes[n] == %d", classes[n] ); -#endif - OSL_ASSERT(false); + SAL_WARN("bridges", "Unhandled case: classes[n] == " << classes[n]); + assert(false); } return true; } diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx index aa91f3f7ed21..1e1264356850 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx @@ -24,7 +24,6 @@ #include <rtl/alloc.h> #include <osl/mutex.hxx> -#include <osl/diagnose.h> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -121,7 +120,7 @@ static typelib_TypeClass cpp2uno_call( if ( !rParam.bOut && bridges::cpp_uno::shared::isSimpleType( rParam.pTypeRef ) ) // value { // Simple types must fit exactly one register on x86_64 - OSL_ASSERT( bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) ) ); + assert( bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) ) ); if ( nUsedSSE == 1 ) { @@ -296,7 +295,7 @@ typelib_TypeClass cpp_vtable_call( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!\n" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -485,7 +484,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( typelib_TypeDescription * pTD = 0; TYPELIB_DANGER_GET( &pTD, type->ppMembers[ nPos ] ); - OSL_ASSERT( pTD ); + assert(pTD); if ( typelib_TypeClass_INTERFACE_ATTRIBUTE == pTD->eTypeClass ) { @@ -514,7 +513,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( x86_64::return_in_hidden_param( pMethodTD->pReturnTypeRef ) ); } else - OSL_ASSERT( false ); + assert(false); TYPELIB_DANGER_RELEASE( pTD ); } diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx index 92df84bded44..7c0de0ff8135 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx @@ -22,7 +22,6 @@ #include <string.h> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> #include <sal/log.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -51,7 +50,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -86,7 +85,7 @@ static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -111,7 +110,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -127,7 +126,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // avoiding locked counts rtti = x86_64::getRtti(*pTypeDescr); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -146,10 +145,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -165,10 +161,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx index c0da72837aa2..8f59f9fe2bda 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx @@ -24,7 +24,6 @@ #include "rtl/alloc.h" #include "rtl/ustrbuf.hxx" -#include <osl/diagnose.h> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -113,7 +112,7 @@ static void cpp_call( // Return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion (see below) @@ -328,7 +327,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( @@ -377,7 +376,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx index 2a6668684912..bdcc8183f56a 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx @@ -54,7 +54,7 @@ #include "abi.hxx" -#include <osl/diagnose.h> +#include <sal/log.hxx> using namespace x86_64; @@ -244,10 +244,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c } default: -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "Unhandled case: pType->eTypeClass == %d", pTypeRef->eTypeClass ); -#endif - OSL_ASSERT(false); + SAL_WARN("bridges", "Unhandled case: pType->eTypeClass == " + << pTypeRef->eTypeClass); + assert(false); } return 0; /* Never reached. */ } @@ -287,10 +286,8 @@ bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool return false; break; default: -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "Unhandled case: classes[n] == %d", classes[n] ); -#endif - OSL_ASSERT(false); + SAL_WARN("bridges", "Unhandled case: classes[n] == " << classes[n]); + assert(false); } return true; } diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx index a299fc5b2eb9..5ba5c1ff3c11 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx @@ -24,7 +24,6 @@ #include <rtl/alloc.h> #include <osl/mutex.hxx> -#include <osl/diagnose.h> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -118,7 +117,7 @@ static typelib_TypeClass cpp2uno_call( if ( !rParam.bOut && bridges::cpp_uno::shared::isSimpleType( rParam.pTypeRef ) ) // value { // Simple types must fit exactly one register on x86_64 - OSL_ASSERT( bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) ) ); + assert(bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) )); if ( nUsedSSE == 1 ) { @@ -292,7 +291,7 @@ typelib_TypeClass cpp_vtable_call( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!\n" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -471,7 +470,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( typelib_TypeDescription * pTD = 0; TYPELIB_DANGER_GET( &pTD, type->ppMembers[ nPos ] ); - OSL_ASSERT( pTD ); + assert(pTD); if ( typelib_TypeClass_INTERFACE_ATTRIBUTE == pTD->eTypeClass ) { @@ -500,7 +499,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( x86_64::return_in_hidden_param( pMethodTD->pReturnTypeRef ) ); } else - OSL_ASSERT( false ); + assert(false); TYPELIB_DANGER_RELEASE( pTD ); } diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx index 56f9bac9f808..a912da2761cb 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx @@ -31,7 +31,7 @@ #include "boost/unordered_map.hpp" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/genfunc.hxx" -#include "osl/diagnose.h" +#include <sal/log.hxx> #include "osl/mutex.hxx" #include "rtl/strbuf.hxx" #include "rtl/ustrbuf.hxx" @@ -114,7 +114,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -260,7 +260,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -284,7 +284,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -314,7 +314,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -333,10 +333,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -352,10 +349,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx index fd8eab4d9e2f..7a9654c611ce 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx @@ -24,7 +24,6 @@ #include "rtl/alloc.h" #include "rtl/ustrbuf.hxx" -#include <osl/diagnose.h> #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" @@ -113,7 +112,7 @@ static void cpp_call( // Return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion (see below) @@ -320,7 +319,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( @@ -369,7 +368,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx index 87fa906f8fbb..4ad28d290939 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx @@ -78,7 +78,7 @@ static typelib_TypeClass cpp2uno_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -224,7 +224,7 @@ static typelib_TypeClass cpp_mediate( void ** pCallStack, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // pCallStack: ret adr, [ret *], this, params void * pThis; @@ -260,7 +260,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -407,7 +407,7 @@ unsigned char * codeSnippet( functionIndex |= 0x80000000; } unsigned char * p = code; - OSL_ASSERT(sizeof (sal_Int32) == 4); + static_assert(sizeof (sal_Int32) == 4); // mov function_index, %eax: *p++ = 0xB8; *reinterpret_cast< sal_Int32 * >(p) = functionIndex; @@ -424,7 +424,7 @@ unsigned char * codeSnippet( *reinterpret_cast< sal_Int32 * >(p) = ((unsigned char *) cpp_vtable_call) - p - sizeof (sal_Int32); p += sizeof (sal_Int32); - OSL_ASSERT(p - code <= codeSnippetSize); + assert(p - code <= codeSnippetSize); return code + codeSnippetSize; } @@ -465,7 +465,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -497,7 +497,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx index 5954197592ca..153e0c31201d 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx @@ -26,7 +26,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -59,7 +59,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -146,7 +146,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -177,7 +177,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -200,7 +200,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -224,7 +224,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -254,7 +254,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti); if (! rtti) { throw RuntimeException( @@ -273,10 +273,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -292,10 +289,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx index 709407c7602e..51c4eec2b179 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx @@ -48,9 +48,9 @@ static void __attribute__((noinline)) callVirtualMethod( // parameter list is mixed list of * and values // reference parameters are pointers - OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" ); - OSL_ENSURE( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); - OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" ); + assert(pStackLongs && pAdjustedThisPtr); + static_assert((sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!"); + assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !"); // never called if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something @@ -136,7 +136,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -164,7 +164,7 @@ static void cpp_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -233,7 +233,7 @@ static void cpp_call( try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)"); callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr->eTypeClass, diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx index 29ae1b5fdbe7..ce76c24f6fb6 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx @@ -69,7 +69,7 @@ static typelib_TypeClass cpp2uno_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -97,7 +97,7 @@ static typelib_TypeClass cpp2uno_call( { if ((reinterpret_cast< long >(pCppStack) & 7) != 0) { - OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) ); + static_assert(sizeof (double) == sizeof (sal_Int64)); void * pDest = alloca( sizeof (sal_Int64) ); *reinterpret_cast< sal_Int32 * >(pDest) = *reinterpret_cast< sal_Int32 const * >(pCppStack); @@ -222,7 +222,7 @@ static typelib_TypeClass cpp_mediate( void ** pCallStack, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); // pCallStack: this, params // eventual [ret*] lies at pCallStack -1 @@ -256,7 +256,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -440,7 +440,7 @@ unsigned char * codeSnippet( index |= 0x80000000; } unsigned int * p = reinterpret_cast< unsigned int * >(code); - OSL_ASSERT(sizeof (unsigned int) == 4); + static_assert(sizeof (unsigned int) == 4); // st %o0, [%sp+68]: *p++ = 0xD023A044; // st %o1, [%sp+72]: @@ -469,8 +469,7 @@ unsigned char * codeSnippet( *p++ = 0x81C2C000; // mov %sp, %o1: *p++ = 0x9210000E; - OSL_ASSERT( - reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize); + assert(reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize); return code + codeSnippetSize; } @@ -511,7 +510,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -543,7 +542,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx index 6c45f82bcaa6..0973b463ca28 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx @@ -24,7 +24,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -56,7 +56,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -143,7 +143,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -174,7 +174,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -197,7 +197,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -221,7 +221,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -251,7 +251,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -270,10 +270,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -289,10 +286,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx index 6482e46264ee..9f02aeb77495 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx @@ -59,10 +59,10 @@ void callVirtualMethod( void * pAdjustedThisPtr, // parameter list is mixed list of * and values // reference parameters are pointers - OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" ); - OSL_ENSURE( (sizeof(void *) == 4) && + assert( pStackLongs && pAdjustedThisPtr); + static_assert( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); - OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" ); + assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !"); // never called if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something @@ -280,7 +280,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -307,7 +307,7 @@ static void cpp_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -331,7 +331,7 @@ static void cpp_call( case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: case typelib_TypeClass_DOUBLE: - OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) ); + static_assert(sizeof (double) == sizeof (sal_Int64)); *reinterpret_cast< sal_Int32 * >(pCppStack) = *reinterpret_cast< sal_Int32 const * >(pUnoArgs[ nPos ]); pCppStack += sizeof (sal_Int32); @@ -385,7 +385,7 @@ static void cpp_call( try { int nStackLongs = (pCppStack - pCppStackStart)/sizeof(sal_Int32); - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic"); if( nStackLongs & 1 ) // stack has to be 8 byte aligned diff --git a/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx b/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx index ef86ad79e722..9b826bfc4abb 100644 --- a/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx +++ b/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx @@ -20,7 +20,6 @@ #include "sal/config.h" #include "cppu/macros.hxx" -#include "osl/diagnose.h" #include "sal/types.h" #include "typelib/typeclass.h" #include "typelib/typedescription.h" @@ -49,9 +48,9 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod( // parameter list is mixed list of * and values // reference parameters are pointers - OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" ); - OSL_ENSURE( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); - OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" ); + assert(pStackLongs && pAdjustedThisPtr); + static_assert( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!"); + assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !"); // never called if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something diff --git a/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx b/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx index d7910e6028b0..740330fb254f 100644 --- a/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx @@ -82,7 +82,7 @@ void cpp2uno_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -224,7 +224,7 @@ extern "C" void cpp_vtable_call( int nFunctionIndex, int nVtableOffset, void** pCallStack, void * pReturnValue ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // pCallStack: ret adr, [ret *], this, params void * pThis; @@ -260,7 +260,7 @@ extern "C" void cpp_vtable_call( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -406,7 +406,7 @@ unsigned char * codeSnippet( if (returnType) TYPELIB_DANGER_RELEASE( returnTypeDescr ); unsigned char * p = code; - OSL_ASSERT(sizeof (sal_Int32) == 4); + static_assert(sizeof (sal_Int32) == 4); // mov function_index, %eax: *p++ = 0xB8; *reinterpret_cast< sal_Int32 * >(p) = functionIndex; @@ -420,7 +420,7 @@ unsigned char * codeSnippet( *reinterpret_cast< sal_Int32 * >(p) = ((unsigned char *) exec) - p - sizeof (sal_Int32); p += sizeof (sal_Int32); - OSL_ASSERT(p - code <= codeSnippetSize); + assert(p - code <= codeSnippetSize); return code + codeSnippetSize; } @@ -461,7 +461,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -491,7 +491,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/mingw_intel/except.cxx b/bridges/source/cpp_uno/mingw_intel/except.cxx index 3a9f6e1b426e..af50e5ca59f2 100644 --- a/bridges/source/cpp_uno/mingw_intel/except.cxx +++ b/bridges/source/cpp_uno/mingw_intel/except.cxx @@ -30,7 +30,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -63,7 +63,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -167,7 +167,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -190,7 +190,7 @@ static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -215,7 +215,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -245,7 +245,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -264,10 +264,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -283,10 +280,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx b/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx index ce06f4a43420..573d51ee5d68 100644 --- a/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx @@ -56,7 +56,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -91,7 +91,7 @@ static void cpp_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args #ifdef BROKEN_ALLOCA void ** pCppArgs = (void **)malloc( 3 * sizeof(void *) * nParams ); @@ -175,7 +175,7 @@ static void cpp_call( try { - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); CPPU_CURRENT_NAMESPACE::callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr, diff --git a/bridges/source/cpp_uno/mingw_x86-64/abi.cxx b/bridges/source/cpp_uno/mingw_x86-64/abi.cxx index 06e33de2913a..aaf657f2de22 100644 --- a/bridges/source/cpp_uno/mingw_x86-64/abi.cxx +++ b/bridges/source/cpp_uno/mingw_x86-64/abi.cxx @@ -54,6 +54,8 @@ #include "abi.hxx" +#include <sal/log.hxx> + using namespace x86_64; /* Register class used for passing given 64bit part of the argument. @@ -242,10 +244,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c } default: -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "Unhandled case: pType->eTypeClass == %d", pTypeRef->eTypeClass ); -#endif - OSL_ASSERT(0); + SAL_WARN("bridges", "Unhandled case: pType->eTypeClass == " + << pTypeRef->eTypeClass); + assert(false); } return 0; /* Never reached. */ } @@ -285,10 +286,8 @@ bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool return false; break; default: -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "Unhandled case: classes[n] == %d", classes[n] ); -#endif - OSL_ASSERT(0); + SAL_WARN("bridges", "Unhandled case: classes[n] == " << classes[n]); + assert(false); } return true; } diff --git a/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx index 027a00350dff..b18c614353de 100644 --- a/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx @@ -116,7 +116,7 @@ static typelib_TypeClass cpp2uno_call( if ( !rParam.bOut && bridges::cpp_uno::shared::isSimpleType( rParam.pTypeRef ) ) // value { // Simple types must fit exactly one register on x86_64 - OSL_ASSERT( bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) ) ); + assert( bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) ) ); if ( nUsedSSE == 1 ) { @@ -291,7 +291,7 @@ extern "C" typelib_TypeClass cpp_vtable_call( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!\n" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -468,7 +468,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( typelib_TypeDescription * pTD = 0; TYPELIB_DANGER_GET( &pTD, type->ppMembers[ nPos ] ); - OSL_ASSERT( pTD ); + assert(pTD); if ( typelib_TypeClass_INTERFACE_ATTRIBUTE == pTD->eTypeClass ) { @@ -497,7 +497,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( x86_64::return_in_hidden_param( pMethodTD->pReturnTypeRef ) ); } else - OSL_ASSERT( false ); + assert(false); TYPELIB_DANGER_RELEASE( pTD ); } diff --git a/bridges/source/cpp_uno/mingw_x86-64/except.cxx b/bridges/source/cpp_uno/mingw_x86-64/except.cxx index 3a9f6e1b426e..af50e5ca59f2 100644 --- a/bridges/source/cpp_uno/mingw_x86-64/except.cxx +++ b/bridges/source/cpp_uno/mingw_x86-64/except.cxx @@ -30,7 +30,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -63,7 +63,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -167,7 +167,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -190,7 +190,7 @@ static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -215,7 +215,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -245,7 +245,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -264,10 +264,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -283,10 +280,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/mingw_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/mingw_x86-64/uno2cpp.cxx index f5b4d0e211e3..d437817b3743 100644 --- a/bridges/source/cpp_uno/mingw_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/mingw_x86-64/uno2cpp.cxx @@ -111,7 +111,7 @@ static void cpp_call( // Return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion (see below) @@ -317,7 +317,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( @@ -366,7 +366,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert( nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( diff --git a/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx index 48a865019faf..92a003a775d1 100644 --- a/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx @@ -20,7 +20,6 @@ #include <malloc.h> -#include <osl/diagnose.h> #include <com/sun/star/uno/genfunc.hxx> #include <uno/data.h> #include <typelib/typedescription.hxx> @@ -77,7 +76,7 @@ static inline typelib_TypeClass cpp2uno_call( } // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -232,7 +231,7 @@ static typelib_TypeClass __cdecl cpp_mediate( void ** pCallStack, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // pCallStack: ret adr, this, [ret *], params void * pThis = static_cast< char * >(pCallStack[1]) - nVtableOffset; @@ -257,7 +256,7 @@ static typelib_TypeClass __cdecl cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -403,7 +402,7 @@ unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex, sal_Int32 vtableOffset) { unsigned char * p = code; - OSL_ASSERT(sizeof (sal_Int32) == 4); + static_assert(sizeof (sal_Int32) == 4); // mov eax, functionIndex: *p++ = 0xB8; *reinterpret_cast< sal_Int32 * >(p) = functionIndex; @@ -417,7 +416,7 @@ unsigned char * codeSnippet( *reinterpret_cast< sal_Int32 * >(p) = ((unsigned char *) cpp_vtable_call) - p - sizeof (sal_Int32); p += sizeof (sal_Int32); - OSL_ASSERT(p - code <= codeSnippetSize); + assert(p - code <= codeSnippetSize); return code + codeSnippetSize; } diff --git a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx index 27c8ef6f4157..57415cde2af2 100644 --- a/bridges/source/cpp_uno/msvc_win32_intel/except.cxx +++ b/bridges/source/cpp_uno/msvc_win32_intel/except.cxx @@ -28,7 +28,7 @@ #include "rtl/alloc.h" #include "rtl/strbuf.hxx" #include "rtl/ustrbuf.hxx" -#include <osl/diagnose.h> +#include <sal/log.hxx> #include "com/sun/star/uno/Any.hxx" @@ -122,7 +122,7 @@ __type_info::~__type_info() throw () type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw () { // a must be - OSL_ENSURE( sizeof(__type_info) == sizeof(type_info), "### type info structure size differ!" ); + static_assert(sizeof(__type_info) == sizeof(type_info), "### type info structure size differ!"); MutexGuard aGuard( _aMutex ); t_string2PtrMap::const_iterator const iFind( _allRTTI.find( rUNOname ) ); @@ -138,7 +138,7 @@ type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw () // put into map pair< t_string2PtrMap::iterator, bool > insertion( _allRTTI.insert( t_string2PtrMap::value_type( rUNOname, pRTTI ) ) ); - OSL_ENSURE( insertion.second, "### rtti insertion failed?!" ); + assert(insertion.second && "### rtti insertion failed?!"); return (type_info *)pRTTI; } @@ -154,9 +154,7 @@ RTTInfos::RTTInfos() throw () RTTInfos::~RTTInfos() throw () { -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "> freeing generated RTTI infos... <" ); -#endif + SAL_INFO("bridges", "> freeing generated RTTI infos... <"); MutexGuard aGuard( _aMutex ); for ( t_string2PtrMap::const_iterator iPos( _allRTTI.begin() ); @@ -194,7 +192,7 @@ inline void * ObjectFunction::operator new ( size_t nSize ) BOOL success = #endif VirtualProtect( pMem, nSize, PAGE_EXECUTE_READWRITE, &old_protect ); - OSL_ENSURE( success, "VirtualProtect() failed!" ); + assert(success && "VirtualProtect() failed!"); } return pMem; } @@ -212,7 +210,7 @@ ObjectFunction::ObjectFunction( typelib_TypeDescription * pTypeDescr, void * fpF unsigned char * pCode = (unsigned char *)somecode; // a must be! - OSL_ENSURE( (void *)this == (void *)pCode, "### unexpected!" ); + assert((void *)this == (void *)pCode); // push ObjectFunction this *pCode++ = 0x68; @@ -310,7 +308,7 @@ RaiseInfo::RaiseInfo( typelib_TypeDescription * pTypeDescr ) throw () , _n4( 0 ) { // a must be - OSL_ENSURE( sizeof(sal_Int32) == sizeof(ExceptionType *), "### pointer size differs from sal_Int32!" ); + static_assert(sizeof(sal_Int32) == sizeof(ExceptionType *), "### pointer size differs from sal_Int32!"); typelib_CompoundTypeDescription * pCompTypeDescr; @@ -366,9 +364,7 @@ ExceptionInfos::ExceptionInfos() throw () ExceptionInfos::~ExceptionInfos() throw () { -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "> freeing exception infos... <" ); -#endif + SAL_INFO("bridges", "> freeing exception infos... <"); MutexGuard aGuard( _aMutex ); for ( t_string2PtrMap::const_iterator iPos( _allRaiseInfos.begin() ); @@ -395,7 +391,7 @@ void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) thro } } - OSL_ASSERT( pTypeDescr && + assert( pTypeDescr && (pTypeDescr->eTypeClass == typelib_TypeClass_STRUCT || pTypeDescr->eTypeClass == typelib_TypeClass_EXCEPTION) ); @@ -411,7 +407,7 @@ void * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTypeDescr ) thro // put into map pair< t_string2PtrMap::iterator, bool > insertion( s_pInfos->_allRaiseInfos.insert( t_string2PtrMap::value_type( rTypeName, pRaiseInfo ) ) ); - OSL_ENSURE( insertion.second, "### raise info insertion failed?!" ); + assert(insertion.second && "### raise info insertion failed?!"); } else { @@ -459,8 +455,7 @@ void msci_raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp ); // a must be - OSL_ENSURE( - sizeof(sal_Int32) == sizeof(void *), + static_assert(sizeof(sal_Int32) == sizeof(void *), "### pointer size differs from sal_Int32!" ); DWORD arFilterArgs[3]; arFilterArgs[0] = MSVC_magic_number; @@ -486,7 +481,7 @@ int msci_filterCppException( return EXCEPTION_CONTINUE_SEARCH; bool rethrow = __CxxDetectRethrow( &pRecord ); - OSL_ASSERT( pRecord == pPointers->ExceptionRecord ); + assert(pRecord == pPointers->ExceptionRecord); if (rethrow && pRecord == pPointers->ExceptionRecord) { diff --git a/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx b/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx index a7cf474c8947..c99e51cbd734 100644 --- a/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx @@ -22,7 +22,6 @@ #include <com/sun/star/uno/genfunc.hxx> #include <uno/data.h> -#include <osl/diagnose.h> #include "bridges/cpp_uno/shared/bridge.hxx" #include "bridges/cpp_uno/shared/types.hxx" @@ -44,8 +43,8 @@ inline static void callVirtualMethod( // parameter list is mixed list of * and values // reference parameters are pointers - OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" ); - OSL_ENSURE( (sizeof(void *) == 4) && + assert(pStackLongs && pAdjustedThisPtr); + static_assert( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); __asm @@ -149,7 +148,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -173,7 +172,7 @@ static void cpp_call( // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32)); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx index e4fe5be4bf48..abea68db423c 100644 --- a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx @@ -255,7 +255,7 @@ extern "C" typelib_TypeClass cpp_vtable_call( // Determine called method int nMemberPos = pTD->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTD->nAllMembers, "### illegal member index!\n" ); + assert(nMemberPos < pTD->nAllMembers); TypeDescription aMemberDescr( pTD->ppAllMembers[nMemberPos] ); @@ -433,7 +433,7 @@ unsigned char * codeSnippet( // jmp r11 *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3; - OSL_ASSERT( p < code + codeSnippetSize ); + assert(p < code + codeSnippetSize); return code + codeSnippetSize; } @@ -491,7 +491,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( typelib_TypeDescription * pTD = NULL; TYPELIB_DANGER_GET( &pTD, type->ppMembers[ member ] ); - OSL_ASSERT( pTD ); + assert(pTD); char param_kind[4]; int nr = 0; @@ -515,7 +515,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( { typelib_TypeDescription * pAttrTD = NULL; TYPELIB_DANGER_GET( &pAttrTD, pIfaceAttrTD->pAttributeTypeRef ); - OSL_ASSERT( pAttrTD ); + assert(pAttrTD); // Setter if ( pAttrTD->eTypeClass == typelib_TypeClass_FLOAT || @@ -535,7 +535,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( typelib_TypeDescription * pReturnTD = NULL; TYPELIB_DANGER_GET( &pReturnTD, pMethodTD->pReturnTypeRef ); - OSL_ASSERT( pReturnTD ); + assert(pReturnTD); if ( !bridges::cpp_uno::shared::isSimpleType( pReturnTD ) ) { @@ -548,7 +548,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( typelib_TypeDescription * pParamTD = NULL; TYPELIB_DANGER_GET( &pParamTD, pMethodTD->pParams[param].pTypeRef ); - OSL_ASSERT( pParamTD ); + assert(pParamTD); if ( pParamTD->eTypeClass == typelib_TypeClass_FLOAT || pParamTD->eTypeClass == typelib_TypeClass_DOUBLE ) @@ -562,7 +562,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( TYPELIB_DANGER_RELEASE( pReturnTD ); } else - OSL_ASSERT( false ); + assert(false); TYPELIB_DANGER_RELEASE( pTD ); } diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx index 90147a7dd858..a1c27c6948b5 100644 --- a/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx +++ b/bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx @@ -245,6 +245,7 @@ void #include "rtl/alloc.h" #include "rtl/strbuf.hxx" #include "rtl/ustrbuf.hxx" +#include <sal/log.hxx> #include "com/sun/star/uno/Any.hxx" @@ -339,7 +340,7 @@ __type_info::~__type_info() throw () type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw () { // a must be - OSL_ENSURE( sizeof(__type_info) == sizeof(type_info), "### type info structure size differ!" ); + static_assert(sizeof(__type_info) == sizeof(type_info), "### type info structure size differ!"); MutexGuard aGuard( _aMutex ); t_string2PtrMap::const_iterator const iFind( _allRTTI.find( rUNOname ) ); @@ -355,7 +356,7 @@ type_info * RTTInfos::getRTTI( OUString const & rUNOname ) throw () // put into map pair< t_string2PtrMap::iterator, bool > insertion( _allRTTI.insert( t_string2PtrMap::value_type( rUNOname, pRTTI ) ) ); - OSL_ENSURE( insertion.second, "### rtti insertion failed?!" ); + assert(insertion.second && "### rtti insertion failed?!"); return (type_info *)pRTTI; } @@ -371,9 +372,7 @@ RTTInfos::RTTInfos() throw () RTTInfos::~RTTInfos() throw () { -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "> freeing generated RTTI infos... <" ); -#endif + SAL_INFO("bridges", "> freeing generated RTTI infos... <"); MutexGuard aGuard( _aMutex ); for ( t_string2PtrMap::const_iterator iPos( _allRTTI.begin() ); @@ -421,7 +420,7 @@ void GenerateConstructorTrampoline( // jmp r11 *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3; - OSL_ASSERT( p < code + codeSnippetSize ); + assert( p < code + codeSnippetSize ); } void GenerateDestructorTrampoline( @@ -441,7 +440,7 @@ void GenerateDestructorTrampoline( // jmp r11 *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3; - OSL_ASSERT( p < code + codeSnippetSize ); + assert( p < code + codeSnippetSize ); } // This looks like it is the struct catchabletype above @@ -541,7 +540,7 @@ RaiseInfo::RaiseInfo( typelib_TypeDescription * pTD )throw () BOOL success = #endif VirtualProtect( pCode, codeSize, PAGE_EXECUTE_READWRITE, &old_protect ); - OSL_ENSURE( success, "VirtualProtect() failed!" ); + assert(success && "VirtualProtect() failed!"); ::typelib_typedescription_acquire( pTD ); @@ -587,9 +586,7 @@ ExceptionInfos::ExceptionInfos() throw () ExceptionInfos::~ExceptionInfos() throw () { -#if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "> freeing exception infos... <" ); -#endif + SAL_INFO("bridges", "> freeing exception infos... <"); MutexGuard aGuard( _aMutex ); for ( t_string2PtrMap::const_iterator iPos( _allRaiseInfos.begin() ); @@ -620,7 +617,7 @@ RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw } } - OSL_ASSERT( pTD && + assert( pTD && (pTD->eTypeClass == typelib_TypeClass_STRUCT || pTD->eTypeClass == typelib_TypeClass_EXCEPTION) ); @@ -637,7 +634,7 @@ RaiseInfo * ExceptionInfos::getRaiseInfo( typelib_TypeDescription * pTD ) throw // Put into map pair< t_string2PtrMap::iterator, bool > insertion( s_pInfos->_allRaiseInfos.insert( t_string2PtrMap::value_type( rTypeName, (void *)pRaiseInfo ) ) ); - OSL_ENSURE( insertion.second, "### raise info insertion failed?!" ); + assert(insertion.second && "### raise info insertion failed?!"); } else { @@ -712,7 +709,7 @@ int mscx_filterCppException( return EXCEPTION_CONTINUE_SEARCH; bool rethrow = __CxxDetectRethrow( &pRecord ); - OSL_ASSERT( pRecord == pPointers->ExceptionRecord ); + assert(pRecord == pPointers->ExceptionRecord); if (rethrow && pRecord == pPointers->ExceptionRecord) { diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx index 7937e649d98b..6befd6313941 100644 --- a/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx @@ -71,7 +71,7 @@ static bool cpp_call( // Return type typelib_TypeDescription * pReturnTD = NULL; TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef ); - OSL_ENSURE( pReturnTD, "### expected return type description!" ); + assert(pReturnTD); // 'this' void * pAdjustedThisPtr = (void **)( pThis->getCppI() ) + aVtableSlot.offset; @@ -309,7 +309,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberTD)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( @@ -356,7 +356,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberTD)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( getVtableSlot( diff --git a/bridges/source/cpp_uno/shared/bridge.cxx b/bridges/source/cpp_uno/shared/bridge.cxx index 0d3116721261..170484a503f2 100644 --- a/bridges/source/cpp_uno/shared/bridge.cxx +++ b/bridges/source/cpp_uno/shared/bridge.cxx @@ -24,7 +24,6 @@ #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "osl/interlck.h" #include "rtl/ustring.h" #include "sal/types.h" @@ -54,7 +53,7 @@ void cpp2unoMapping( uno_Mapping * pMapping, void ** ppUnoI, void * pCppI, typelib_InterfaceTypeDescription * pTypeDescr) { - OSL_ENSURE( ppUnoI && pTypeDescr, "### null ptr!" ); + assert(ppUnoI && pTypeDescr); if (*ppUnoI) { (*reinterpret_cast< uno_Interface * >( *ppUnoI )->release)( @@ -69,7 +68,7 @@ void cpp2unoMapping( rtl_uString * pOId = 0; (*pBridge->pCppEnv->getObjectIdentifier)( pBridge->pCppEnv, &pOId, pCppI ); - OSL_ASSERT( pOId ); + assert(pOId); // try to get any known interface from target environment (*pBridge->pUnoEnv->getRegisteredInterface)( @@ -100,7 +99,7 @@ void uno2cppMapping( uno_Mapping * pMapping, void ** ppCppI, void * pUnoI, typelib_InterfaceTypeDescription * pTypeDescr) { - OSL_ASSERT( ppCppI && pTypeDescr ); + assert(ppCppI && pTypeDescr); if (*ppCppI) { static_cast< ::com::sun::star::uno::XInterface * >( *ppCppI )-> @@ -115,7 +114,7 @@ void uno2cppMapping( rtl_uString * pOId = 0; (*pBridge->pUnoEnv->getObjectIdentifier)( pBridge->pUnoEnv, &pOId, pUnoI ); - OSL_ASSERT( pOId ); + assert(pOId); // try to get any known interface from target environment (*pBridge->pCppEnv->getRegisteredInterface)( diff --git a/bridges/source/cpp_uno/shared/component.cxx b/bridges/source/cpp_uno/shared/component.cxx index d157b0fda12c..3f4d39f9d7f2 100644 --- a/bridges/source/cpp_uno/shared/component.cxx +++ b/bridges/source/cpp_uno/shared/component.cxx @@ -22,13 +22,13 @@ #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "osl/mutex.hxx" #include "osl/time.h" #include "rtl/process.h" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.h" #include "rtl/ustring.hxx" +#include <sal/log.hxx> #include "sal/types.h" #include "uno/environment.h" #include "uno/lbnames.h" @@ -87,7 +87,7 @@ static void s_stub_computeObjectIdentifier(va_list * pParam) void * pInterface = va_arg(*pParam, void *); - OSL_ENSURE( pEnv && ppOId && pInterface, "### null ptr!" ); + assert(pEnv && ppOId && pInterface); if (pEnv && ppOId && pInterface) { if (*ppOId) @@ -103,7 +103,7 @@ static void s_stub_computeObjectIdentifier(va_list * pParam) reinterpret_cast< ::com::sun::star::uno::XInterface * >( pInterface ), ::com::sun::star::uno::UNO_QUERY ); - OSL_ENSURE( xHome.is(), "### query to XInterface failed!" ); + assert(xHome.is() && "### query to XInterface failed!"); if (xHome.is()) { // interface @@ -125,10 +125,11 @@ static void s_stub_computeObjectIdentifier(va_list * pParam) ::rtl_uString_acquire( *ppOId = aRet.pData ); } } - catch (const ::com::sun::star::uno::RuntimeException &) + catch (const ::com::sun::star::uno::RuntimeException & e) { - OSL_FAIL( - "### RuntimeException occurred during queryInterface()!" ); + SAL_WARN("bridges", + "### RuntimeException occurred during queryInterface(): " + << e.Message); } } } @@ -177,12 +178,12 @@ static void SAL_CALL environmentDisposing( SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment(uno_Environment * pCppEnv) SAL_THROW_EXTERN_C() { - OSL_ENSURE( pCppEnv->pExtEnv, "### expected extended environment!" ); - OSL_ENSURE( + assert(pCppEnv->pExtEnv); + assert( ::rtl_ustr_ascii_compare_WithLength( pCppEnv->pTypeName->buffer, rtl_str_getLength(CPPU_CURRENT_LANGUAGE_BINDING_NAME), CPPU_CURRENT_LANGUAGE_BINDING_NAME ) - == 0, - "### wrong environment type!" ); + == 0 + && "### wrong environment type!"); ((uno_ExtEnvironment *)pCppEnv)->computeObjectIdentifier = computeObjectIdentifier; ((uno_ExtEnvironment *)pCppEnv)->acquireInterface = acquireInterface; @@ -198,7 +199,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo) SAL_THROW_EXTERN_C() { - OSL_ASSERT( ppMapping && pFrom && pTo ); + assert(ppMapping && pFrom && pTo); if (ppMapping && pFrom && pTo && pFrom->pExtEnv && pTo->pExtEnv) { uno_Mapping * pMapping = 0; diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx index b2d17fd705d7..c692b33d4f9e 100644 --- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx @@ -25,7 +25,6 @@ #include "bridges/cpp_uno/shared/vtablefactory.hxx" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "osl/getglobalmutex.hxx" #include "osl/interlck.h" #include "osl/mutex.hxx" @@ -80,7 +79,7 @@ void freeCppInterfaceProxy(uno_ExtEnvironment * pEnv, void * pInterface) CppInterfaceProxy * pThis = CppInterfaceProxy::castInterfaceToProxy( pInterface); if (pEnv != pThis->pBridge->getCppEnv()) { - OSL_ASSERT(false); + assert(false); } (*pThis->pBridge->getUnoEnv()->revokeInterface)( @@ -129,7 +128,7 @@ void CppInterfaceProxy::acquireProxy() (*pBridge->getCppEnv()->registerProxyInterface)( pBridge->getCppEnv(), &pThis, freeCppInterfaceProxy, oid.pData, pTypeDescr ); - OSL_ASSERT( pThis == castProxyToInterface( this ) ); + assert(pThis == castProxyToInterface(this)); } } diff --git a/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx b/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx index 43d6c4e83ec8..ab868df96a80 100644 --- a/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx @@ -22,7 +22,6 @@ #include "bridges/cpp_uno/shared/bridge.hxx" #include "com/sun/star/uno/XInterface.hpp" -#include "osl/diagnose.h" #include "osl/interlck.h" #include "typelib/typedescription.h" #include "uno/dispatcher.h" @@ -35,7 +34,7 @@ void freeUnoInterfaceProxy(uno_ExtEnvironment * pEnv, void * pProxy) static_cast< UnoInterfaceProxy * >( reinterpret_cast< uno_Interface * >( pProxy ) ); if (pEnv != pThis->pBridge->getUnoEnv()) { - OSL_ASSERT(false); + assert(false); } (*pThis->pBridge->getCppEnv()->revokeInterface)( @@ -68,7 +67,7 @@ void acquireProxy(uno_Interface * pUnoI) static_cast< UnoInterfaceProxy * >( pUnoI )->oid.pData, static_cast< UnoInterfaceProxy * >( pUnoI )->pTypeDescr ); #if OSL_DEBUG_LEVEL > 1 - OSL_ASSERT( pThis == pUnoI ); + assert(pThis == pUnoI); #endif } } @@ -110,9 +109,7 @@ UnoInterfaceProxy::UnoInterfaceProxy( if (! ((typelib_TypeDescription *)pTypeDescr)->bComplete) ::typelib_typedescription_complete( (typelib_TypeDescription **)&pTypeDescr ); - OSL_ENSURE( - ((typelib_TypeDescription *)pTypeDescr)->bComplete, - "### type is incomplete!" ); + assert(((typelib_TypeDescription *)pTypeDescr)->bComplete); pCppI->acquire(); (*pBridge->getCppEnv()->registerInterface)( pBridge->getCppEnv(), reinterpret_cast< void ** >( &pCppI ), oid.pData, diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx index f646c8979d57..865dd6638a22 100644 --- a/bridges/source/cpp_uno/shared/vtablefactory.cxx +++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx @@ -27,7 +27,6 @@ #include "osl/thread.h" #include "osl/security.hxx" #include "osl/file.hxx" -#include "osl/diagnose.h" #include "osl/mutex.hxx" #include "rtl/alloc.h" #include "rtl/ustring.hxx" @@ -209,7 +208,7 @@ VtableFactory::Vtables VtableFactory::getVtables( GuardedBlocks blocks(*this); createVtables(blocks, BaseOffset(type), type, 0, type, true); Vtables vtables; - OSL_ASSERT(blocks.size() <= SAL_MAX_INT32); + assert(blocks.size() <= SAL_MAX_INT32); vtables.count = static_cast< sal_Int32 >(blocks.size()); bridges::cpp_uno::shared::GuardedArray< Block > guardedBlocks( new Block[vtables.count]); diff --git a/bridges/source/cpp_uno/shared/vtables.cxx b/bridges/source/cpp_uno/shared/vtables.cxx index 88b5e77a315f..54fdb6a7d2c8 100644 --- a/bridges/source/cpp_uno/shared/vtables.cxx +++ b/bridges/source/cpp_uno/shared/vtables.cxx @@ -20,11 +20,11 @@ #include "bridges/cpp_uno/shared/vtables.hxx" -#include "osl/diagnose.h" #include "sal/types.h" #include "typelib/typedescription.h" #include <algorithm> +#include <cassert> namespace { @@ -83,14 +83,14 @@ template< typename T > bridges::cpp_uno::shared::VtableSlot doGetVtableSlot( slot.offset = 0; T * member = const_cast< T * >(ifcMember); while (member->pBaseRef != 0) { - OSL_ASSERT(member->nIndex < member->pInterface->nBaseTypes); + assert(member->nIndex < member->pInterface->nBaseTypes); for (sal_Int32 i = 0; i < member->nIndex; ++i) { slot.offset += getVtableCount(member->pInterface->ppBaseTypes[i]); } typelib_TypeDescription * desc = 0; typelib_typedescriptionreference_getDescription( &desc, member->pBaseRef); - OSL_ASSERT( + assert( desc != 0 && desc->eTypeClass == member->aBase.aBase.eTypeClass); if (member != ifcMember) { typelib_typedescription_release(&member->aBase.aBase); |