From 3c7ad92d43b0823b9f69b0d44e86f674f9dcf070 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 19 Jan 2012 15:47:58 +0100 Subject: [PATCH] Drop UNO_REF_QUERY[_THROW] duplicates of UNO_QUERY[_THROW]. They are virtually unused (at least the LibO code base has only a single use of UNO_REF_QUERY) but confuse static analysis tools that classify unused function parameters as "tags" (which legalizes the unusedness of those parameters) if they are of an enum type with exactly one value defined. --- cppu/inc/com/sun/star/uno/Reference.h | 33 +++++++++++---------------- stoc/test/testiadapter.cxx | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/cppu/inc/com/sun/star/uno/Reference.h b/cppu/inc/com/sun/star/uno/Reference.h index d3611ac73105..72aecfca323b 100644 --- a/cppu/inc/com/sun/star/uno/Reference.h +++ b/cppu/inc/com/sun/star/uno/Reference.h @@ -140,19 +140,16 @@ public: inline sal_Bool SAL_CALL operator < ( const BaseReference & rRef ) const SAL_THROW( () ); }; -/** Enum defining UNO_QUERY and UNO_REF_QUERY for implicit interface query. +/** Enum defining UNO_QUERY for implicit interface query. */ enum UnoReference_Query { /** This enum value can be used for implicit interface query. */ UNO_QUERY, - /** This enum value can be used for implicit interface query. - */ - UNO_REF_QUERY }; #ifndef EXCEPTIONS_OFF -/** Enum defining UNO_QUERY_THROW and UNO_REF_QUERY_THROW for implicit interface query. +/** Enum defining UNO_QUERY_THROW for implicit interface query. If the demanded interface is unavailable, then a RuntimeException is thrown. */ enum UnoReference_QueryThrow @@ -160,9 +157,6 @@ enum UnoReference_QueryThrow /** This enum value can be used for implicit interface query. */ UNO_QUERY_THROW, - /** This enum value can be used for implicit interface query. - */ - UNO_REF_QUERY_THROW }; /** Enum defining UNO_SET_THROW for throwing if attempts are made to assign a null interface @@ -176,7 +170,7 @@ enum UnoReference_SetThrow #endif /** Template reference class for interface type derived from BaseReference. - A special constructor given the UNO_QUERY or UNO_REF_QUERY identifier queries interfaces + A special constructor given the UNO_QUERY identifier queries interfaces for reference type. */ template< class interface_type > @@ -287,7 +281,7 @@ public: /** Constructor: Queries given interface for reference interface type (interface_type). @param rRef another reference - @param dummy UNO_QUERY or UNO_REF_QUERY to force obvious distinction to other constructors + @param dummy UNO_QUERY to force obvious distinction to other constructors */ inline Reference( const BaseReference & rRef, UnoReference_Query ) SAL_THROW( (RuntimeException) ); /** Constructor: Queries given interface for reference interface type (interface_type). @@ -307,7 +301,7 @@ public: Throws a RuntimeException if the demanded interface cannot be queried. @param rRef another reference - @param dummy UNO_QUERY_THROW or UNO_REF_QUERY_THROW to force obvious distinction + @param dummy UNO_QUERY_THROW to force obvious distinction to other constructors */ inline Reference( const BaseReference & rRef, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ); @@ -315,7 +309,7 @@ public: Throws a RuntimeException if the demanded interface cannot be queried. @param pInterface an interface pointer - @param dummy UNO_QUERY_THROW or UNO_REF_QUERY_THROW to force obvious distinction + @param dummy UNO_QUERY_THROW to force obvious distinction to other constructors */ inline Reference( XInterface * pInterface, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ); @@ -323,7 +317,7 @@ public: Throws a RuntimeException if the demanded interface cannot be queried. @param rAny an any - @param dummy UNO_QUERY_THROW or UNO_REF_QUERY_THROW to force obvious distinction + @param dummy UNO_QUERY_THROW to force obvious distinction to other constructors */ inline Reference( const Any & rAny, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ); @@ -406,7 +400,7 @@ public: An interface already set will be released. @param pInterface an interface pointer - @param dummy UNO_QUERY or UNO_REF_QUERY to force obvious distinction to set methods + @param dummy UNO_QUERY to force obvious distinction to set methods @return true, if non-null interface was set */ inline sal_Bool SAL_CALL set( XInterface * pInterface, UnoReference_Query ) SAL_THROW( (RuntimeException) ); @@ -414,7 +408,7 @@ public: An interface already set will be released. @param rRef another reference - @param dummy UNO_QUERY or UNO_REF_QUERY to force obvious distinction to set methods + @param dummy UNO_QUERY to force obvious distinction to set methods @return true, if non-null interface was set */ inline sal_Bool SAL_CALL set( const BaseReference & rRef, UnoReference_Query ) SAL_THROW( (RuntimeException) ); @@ -425,7 +419,7 @@ public: @param rAny an Any containing an interface @param dummy - UNO_QUERY or UNO_REF_QUERY to force obvious distinction + UNO_QUERY to force obvious distinction to set methods @return true, if non-null interface was set @@ -438,7 +432,7 @@ public: Throws a RuntimeException if the demanded interface cannot be set. @param pInterface an interface pointer - @param dummy UNO_QUERY_THROW or UNO_REF_QUERY_THROW to force obvious distinction + @param dummy UNO_QUERY_THROW to force obvious distinction to set methods */ inline void SAL_CALL set( XInterface * pInterface, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ); @@ -447,7 +441,7 @@ public: Throws a RuntimeException if the demanded interface cannot be set. @param rRef another reference - @param dummy UNO_QUERY_THROW or UNO_REF_QUERY_THROW to force obvious distinction + @param dummy UNO_QUERY_THROW to force obvious distinction to set methods */ inline void SAL_CALL set( const BaseReference & rRef, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ); @@ -459,8 +453,7 @@ public: @param rAny an Any containing an interface @param dummy - UNO_QUERY_THROW or UNO_REF_QUERY_THROW to force obvious - distinction to set methods + UNO_QUERY_THROW to force obvious distinction to set methods */ inline void set( Any const & rAny, UnoReference_QueryThrow ); /** sets the given interface diff --git a/stoc/test/testiadapter.cxx b/stoc/test/testiadapter.cxx index 28468ce25f1d..eb0fa8696091 100644 --- a/stoc/test/testiadapter.cxx +++ b/stoc/test/testiadapter.cxx @@ -1005,7 +1005,7 @@ static sal_Bool test_invocation( const Reference< XMultiServiceFactory > & xMgr Reference< XLanguageBindingTest > xOriginal( (XLanguageBindingTest *)new Test_Impl() ); Any aOriginal( &xOriginal, ::getCppuType( &xOriginal ) ); Reference< XInvocation > xInvok( - xInvocFac->createInstanceWithArguments( Sequence< Any >( &aOriginal, 1 ) ), UNO_REF_QUERY ); + xInvocFac->createInstanceWithArguments( Sequence< Any >( &aOriginal, 1 ) ), UNO_QUERY ); Reference< XLanguageBindingTest > xLBT( xAdapFac->createAdapter( xInvok, ::getCppuType( (const Reference< XLanguageBindingTest > *)0 ) ), UNO_QUERY );