include/com/sun/star/uno/Any.h | 4 - include/com/sun/star/uno/Any.hxx | 78 ++++++++++++++++++++++++++- include/com/sun/star/uno/Reference.h | 10 --- include/com/sun/star/uno/Reference.hxx | 15 ----- include/com/sun/star/uno/Sequence.h | 3 - include/com/sun/star/uno/Sequence.hxx | 16 ----- include/com/sun/star/uno/genfunc.hxx | 4 - include/cppuhelper/interfacecontainer.h | 4 - include/rtl/byteseq.hxx | 13 ---- include/rtl/string.hxx | 9 --- include/rtl/ustring.hxx | 23 ------- include/unotools/sharedunocomponent.hxx | 6 -- include/vcl/threadex.hxx | 12 ---- solenv/gbuild/platform/OPENBSD_INTEL_GCC.mk | 2 solenv/gbuild/platform/OPENBSD_X86_64_GCC.mk | 2 solenv/gbuild/platform/com_GCC_defs.mk | 4 - solenv/gbuild/platform/com_MSC_defs.mk | 3 - 17 files changed, 78 insertions(+), 130 deletions(-)
New commits: commit c38592527adfc526133c3ac36b10aa77234313ee Author: Stephan Bergmann <[email protected]> Date: Wed Aug 14 11:45:30 2013 +0200 EXCEPTIONS_OFF is never defined ...since gb_LinkTarget_NOEXCEPTIONFLAGS became unused with e81b1f23c49e35c1cde1faa44281812e97be60f5 "remove gb_LinkTarget_add_noexception_object." Change-Id: I4a7275b5b26a9d4b6ded66efb52e6866e6e09cc3 diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index b4ead89..7be6017 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -157,7 +157,6 @@ public: inline const void * SAL_CALL getValue() const SAL_THROW(()) { return pData; } -#if ! defined(EXCEPTIONS_OFF) /** Provides a value of specified type, so you can easily write e.g. <pre> sal_Int32 myVal = myAny.get<sal_Int32>(); @@ -172,7 +171,6 @@ public: */ template <typename T> inline T get() const; -#endif // ! defined(EXCEPTIONS_OFF) /** Sets a value. If the any already contains a value, that value will be destructed and its memory freed. @@ -240,10 +238,8 @@ private: // Omitting the following private declarations leads to an internal compiler // error on MSVC (version 1310). // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16) -#if ! defined(EXCEPTIONS_OFF) template <> sal_uInt16 get<sal_uInt16>() const; -#endif // ! defined(EXCEPTIONS_OFF) template <> bool has<sal_uInt16>() const; #endif // defined(_MSC_VER) diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index a643a6f..04115a5 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -567,7 +567,6 @@ inline sal_Bool SAL_CALL operator != ( const Any & rAny, const C & value ) SAL_T return (! operator == ( rAny, value )); } -#if ! defined(EXCEPTIONS_OFF) extern "C" rtl_uString * SAL_CALL cppu_Any_extraction_failure_msg( uno_Any const * pAny, typelib_TypeDescriptionReference * pType ) SAL_THROW_EXTERN_C(); @@ -591,7 +590,6 @@ T Any::get() const // not impl: forbid use with ambiguous type (sal_Unicode, sal_uInt16) template <> sal_uInt16 Any::get<sal_uInt16>() const; -#endif // ! defined(EXCEPTIONS_OFF) /** Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO diff --git a/include/com/sun/star/uno/Reference.h b/include/com/sun/star/uno/Reference.h index 27787d3..73a8608 100644 --- a/include/com/sun/star/uno/Reference.h +++ b/include/com/sun/star/uno/Reference.h @@ -66,7 +66,6 @@ protected: */ inline static XInterface * SAL_CALL iquery( XInterface * pInterface, const Type & rType ) SAL_THROW( (RuntimeException) ); -#ifndef EXCEPTIONS_OFF /** Queries given interface for type rType. Throws a RuntimeException if the demanded interface cannot be queried. @@ -76,7 +75,6 @@ protected: */ inline static XInterface * SAL_CALL iquery_throw( XInterface * pInterface, const Type & rType ) SAL_THROW( (RuntimeException) ); -#endif public: /** Gets interface pointer. This call does not acquire the interface. @@ -139,7 +137,6 @@ enum UnoReference_Query */ UNO_QUERY, }; -#ifndef EXCEPTIONS_OFF /** Enum defining UNO_QUERY_THROW for implicit interface query. If the demanded interface is unavailable, then a RuntimeException is thrown. */ @@ -158,7 +155,6 @@ enum UnoReference_SetThrow { UNO_SET_THROW }; -#endif /// @cond INTERNAL namespace detail { @@ -225,7 +221,6 @@ class Reference : public BaseReference */ inline static XInterface * SAL_CALL iquery( XInterface * pInterface ) SAL_THROW( (RuntimeException) ); -#ifndef EXCEPTIONS_OFF /** Queries given interface for type interface_type. Throws a RuntimeException if the demanded interface cannot be queried. @@ -241,7 +236,6 @@ class Reference : public BaseReference */ inline static interface_type * SAL_CALL iset_throw( interface_type * pInterface ) SAL_THROW( (RuntimeException) ); -#endif /** Cast from an "interface pointer" (e.g., BaseReference::_pInterface) to a pointer to this interface_type. @@ -353,7 +347,6 @@ public: @param dummy UNO_QUERY to force obvious distinction to other constructors */ inline Reference( const Any & rAny, UnoReference_Query dummy) SAL_THROW( (RuntimeException) ); -#ifndef EXCEPTIONS_OFF /** Constructor: Queries given interface for reference interface type (interface_type). Throws a RuntimeException if the demanded interface cannot be queried. @@ -396,7 +389,6 @@ public: @since UDK 3.2.8 */ inline Reference( interface_type * pInterface, UnoReference_SetThrow dummy ) SAL_THROW( (RuntimeException) ); -#endif /** Cast operator to Reference< XInterface >: Reference objects are binary compatible and any interface must be derived from com.sun.star.uno.XInterface. @@ -483,7 +475,6 @@ public: */ inline bool set( Any const & rAny, UnoReference_Query dummy ); -#ifndef EXCEPTIONS_OFF /** Queries given interface for reference interface type (interface_type) and sets it. An interface already set will be released. Throws a RuntimeException if the demanded interface cannot be set. @@ -534,7 +525,6 @@ public: */ inline void SAL_CALL set( const Reference< interface_type > & rRef, UnoReference_SetThrow dummy) SAL_THROW( (RuntimeException) ); -#endif /** Assignment operator: Acquires given interface pointer and sets reference. An interface already set will be released. diff --git a/include/com/sun/star/uno/Reference.hxx b/include/com/sun/star/uno/Reference.hxx index 419439e..a358c97 100644 --- a/include/com/sun/star/uno/Reference.hxx +++ b/include/com/sun/star/uno/Reference.hxx @@ -57,7 +57,6 @@ inline XInterface * Reference< interface_type >::iquery( { return BaseReference::iquery(pInterface, interface_type::static_type()); } -#ifndef EXCEPTIONS_OFF extern "C" rtl_uString * SAL_CALL cppu_unsatisfied_iquery_msg( typelib_TypeDescriptionReference * pType ) SAL_THROW_EXTERN_C(); @@ -98,7 +97,6 @@ inline interface_type * Reference< interface_type >::iset_throw( ::rtl::OUString( cppu_unsatisfied_iset_msg( interface_type::static_type().getTypeLibType() ), SAL_NO_ACQUIRE ), NULL ); } -#endif //__________________________________________________________________________________________________ template< class interface_type > @@ -172,7 +170,6 @@ inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Qu _pInterface = (typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass ? iquery( static_cast< XInterface * >( rAny.pReserved ) ) : 0); } -#ifndef EXCEPTIONS_OFF //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type >::Reference( const BaseReference & rRef, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) @@ -204,7 +201,6 @@ inline Reference< interface_type >::Reference( interface_type * pInterface, UnoR { _pInterface = castToXInterface( iset_throw( pInterface ) ); } -#endif //__________________________________________________________________________________________________ template< class interface_type > @@ -284,7 +280,6 @@ inline bool Reference< interface_type >::set( SAL_NO_ACQUIRE ); } -#ifndef EXCEPTIONS_OFF //__________________________________________________________________________________________________ template< class interface_type > inline void Reference< interface_type >::set( @@ -326,8 +321,6 @@ inline void Reference< interface_type >::set( set( rRef.get(), UNO_SET_THROW ); } -#endif - //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type > & Reference< interface_type >::operator = ( @@ -369,21 +362,17 @@ inline sal_Bool BaseReference::operator == ( XInterface * pInterface ) const SAL { if (_pInterface == pInterface) return sal_True; -#ifndef EXCEPTIONS_OFF try { -#endif // only the query to XInterface must return the same pointer if they belong to same objects Reference< XInterface > x1( _pInterface, UNO_QUERY ); Reference< XInterface > x2( pInterface, UNO_QUERY ); return (x1._pInterface == x2._pInterface); -#ifndef EXCEPTIONS_OFF } catch (RuntimeException &) { return sal_False; } -#endif } //______________________________________________________________________________ @@ -392,21 +381,17 @@ inline sal_Bool BaseReference::operator < ( { if (_pInterface == rRef._pInterface) return sal_False; -#if ! defined EXCEPTIONS_OFF try { -#endif // only the query to XInterface must return the same pointer: Reference< XInterface > x1( _pInterface, UNO_QUERY ); Reference< XInterface > x2( rRef, UNO_QUERY ); return (x1._pInterface < x2._pInterface); -#if ! defined EXCEPTIONS_OFF } catch (RuntimeException &) { return sal_False; } -#endif } //__________________________________________________________________________________________________ diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h index ed754cf..1e6d2b0 100644 --- a/include/com/sun/star/uno/Sequence.h +++ b/include/com/sun/star/uno/Sequence.h @@ -24,10 +24,7 @@ #include "com/sun/star/uno/Type.h" #include "rtl/alloc.h" -#if ! defined EXCEPTIONS_OFF #include <new> -#endif - namespace rtl { diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx index a23fd3b..9ce88d3 100644 --- a/include/com/sun/star/uno/Sequence.hxx +++ b/include/com/sun/star/uno/Sequence.hxx @@ -76,16 +76,12 @@ template< class E > inline Sequence< E >::Sequence( const E * pElements, sal_Int32 len ) { const Type & rType = ::cppu::getTypeFavourUnsigned( this ); -#if ! defined EXCEPTIONS_OFF sal_Bool success = -#endif ::uno_type_sequence_construct( &_pSequence, rType.getTypeLibType(), const_cast< E * >( pElements ), len, (uno_AcquireFunc)cpp_acquire ); -#if ! defined EXCEPTIONS_OFF if (! success) throw ::std::bad_alloc(); -#endif } //______________________________________________________________________________ @@ -93,16 +89,12 @@ template< class E > inline Sequence< E >::Sequence( sal_Int32 len ) { const Type & rType = ::cppu::getTypeFavourUnsigned( this ); -#if ! defined EXCEPTIONS_OFF sal_Bool success = -#endif ::uno_type_sequence_construct( &_pSequence, rType.getTypeLibType(), 0, len, (uno_AcquireFunc)cpp_acquire ); -#if ! defined EXCEPTIONS_OFF if (! success) throw ::std::bad_alloc(); -#endif } //______________________________________________________________________________ @@ -152,16 +144,12 @@ template< class E > inline E * Sequence< E >::getArray() { const Type & rType = ::cppu::getTypeFavourUnsigned( this ); -#if ! defined EXCEPTIONS_OFF sal_Bool success = -#endif ::uno_type_sequence_reference2One( &_pSequence, rType.getTypeLibType(), (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release ); -#if ! defined EXCEPTIONS_OFF if (! success) throw ::std::bad_alloc(); -#endif return reinterpret_cast< E * >( _pSequence->elements ); } @@ -187,16 +175,12 @@ template< class E > inline void Sequence< E >::realloc( sal_Int32 nSize ) { const Type & rType = ::cppu::getTypeFavourUnsigned( this ); -#if !defined EXCEPTIONS_OFF sal_Bool success = -#endif ::uno_type_sequence_realloc( &_pSequence, rType.getTypeLibType(), nSize, (uno_AcquireFunc)cpp_acquire, (uno_ReleaseFunc)cpp_release ); -#if !defined EXCEPTIONS_OFF if (!success) throw ::std::bad_alloc(); -#endif } //------------------------------------------------------------------------------ diff --git a/include/com/sun/star/uno/genfunc.hxx b/include/com/sun/star/uno/genfunc.hxx index d523123..179f676 100644 --- a/include/com/sun/star/uno/genfunc.hxx +++ b/include/com/sun/star/uno/genfunc.hxx @@ -50,10 +50,8 @@ inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescription { if (pCppI) { -#ifndef EXCEPTIONS_OFF try { -#endif Any aRet( reinterpret_cast< XInterface * >( pCppI )->queryInterface( * reinterpret_cast< const Type * >( &pType ) ) ); if (typelib_TypeClass_INTERFACE == aRet.pType->eTypeClass) @@ -62,12 +60,10 @@ inline void * SAL_CALL cpp_queryInterface( void * pCppI, typelib_TypeDescription aRet.pReserved = 0; return pRet; } -#ifndef EXCEPTIONS_OFF } catch (RuntimeException &) { } -#endif } return 0; } diff --git a/include/cppuhelper/interfacecontainer.h b/include/cppuhelper/interfacecontainer.h index 774f900..9a1cb4d 100644 --- a/include/cppuhelper/interfacecontainer.h +++ b/include/cppuhelper/interfacecontainer.h @@ -269,9 +269,6 @@ inline void OInterfaceContainerHelper::forEach( FuncT const& func ) ::com::sun::star::uno::Reference<ListenerT> const xListener( iter.next(), ::com::sun::star::uno::UNO_QUERY ); if (xListener.is()) { -#if defined(EXCEPTIONS_OFF) - func( xListener ); -#else try { func( xListener ); } @@ -279,7 +276,6 @@ inline void OInterfaceContainerHelper::forEach( FuncT const& func ) if (exc.Context == xListener) iter.remove(); } -#endif } } } diff --git a/include/rtl/byteseq.hxx b/include/rtl/byteseq.hxx index 8004473..aaff08e 100644 --- a/include/rtl/byteseq.hxx +++ b/include/rtl/byteseq.hxx @@ -23,10 +23,7 @@ #include <rtl/byteseq.h> #include <rtl/alloc.h> -#if ! defined EXCEPTIONS_OFF #include <new> -#endif - namespace rtl { @@ -54,20 +51,16 @@ inline ByteSequence::ByteSequence( const sal_Int8 * pElements, sal_Int32 len ) : _pSequence( 0 ) { ::rtl_byte_sequence_constructFromArray( &_pSequence, pElements, len ); -#if ! defined EXCEPTIONS_OFF if (_pSequence == 0) throw ::std::bad_alloc(); -#endif } //__________________________________________________________________________________________________ inline ByteSequence::ByteSequence( sal_Int32 len, enum __ByteSequence_NoDefault ) : _pSequence( 0 ) { ::rtl_byte_sequence_constructNoDefault( &_pSequence, len ); -#if ! defined EXCEPTIONS_OFF if (_pSequence == 0) throw ::std::bad_alloc(); -#endif } //__________________________________________________________________________________________________ inline ByteSequence::ByteSequence( sal_Sequence *pSequence, enum __ByteSequence_NoAcquire ) SAL_THROW(()) @@ -79,10 +72,8 @@ inline ByteSequence::ByteSequence( sal_Int32 len ) : _pSequence( 0 ) { ::rtl_byte_sequence_construct( &_pSequence, len ); -#if ! defined EXCEPTIONS_OFF if (_pSequence == 0) throw ::std::bad_alloc(); -#endif } //__________________________________________________________________________________________________ inline ByteSequence::~ByteSequence() SAL_THROW(()) @@ -104,20 +95,16 @@ inline sal_Bool ByteSequence::operator == ( const ByteSequence & rSeq ) const SA inline sal_Int8 * ByteSequence::getArray() { ::rtl_byte_sequence_reference2One( &_pSequence ); -#if ! defined EXCEPTIONS_OFF if (_pSequence == 0) throw ::std::bad_alloc(); -#endif return (sal_Int8 *)_pSequence->elements; } //__________________________________________________________________________________________________ inline void ByteSequence::realloc( sal_Int32 nSize ) { ::rtl_byte_sequence_realloc( &_pSequence, nSize ); -#if ! defined EXCEPTIONS_OFF if (_pSequence == 0) throw ::std::bad_alloc(); -#endif } //__________________________________________________________________________________________________ inline sal_Int8 & ByteSequence::operator [] ( sal_Int32 nIndex ) diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index c1cbba9..d58dc9f 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -23,6 +23,7 @@ #include "sal/config.h" #include <cassert> +#include <new> #include <ostream> #include <string.h> @@ -37,10 +38,6 @@ #include "sal/log.hxx" -#if !defined EXCEPTIONS_OFF -#include <new> -#endif - // The unittest uses slightly different code to help check that the proper // calls are made. The class is put into a different namespace to make // sure the compiler generates a different (if generating also non-inline) @@ -231,11 +228,7 @@ public: pData = 0; rtl_uString2String( &pData, value, length, encoding, convertFlags ); if (pData == 0) { -#if defined EXCEPTIONS_OFF - abort(); -#else throw std::bad_alloc(); -#endif } } diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index fedd35f..94527db 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -23,6 +23,7 @@ #include "sal/config.h" #include <cassert> +#include <new> #include <ostream> #include <string.h> @@ -37,12 +38,6 @@ #include <rtl/stringconcat.hxx> #endif -#if defined EXCEPTIONS_OFF -#include <stdlib.h> -#else -#include <new> -#endif - // The unittest uses slightly different code to help check that the proper // calls are made. The class is put into a different namespace to make // sure the compiler generates a different (if generating also non-inline) @@ -244,11 +239,7 @@ public: pData = 0; rtl_string2UString( &pData, value, length, encoding, convertFlags ); if (pData == 0) { -#if defined EXCEPTIONS_OFF - abort(); -#else throw std::bad_alloc(); -#endif } } @@ -274,11 +265,7 @@ public: { rtl_uString_newFromCodePoints(&pData, codePoints, codePointCount); if (pData == NULL) { -#if defined EXCEPTIONS_OFF - abort(); -#else throw std::bad_alloc(); -#endif } } @@ -1894,11 +1881,7 @@ public: rtl_uString * pNew = 0; rtl_uString_intern( &pNew, pData ); if (pNew == 0) { -#if defined EXCEPTIONS_OFF - abort(); -#else throw std::bad_alloc(); -#endif } return OUString( pNew, SAL_NO_ACQUIRE ); } @@ -1937,11 +1920,7 @@ public: rtl_uString_internConvert( &pNew, value, length, encoding, convertFlags, pInfo ); if (pNew == 0) { -#if defined EXCEPTIONS_OFF - abort(); -#else throw std::bad_alloc(); -#endif } return OUString( pNew, SAL_NO_ACQUIRE ); } diff --git a/include/unotools/sharedunocomponent.hxx b/include/unotools/sharedunocomponent.hxx index 5fa399d..a8bb97e 100644 --- a/include/unotools/sharedunocomponent.hxx +++ b/include/unotools/sharedunocomponent.hxx @@ -168,7 +168,6 @@ namespace utl reset( _rxComponent, eMode ); } -#ifndef EXCEPTIONS_OFF inline SharedUNOComponent( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ) { set( _pInterface, _queryThrow ); @@ -188,7 +187,6 @@ namespace utl { set( _rxComponent, _setThrow ); } -#endif // SharedUNOComponent& operator=( const ::com::sun::star::uno::Reference< INTERFACE >& _rxComponent ); // This operator is intentionally not implemented. There is no canonic ownership after this operator @@ -206,7 +204,6 @@ namespace utl inline bool set( const ::com::sun::star::uno::BaseReference& _rRef, ::com::sun::star::uno::UnoReference_Query _query ); inline bool set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_Query _query ); -#ifndef EXCEPTIONS_OFF inline void set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ); inline void set( const ::com::sun::star::uno::BaseReference & _rRef, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ); inline void set( const ::com::sun::star::uno::Any& _rAny, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ); @@ -214,7 +211,6 @@ namespace utl inline void set( const INTERFACE* _pInterface, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ); inline void set( const ::com::sun::star::uno::Reference< INTERFACE >& _rRef, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ); inline void set( const SharedUNOComponent& _rComp, ::com::sun::star::uno::UnoReference_SetThrow _setThrow ); -#endif INTERFACE* SAL_CALL operator->() const; @@ -285,7 +281,6 @@ namespace utl return makeAny( value.getTyped() ); } -#ifndef EXCEPTIONS_OFF //------------------------------------------------------------------------- template < class INTERFACE, class COMPONENT > void SharedUNOComponent< INTERFACE, COMPONENT >::set( const ::com::sun::star::uno::XInterface* _pInterface, ::com::sun::star::uno::UnoReference_QueryThrow _queryThrow ) @@ -329,7 +324,6 @@ namespace utl // provoke an exception in case the component is NULL m_xTypedComponent.set( m_xTypedComponent, _setThrow ); } -#endif //------------------------------------------------------------------------- template < class INTERFACE, class COMPONENT > diff --git a/include/vcl/threadex.hxx b/include/vcl/threadex.hxx index 8319818..b7bd5fa 100644 --- a/include/vcl/threadex.hxx +++ b/include/vcl/threadex.hxx @@ -70,10 +70,8 @@ public: typedef GenericSolarThreadExecutor<FuncT, ResultT> ExecutorT; ::std::auto_ptr<ExecutorT> const pExecutor( new ExecutorT(func) ); pExecutor->execute(); -#if ! defined(EXCEPTIONS_OFF) if (pExecutor->m_exc.hasValue()) ::cppu::throwException( pExecutor->m_exc ); -#endif return *pExecutor->m_result; } @@ -83,9 +81,6 @@ private: virtual long doIt() { -#if defined(EXCEPTIONS_OFF) - m_result.reset( m_func() ); -#else try { m_result.reset( m_func() ); } @@ -93,7 +88,6 @@ private: // only UNO exceptions can be dispatched: m_exc = ::cppu::getCaughtException(); } -#endif return 0; } @@ -113,10 +107,8 @@ public: typedef GenericSolarThreadExecutor<FuncT, void> ExecutorT; ::std::auto_ptr<ExecutorT> const pExecutor( new ExecutorT(func) ); pExecutor->execute(); -#if ! defined(EXCEPTIONS_OFF) if (pExecutor->m_exc.hasValue()) ::cppu::throwException( pExecutor->m_exc ); -#endif } private: @@ -125,9 +117,6 @@ private: virtual long doIt() { -#if defined(EXCEPTIONS_OFF) - m_func(); -#else try { m_func(); } @@ -135,7 +124,6 @@ private: // only UNO exceptions can be dispatched: m_exc = ::cppu::getCaughtException(); } -#endif return 0; } diff --git a/solenv/gbuild/platform/OPENBSD_INTEL_GCC.mk b/solenv/gbuild/platform/OPENBSD_INTEL_GCC.mk index cadefea..1abf3e2 100644 --- a/solenv/gbuild/platform/OPENBSD_INTEL_GCC.mk +++ b/solenv/gbuild/platform/OPENBSD_INTEL_GCC.mk @@ -15,6 +15,4 @@ gb_STDLIBS := $(PTHREAD_LIBS) include $(GBUILDDIR)/platform/unxgcc.mk -gb_LinkTarget_NOEXCEPTIONFLAGS += -DBOOST_NO_EXCEPTIONS - # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/OPENBSD_X86_64_GCC.mk b/solenv/gbuild/platform/OPENBSD_X86_64_GCC.mk index 7262ed8..5a1ad2e 100644 --- a/solenv/gbuild/platform/OPENBSD_X86_64_GCC.mk +++ b/solenv/gbuild/platform/OPENBSD_X86_64_GCC.mk @@ -14,6 +14,4 @@ gb_STDLIBS := $(PTHREAD_LIBS) include $(GBUILDDIR)/platform/unxgcc.mk -gb_LinkTarget_NOEXCEPTIONFLAGS += -DBOOST_NO_EXCEPTIONS - # vim: set noet sw=4: diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index 566d871..c9adf88 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -112,10 +112,6 @@ gb_LinkTarget_EXCEPTIONFLAGS += \ endif endif -gb_LinkTarget_NOEXCEPTIONFLAGS := \ - -DEXCEPTIONS_OFF \ - -fno-exceptions \ - gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS) # optimization level diff --git a/solenv/gbuild/platform/com_MSC_defs.mk b/solenv/gbuild/platform/com_MSC_defs.mk index ff448f7..81f20da 100644 --- a/solenv/gbuild/platform/com_MSC_defs.mk +++ b/solenv/gbuild/platform/com_MSC_defs.mk @@ -225,9 +225,6 @@ gb_LinkTarget_EXCEPTIONFLAGS := \ -DEXCEPTIONS_ON \ -EHa \ -gb_LinkTarget_NOEXCEPTIONFLAGS := \ - -DEXCEPTIONS_OFF \ - gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS) gb_LinkTarget_LDFLAGS := \ commit 86435f9e28f8e7936777cbd6e8598994e7c42428 Author: Stephan Bergmann <[email protected]> Date: Wed Aug 14 11:12:14 2013 +0200 Some improvements for operator<<(std::ostream&, const uno::Any&) Change-Id: I2b3eb7a8e3d47b646eb8d4a8ca396a7c9de9545f diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index b7a5c04..a643a6f 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -19,10 +19,15 @@ #ifndef _COM_SUN_STAR_UNO_ANY_HXX_ #define _COM_SUN_STAR_UNO_ANY_HXX_ +#include "sal/config.h" + +#include <cassert> +#include <iomanip> #include <ostream> #include <com/sun/star/uno/Any.h> #include <uno/data.h> +#include <uno/sequence2.h> #include <com/sun/star/uno/Type.hxx> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/uno/genfunc.hxx> @@ -589,74 +594,71 @@ sal_uInt16 Any::get<sal_uInt16>() const; #endif // ! defined(EXCEPTIONS_OFF) /** - * @since LibreOffice 4.2 - */ + Support for Any in std::ostream (and thus in CPPUNIT_ASSERT or SAL_INFO + macros, for example). + + @since LibreOffice 4.2 +*/ template<typename charT, typename traits> inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any &any) { - // prolog with type - o << "<Any: (" << any.getValueTypeName() << ")"; - // log value + o << "<Any: (" << any.getValueTypeName() << ')'; switch(any.pType->eTypeClass) { - case typelib_TypeClass_BOOLEAN: { - bool b = bool(); - any >>= b; - o << b; + case typelib_TypeClass_VOID: + break; + case typelib_TypeClass_BOOLEAN: + o << ' ' << any.get<bool>(); break; - } - case typelib_TypeClass_BYTE: case typelib_TypeClass_SHORT: case typelib_TypeClass_LONG: - case typelib_TypeClass_HYPER: { - sal_Int64 i = sal_Int64(); - any >>= i; - o << i; + case typelib_TypeClass_HYPER: + o << ' ' << any.get<sal_Int64>(); break; - } - case typelib_TypeClass_UNSIGNED_SHORT: case typelib_TypeClass_UNSIGNED_LONG: - case typelib_TypeClass_UNSIGNED_HYPER: { - sal_uInt64 u = sal_uInt64(); - any >>= u; - o << u; + case typelib_TypeClass_UNSIGNED_HYPER: + o << ' ' << any.get<sal_uInt64>(); break; - } - case typelib_TypeClass_FLOAT: - case typelib_TypeClass_DOUBLE: { - double d = double(); - any >>= d; - o << d; + case typelib_TypeClass_DOUBLE: + o << ' ' << any.get<double>(); break; - } - - case typelib_TypeClass_STRING: { - ::rtl::OUString s; - any >>= s; - o << s; + case typelib_TypeClass_CHAR: { + std::ios_base::fmtflags flgs = o.setf( + std::ios_base::hex, std::ios_base::basefield); + charT fill = o.fill('0'); + o << " U+" << std::setw(4) + << *static_cast<sal_Unicode const *>(any.getValue()); + o.setf(flgs); + o.fill(fill); break; } - - case typelib_TypeClass_VOID: - case typelib_TypeClass_CHAR: + case typelib_TypeClass_STRING: + o << ' ' << any.get<rtl::OUString>(); + break; case typelib_TypeClass_TYPE: + o << ' ' << any.get<css::uno::Type>().getTypeName(); + break; case typelib_TypeClass_SEQUENCE: + o << " len " + << ((*static_cast<uno_Sequence * const *>(any.getValue()))-> + nElements); + break; case typelib_TypeClass_ENUM: + o << ' ' << *static_cast<sal_Int32 const *>(any.getValue()); + break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: - case typelib_TypeClass_INTERFACE: { - // log nothing here - leave just type + o << ' ' << any.getValue(); + break; + case typelib_TypeClass_INTERFACE: + o << ' ' << *static_cast<void * const *>(any.getValue()); break; - } - default: assert(false); // this cannot happen - o << "!!this type should not happen in Any!!"; break; } - // epilog - o << ">"; + o << '>'; return o; } commit 8284ca9c4b5ca82e0a94d1fac9385f5e0dc6625f Author: Boris Dušek <[email protected]> Date: Mon Aug 12 09:03:08 2013 +0200 Implement operator<<(std::ostream&, const uno::Any&) In other words, SAL_DEBUG(any) works now. Structured any types (e.g. struct, array) not implemented yet. Change-Id: I6460e72bbeff86da17711cab5d2018508468290c Signed-off-by: Stephan Bergmann <[email protected]> diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index 6f3bda9..b7a5c04 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -19,6 +19,8 @@ #ifndef _COM_SUN_STAR_UNO_ANY_HXX_ #define _COM_SUN_STAR_UNO_ANY_HXX_ +#include <ostream> + #include <com/sun/star/uno/Any.h> #include <uno/data.h> #include <com/sun/star/uno/Type.hxx> @@ -586,6 +588,78 @@ template <> sal_uInt16 Any::get<sal_uInt16>() const; #endif // ! defined(EXCEPTIONS_OFF) +/** + * @since LibreOffice 4.2 + */ +template<typename charT, typename traits> +inline std::basic_ostream<charT, traits> &operator<<(std::basic_ostream<charT, traits> &o, Any &any) { + // prolog with type + o << "<Any: (" << any.getValueTypeName() << ")"; + // log value + switch(any.pType->eTypeClass) { + case typelib_TypeClass_BOOLEAN: { + bool b = bool(); + any >>= b; + o << b; + break; + } + + case typelib_TypeClass_BYTE: + case typelib_TypeClass_SHORT: + case typelib_TypeClass_LONG: + case typelib_TypeClass_HYPER: { + sal_Int64 i = sal_Int64(); + any >>= i; + o << i; + break; + } + + case typelib_TypeClass_UNSIGNED_SHORT: + case typelib_TypeClass_UNSIGNED_LONG: + case typelib_TypeClass_UNSIGNED_HYPER: { + sal_uInt64 u = sal_uInt64(); + any >>= u; + o << u; + break; + } + + case typelib_TypeClass_FLOAT: + case typelib_TypeClass_DOUBLE: { + double d = double(); + any >>= d; + o << d; + break; + } + + case typelib_TypeClass_STRING: { + ::rtl::OUString s; + any >>= s; + o << s; + break; + } + + case typelib_TypeClass_VOID: + case typelib_TypeClass_CHAR: + case typelib_TypeClass_TYPE: + case typelib_TypeClass_SEQUENCE: + case typelib_TypeClass_ENUM: + case typelib_TypeClass_STRUCT: + case typelib_TypeClass_EXCEPTION: + case typelib_TypeClass_INTERFACE: { + // log nothing here - leave just type + break; + } + + default: + assert(false); // this cannot happen + o << "!!this type should not happen in Any!!"; + break; + } + // epilog + o << ">"; + return o; +} + } } }
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
