summaryrefslogtreecommitdiff
path: root/bridges/source/cpp_uno/gcc3_linux_sparc
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-11-21 17:30:53 +0100
committerMichael Stahl <mstahl@redhat.com>2014-11-21 17:32:26 +0100
commit1276076ac8fcc84df64050f8aa194fa75386a0ea (patch)
tree258d77877c052464ff113f56355bbcc5d16e80a5 /bridges/source/cpp_uno/gcc3_linux_sparc
parent329742e6c9da7cd7848d92a6846e3d1249d8d9b4 (diff)
ibridges: convert all legacy osl/diagnose.h assertions in source/cppu_uno
Change-Id: I4e78fac76b6bb4923e3b680d910afe5bb9640c33
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_linux_sparc')
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx17
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx24
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx14
3 files changed, 24 insertions, 31 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx
index 2b7820c65b4f..53d71f93a1fc 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx
@@ -68,7 +68,7 @@ static typelib_TypeClass cpp2uno_call(
pCppStack += sizeof( void* );
// stack space
- OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
+ static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
// parameters
void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
void ** pCppArgs = pUnoArgs + nParams;
@@ -96,7 +96,7 @@ static typelib_TypeClass cpp2uno_call(
{
if ((reinterpret_cast< long >(pCppStack) & 7) != 0)
{
- OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) );
+ static_assert(sizeof (double) == sizeof (sal_Int64));
void * pDest = alloca( sizeof (sal_Int64) );
*reinterpret_cast< sal_Int32 * >(pDest) =
*reinterpret_cast< sal_Int32 const * >(pCppStack);
@@ -223,7 +223,7 @@ static typelib_TypeClass cpp_mediate(
void ** pCallStack,
sal_Int64 * pRegisterReturn /* space for register return */ )
{
- OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" );
+ static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!");
// pCallStack: this, params
// eventual [ret*] lies at pCallStack -1
@@ -257,7 +257,7 @@ static typelib_TypeClass cpp_mediate(
// determine called method
sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
- OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
+ assert(nMemberPos < pTypeDescr->nAllMembers);
TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
@@ -442,7 +442,7 @@ unsigned char * codeSnippet(
index |= 0x80000000;
}
unsigned int * p = reinterpret_cast< unsigned int * >(code);
- OSL_ASSERT(sizeof (unsigned int) == 4);
+ static_assert(sizeof (unsigned int) == 4);
// st %o0, [%sp+68]:
*p++ = 0xD023A044;
// st %o1, [%sp+72]:
@@ -471,8 +471,7 @@ unsigned char * codeSnippet(
*p++ = 0x81C2C000;
// mov %sp, %o1:
*p++ = 0x9210000E;
- OSL_ASSERT(
- reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize);
+ assert(reinterpret_cast< unsigned char * >(p) - code <= codeSnippetSize);
return code + codeSnippetSize;
}
@@ -513,7 +512,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
for (sal_Int32 i = 0; i < type->nMembers; ++i) {
typelib_TypeDescription * member = 0;
TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
- OSL_ASSERT(member != 0);
+ assert(member != 0);
switch (member->eTypeClass) {
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
// Getter:
@@ -545,7 +544,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
break;
default:
- OSL_ASSERT(false);
+ assert(false);
break;
}
TYPELIB_DANGER_RELEASE(member);
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
index 51ad964b9e46..7fc8974b5334 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/except.cxx
@@ -25,7 +25,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
-#include <osl/diagnose.h>
+#include <sal/log.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/uno/genfunc.hxx>
@@ -57,7 +57,7 @@ static OUString toUNOname( char const * p )
// example: N3com3sun4star4lang24IllegalArgumentExceptionE
OUStringBuffer buf( 64 );
- OSL_ASSERT( 'N' == *p );
+ assert( 'N' == *p );
++p; // skip N
while ('E' != *p)
@@ -144,7 +144,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
{
pair< t_rtti_map::iterator, bool > insertion(
m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
- OSL_ENSURE( insertion.second, "### inserting new rtti failed?!" );
+ assert(insertion.second);
}
else
{
@@ -175,7 +175,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
- OSL_ENSURE( insertion.second, "### inserting new generated rtti failed?!" );
+ assert(insertion.second);
}
else // taking already generated rtti
{
@@ -198,7 +198,7 @@ static void deleteException( void * pExc )
typelib_TypeDescription * pTD = 0;
OUString unoName( toUNOname( header->exceptionType->name() ) );
::typelib_typedescription_getByName( &pTD, unoName.pData );
- OSL_ENSURE( pTD, "### unknown exception type! leaving out destruction => leaking!!!" );
+ assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
if (pTD)
{
::uno_destructData( pExc, pTD, cpp_release );
@@ -222,7 +222,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// construct cpp exception object
typelib_TypeDescription * pTypeDescr = 0;
TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType );
- OSL_ASSERT( pTypeDescr );
+ assert(pTypeDescr);
if (! pTypeDescr)
{
throw RuntimeException(
@@ -252,7 +252,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
TYPELIB_DANGER_RELEASE( pTypeDescr );
- OSL_ENSURE( rtti, "### no rtti for throwing exception!" );
+ assert(rtti);
if (! rtti)
{
throw RuntimeException(
@@ -272,10 +272,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping
RuntimeException aRE( "no exception header!" );
Type const & rType = ::getCppuType( &aRE );
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
-#if defined _DEBUG
- OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_FAIL( cstr.getStr() );
-#endif
+ SAL_WARN("bridges", aRE.Message);
return;
}
@@ -291,10 +288,7 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping
RuntimeException aRE( OUString("exception type not found: ") + unoName );
Type const & rType = ::getCppuType( &aRE );
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
-#if defined _DEBUG
- OString cstr( OUStringToOString( aRE.Message, RTL_TEXTENCODING_ASCII_US ) );
- OSL_FAIL( cstr.getStr() );
-#endif
+ SAL_WARN("bridges", aRE.Message);
}
else
{
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
index 24be4a0a2315..0ac80dc26925 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
@@ -61,10 +61,10 @@ void callVirtualMethod( void * pAdjustedThisPtr,
// parameter list is mixed list of * and values
// reference parameters are pointers
- OSL_ENSURE( pStackLongs && pAdjustedThisPtr, "### null ptr!" );
- OSL_ENSURE( (sizeof(void *) == 4) &&
+ assert(pStackLongs && pAdjustedThisPtr);
+ static_assert( (sizeof(void *) == 4) &&
(sizeof(sal_Int32) == 4), "### unexpected size of int!" );
- OSL_ENSURE( nStackLongs && pStackLongs, "### no stack in callVirtualMethod !" );
+ assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !");
// never called
if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
@@ -285,7 +285,7 @@ static void cpp_call(
// return
typelib_TypeDescription * pReturnTypeDescr = 0;
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
- OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" );
+ assert(pReturnTypeDescr);
void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
@@ -312,7 +312,7 @@ static void cpp_call(
pCppStack += sizeof( void* );
// stack space
- OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
+ static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
// args
void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams );
// indices of values this have to be converted (interface conversion cpp<=>uno)
@@ -336,7 +336,7 @@ static void cpp_call(
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
case typelib_TypeClass_DOUBLE:
- OSL_ASSERT( sizeof (double) == sizeof (sal_Int64) );
+ static_assert(sizeof (double) == sizeof (sal_Int64));
*reinterpret_cast< sal_Int32 * >(pCppStack) =
*reinterpret_cast< sal_Int32 const * >(pUnoArgs[ nPos ]);
pCppStack += sizeof (sal_Int32);
@@ -390,7 +390,7 @@ static void cpp_call(
try
{
int nStackLongs = (pCppStack - pCppStackStart)/sizeof(sal_Int32);
- OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic" );
+ assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic" );
if( nStackLongs & 1 )
// stack has to be 8 byte aligned