diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-11-21 17:30:53 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-11-21 17:32:26 +0100 |
commit | 1276076ac8fcc84df64050f8aa194fa75386a0ea (patch) | |
tree | 258d77877c052464ff113f56355bbcc5d16e80a5 /bridges/source/cpp_uno/gcc3_solaris_sparc | |
parent | 329742e6c9da7cd7848d92a6846e3d1249d8d9b4 (diff) |
ibridges: convert all legacy osl/diagnose.h assertions in source/cppu_uno
Change-Id: I4e78fac76b6bb4923e3b680d910afe5bb9640c33
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_solaris_sparc')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx | 17 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx | 24 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx | 14 |
3 files changed, 24 insertions, 31 deletions
diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx index 29ae1b5fdbe7..ce76c24f6fb6 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx @@ -69,7 +69,7 @@ static typelib_TypeClass cpp2uno_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams ); void ** pCppArgs = pUnoArgs + nParams; @@ -97,7 +97,7 @@ static typelib_TypeClass cpp2uno_call( { if ((reinterpret_cast< long >(pCppStack) & 7) != 0) { - OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) ); + static_assert(sizeof (double) == sizeof (sal_Int64)); void * pDest = alloca( sizeof (sal_Int64) ); *reinterpret_cast< sal_Int32 * >(pDest) = *reinterpret_cast< sal_Int32 const * >(pCppStack); @@ -222,7 +222,7 @@ static typelib_TypeClass cpp_mediate( void ** pCallStack, sal_Int64 * pRegisterReturn /* space for register return */ ) { - OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); + static_assert( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" ); // pCallStack: this, params // eventual [ret*] lies at pCallStack -1 @@ -256,7 +256,7 @@ static typelib_TypeClass cpp_mediate( // determine called method sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex]; - OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" ); + assert(nMemberPos < pTypeDescr->nAllMembers); TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] ); @@ -440,7 +440,7 @@ unsigned char * codeSnippet( index |= 0x80000000; } unsigned int * p = reinterpret_cast< unsigned int * >(code); - OSL_ASSERT(sizeof (unsigned int) == 4); + static_assert(sizeof (unsigned int) == 4); // st %o0, [%sp+68]: *p++ = 0xD023A044; // st %o1, [%sp+72]: @@ -469,8 +469,7 @@ unsigned char * codeSnippet( *p++ = 0x81C2C000; // mov %sp, %o1: *p++ = 0x9210000E; - OSL_ASSERT( - reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize); + assert(reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize); return code + codeSnippetSize; } @@ -511,7 +510,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( for (sal_Int32 i = 0; i < type->nMembers; ++i) { typelib_TypeDescription * member = 0; TYPELIB_DANGER_GET(&member, type->ppMembers[i]); - OSL_ASSERT(member != 0); + assert(member != 0); switch (member->eTypeClass) { case typelib_TypeClass_INTERFACE_ATTRIBUTE: // Getter: @@ -543,7 +542,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( break; default: - OSL_ASSERT(false); + assert(false); break; } TYPELIB_DANGER_RELEASE(member); diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx index 6c45f82bcaa6..0973b463ca28 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/except.cxx @@ -24,7 +24,7 @@ #include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <osl/diagnose.h> +#include <sal/log.hxx> #include <osl/mutex.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -56,7 +56,7 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - OSL_ASSERT( 'N' == *p ); + assert( 'N' == *p ); ++p; // skip N while ('E' != *p) @@ -143,7 +143,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) { pair< t_rtti_map::iterator, bool > insertion( m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" ); + assert(insertion.second && "### inserting new rtti failed?!"); } else { @@ -174,7 +174,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) pair< t_rtti_map::iterator, bool > insertion( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" ); + assert(insertion.second && "### inserting new generated rtti failed?!"); } else // taking already generated rtti { @@ -197,7 +197,7 @@ static void deleteException( void * pExc ) typelib_TypeDescription * pTD = 0; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); - OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" ); + assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); if (pTD) { ::uno_destructData( pExc, pTD, cpp_release ); @@ -221,7 +221,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // construct cpp exception object typelib_TypeDescription * pTypeDescr = 0; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); - OSL_ASSERT( pTypeDescr ); + assert(pTypeDescr); if (! pTypeDescr) { throw RuntimeException( @@ -251,7 +251,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) } rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr ); - OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); + assert(rtti && "### no rtti for throwing exception!"); if (! rtti) { throw RuntimeException( @@ -270,10 +270,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( "no exception header!" ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); return; } @@ -289,10 +286,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping RuntimeException aRE( OUString("exception type not found: ") + unoName ); Type const & rType = ::getCppuType( &aRE ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); -#if defined _DEBUG - OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_FAIL( cstr.getStr() ); -#endif + SAL_WARN("bridges", aRE.Message); } else { diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx index 6482e46264ee..9f02aeb77495 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx @@ -59,10 +59,10 @@ void callVirtualMethod( void * pAdjustedThisPtr, // parameter list is mixed list of * and values // reference parameters are pointers - OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" ); - OSL_ENSURE( (sizeof(void *) == 4) && + assert( pStackLongs && pAdjustedThisPtr); + static_assert( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!" ); - OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" ); + assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !"); // never called if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something @@ -280,7 +280,7 @@ static void cpp_call( // return typelib_TypeDescription * pReturnTypeDescr = 0; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); + assert(pReturnTypeDescr); void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion @@ -307,7 +307,7 @@ static void cpp_call( pCppStack += sizeof( void* ); // stack space - OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" ); + static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // args void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); // indices of values this have to be converted (interface conversion cpp<=>uno) @@ -331,7 +331,7 @@ static void cpp_call( case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: case typelib_TypeClass_DOUBLE: - OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) ); + static_assert(sizeof (double) == sizeof (sal_Int64)); *reinterpret_cast< sal_Int32 * >(pCppStack) = *reinterpret_cast< sal_Int32 const * >(pUnoArgs[ nPos ]); pCppStack += sizeof (sal_Int32); @@ -385,7 +385,7 @@ static void cpp_call( try { int nStackLongs = (pCppStack - pCppStackStart)/sizeof(sal_Int32); - OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic" ); + assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic"); if( nStackLongs & 1 ) // stack has to be 8 byte aligned |