From 1276076ac8fcc84df64050f8aa194fa75386a0ea Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 21 Nov 2014 17:30:53 +0100 Subject: ibridges: convert all legacy osl/diagnose.h assertions in source/cppu_uno Change-Id: I4e78fac76b6bb4923e3b680d910afe5bb9640c33 --- 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 ++++---- 3 files changed, 19 insertions(+), 27 deletions(-) (limited to 'bridges/source/cpp_uno/gcc3_linux_hppa') diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx index 48e2f756c534..95caf16f32b2 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx @@ -94,7 +94,7 @@ namespace nregs++; // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -385,7 +385,7 @@ namespace fprintf(stderr, "and %x %x\n", (long)(ovrflw[-12]), (long)(ovrflw[-13])); fprintf(stderr, "and %x %x\n", (long)(ovrflw[-14]), (long)(ovrflw[-15])); #endif - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!"); // gpreg: [ret *], this, [other gpr params] // fpreg: [fpr params] @@ -431,12 +431,10 @@ namespace } // determine called method - OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, - "### illegal vtable index!" ); + assert(nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex); sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, - "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -668,7 +666,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: @@ -691,7 +689,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; } default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx index ff00f255cbb4..f982371c8a0a 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/except.cxx @@ -25,8 +25,8 @@ #include #include -#include #include +#include #include #include "com/sun/star/uno/RuntimeException.hpp" @@ -59,7 +59,7 @@ namespace CPPU_CURRENT_NAMESPACE // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -146,7 +146,7 @@ namespace CPPU_CURRENT_NAMESPACE { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -177,7 +177,7 @@ namespace CPPU_CURRENT_NAMESPACE pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -200,7 +200,7 @@ namespace CPPU_CURRENT_NAMESPACE typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -224,7 +224,7 @@ namespace CPPU_CURRENT_NAMESPACE // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -254,7 +254,7 @@ namespace CPPU_CURRENT_NAMESPACE } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -279,10 +279,7 @@ namespace CPPU_CURRENT_NAMESPACE RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -299,10 +296,7 @@ namespace CPPU_CURRENT_NAMESPACE OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx index 87db5262bbb0..3460b4f7b2ec 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx @@ -187,7 +187,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion bool bOverflow = false; @@ -213,7 +213,7 @@ static void cpp_call( INSERT_INT32( &pAdjustedThisPtr, nRegs, pGPR, pStack, bOverflow ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -390,7 +390,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( @@ -439,7 +439,7 @@ void unoInterfaceProxyDispatch( #if OSL_DEBUG_LEVEL > 0 // determine vtable call index sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); #endif VtableSlot aVtableSlot( -- cgit