bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx | 10 ++-- bridges/source/cpp_uno/gcc3_aix_powerpc/except.cxx | 13 +---- bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx | 6 +- bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx | 14 +++--- bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx | 4 - bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx | 8 +-- bridges/source/cpp_uno/gcc3_ios_arm/except.cxx | 16 ++----- bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm.cxx | 8 +-- bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-arm64.cxx | 6 +- bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx | 12 ++--- bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx | 12 ++--- bridges/source/cpp_uno/gcc3_linux_alpha/except.cxx | 14 ++---- bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx | 4 - bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx | 17 +++---- bridges/source/cpp_uno/gcc3_linux_arm/except.cxx | 26 ++++------- bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx | 9 +-- bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx | 14 ++---- bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx | 24 +++------- bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx | 8 +-- bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx | 10 ++-- bridges/source/cpp_uno/gcc3_linux_ia64/except.cxx | 13 +---- bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx | 2 bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx | 15 +++--- bridges/source/cpp_uno/gcc3_linux_intel/except.cxx | 20 +++----- bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx | 7 +-- bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx | 14 ++---- bridges/source/cpp_uno/gcc3_linux_m68k/except.cxx | 24 +++------- bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx | 8 +-- bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx | 15 +++--- bridges/source/cpp_uno/gcc3_linux_mips/except.cxx | 24 +++------- bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx | 6 +- bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx | 14 +++--- bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx | 14 ++---- bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx | 6 +- bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx | 10 ++-- bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx | 13 +---- bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx | 2 bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx | 12 ++--- bridges/source/cpp_uno/gcc3_linux_s390/except.cxx | 14 ++---- bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx | 6 +- bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx | 10 ++-- bridges/source/cpp_uno/gcc3_linux_s390x/except.cxx | 14 ++---- bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx | 4 - bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx | 17 +++---- bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx | 24 +++------- bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx | 14 +++--- bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx | 15 ++---- bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx | 9 +-- bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx | 19 ++------ bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx | 7 +-- bridges/source/cpp_uno/gcc3_macosx_x86-64/abi.cxx | 15 ++---- bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx | 9 +-- bridges/source/cpp_uno/gcc3_macosx_x86-64/except.cxx | 20 +++----- bridges/source/cpp_uno/gcc3_macosx_x86-64/uno2cpp.cxx | 7 +-- bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx | 14 +++--- bridges/source/cpp_uno/gcc3_solaris_intel/except.cxx | 24 +++------- bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx | 12 ++--- bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx | 17 +++---- bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx | 24 +++------- bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx | 14 +++--- bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx | 7 +-- bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx | 14 +++--- bridges/source/cpp_uno/mingw_intel/except.cxx | 22 +++------ bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx | 6 +- bridges/source/cpp_uno/mingw_x86-64/abi.cxx | 15 +++--- bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx | 8 +-- bridges/source/cpp_uno/mingw_x86-64/except.cxx | 22 +++------ bridges/source/cpp_uno/mingw_x86-64/uno2cpp.cxx | 6 +- bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx | 11 ++-- bridges/source/cpp_uno/msvc_win32_intel/except.cxx | 29 +++++------- bridges/source/cpp_uno/msvc_win32_intel/uno2cpp.cxx | 9 +-- bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx | 14 +++--- bridges/source/cpp_uno/msvc_win32_x86-64/except.cxx | 25 ++++------- bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx | 6 +- bridges/source/cpp_uno/shared/bridge.cxx | 9 +-- bridges/source/cpp_uno/shared/component.cxx | 23 +++++----- bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx | 5 -- bridges/source/cpp_uno/shared/unointerfaceproxy.cxx | 9 +-- bridges/source/cpp_uno/shared/vtablefactory.cxx | 3 - bridges/source/cpp_uno/shared/vtables.cxx | 6 +- sw/source/uibase/inc/conttree.hxx | 10 +++- sw/source/uibase/utlui/content.cxx | 34 ++++++++++++++- 82 files changed, 472 insertions(+), 584 deletions(-)
New commits: commit 1276076ac8fcc84df64050f8aa194fa75386a0ea Author: Michael Stahl <mst...@redhat.com> Date: Fri Nov 21 17:30:53 2014 +0100 ibridges: convert all legacy osl/diagnose.h assertions in source/cppu_uno Change-Id: I4e78fac76b6bb4923e3b680d910afe5bb9640c33 diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx index 5bae75f..8fb27d2 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 077afb0..8d74357 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 34daa7a..a879fda 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 49d41a4..0a6390d 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 3a67648..ee9fb30 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 0aa8f5b..e10a444 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 838743a..d20bf42 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 1268608..ea95642 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 e2210c5..8473b61 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 a741277e..5034b0b 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 f47f369..e95a7b0 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 b745a70..ddf2c06 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 7cbf3a9..83055ac 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 0d6a754..8bbbe03 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 e649e40..675187c 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 8789e97..752137f 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 48e2f75..95caf16 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 ff00f25..f982371 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 87db526..3460b4f 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 94e502b..6efcd06 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 b745a70..7495b64 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 041adfd..eefe901 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 70452c7..c3a3650 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 d1d5071..47e570d 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 fabcbc8..ed05bd0 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 403ec52..f798735 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 186fc96..680c33a 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 6652b5f..6699e3c 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 3449ee3..68799e4 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 f438f32..502d94d 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 abd8108..87ccfb4 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 1f7a39b..b49cab4 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 2a36249..fabab50 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 e73f1f1..9a34b98 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 5a5b05e..f982a93 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 b745a70..7495b64 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 61b67dd..01bb74a 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 05e559f..343d155 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 b745a70..ddf2c06 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 bce4cb2..ed0e6cf 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 323b9a8..b21d4f9 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 b745a70..92faed4 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( ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits