From 7ceee0f1ec0e349d0df4980d7fdedbd13c7917c5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 9 Oct 2018 10:28:48 +0200 Subject: Extend loplugin:redundantinline to catch inline functions w/o external linkage ...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- cppu/source/threadpool/threadident.cxx | 2 +- cppu/source/typelib/static_types.cxx | 6 +++--- cppu/source/typelib/typelib.cxx | 14 +++++++------- cppu/source/uno/lbenv.cxx | 32 ++++++++++++++++---------------- cppu/source/uno/lbmap.cxx | 10 +++++----- cppu/source/uno/sequence.cxx | 8 ++++---- 6 files changed, 36 insertions(+), 36 deletions(-) (limited to 'cppu') diff --git a/cppu/source/threadpool/threadident.cxx b/cppu/source/threadpool/threadident.cxx index ef880c7aa7bc..4b9ef7c25b57 100644 --- a/cppu/source/threadpool/threadident.cxx +++ b/cppu/source/threadpool/threadident.cxx @@ -35,7 +35,7 @@ using namespace ::osl; using namespace ::cppu; -static inline void createLocalId( sal_Sequence **ppThreadId ) +static void createLocalId( sal_Sequence **ppThreadId ) { rtl_byte_sequence_constructNoDefault( ppThreadId , 4 + 16 ); sal_uInt32 id = osl::Thread::getCurrentIdentifier(); diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 2a3a5432b07f..fe16b365b7f3 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -72,7 +72,7 @@ struct AlignSize_Impl // the value of the maximal alignment static sal_Int32 nMaxAlignment = static_cast( reinterpret_cast(&reinterpret_cast(16)->dDouble) - 16); -static inline sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) +static sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) { if( nRequestedAlignment > nMaxAlignment ) nRequestedAlignment = nMaxAlignment; @@ -82,7 +82,7 @@ static inline sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) /** * Calculate the new size of the struktur. */ -static inline sal_Int32 newAlignedSize( +static sal_Int32 newAlignedSize( sal_Int32 OldSize, sal_Int32 ElementSize, sal_Int32 NeededAlignment ) { NeededAlignment = adjustAlignment( NeededAlignment ); @@ -96,7 +96,7 @@ namespace } // !for NOT REALLY WEAK TYPES only! -static inline typelib_TypeDescriptionReference * igetTypeByName( rtl_uString const * pTypeName ) +static typelib_TypeDescriptionReference * igetTypeByName( rtl_uString const * pTypeName ) { typelib_TypeDescriptionReference * pRef = nullptr; ::typelib_typedescriptionreference_getByName( &pRef, pTypeName ); diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 3afc22e9cead..1c8f17761cb8 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -78,7 +78,7 @@ struct AlignSize_Impl // the value of the maximal alignment static sal_Int32 nMaxAlignment = static_cast( reinterpret_cast(&reinterpret_cast(16)->dDouble) - 16); -static inline sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) +static sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) { if( nRequestedAlignment > nMaxAlignment ) nRequestedAlignment = nMaxAlignment; @@ -88,19 +88,19 @@ static inline sal_Int32 adjustAlignment( sal_Int32 nRequestedAlignment ) /** * Calculate the new size of the structure. */ -static inline sal_Int32 newAlignedSize( +static sal_Int32 newAlignedSize( sal_Int32 OldSize, sal_Int32 ElementSize, sal_Int32 NeededAlignment ) { NeededAlignment = adjustAlignment( NeededAlignment ); return (OldSize + NeededAlignment -1) / NeededAlignment * NeededAlignment + ElementSize; } -static inline bool reallyWeak( typelib_TypeClass eTypeClass ) +static bool reallyWeak( typelib_TypeClass eTypeClass ) { return TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( eTypeClass ); } -static inline sal_Int32 getDescriptionSize( typelib_TypeClass eTypeClass ) +static sal_Int32 getDescriptionSize( typelib_TypeClass eTypeClass ) { OSL_ASSERT( typelib_TypeClass_TYPEDEF != eTypeClass ); @@ -358,7 +358,7 @@ extern "C" void SAL_CALL typelib_typedescription_revokeCallback( } } -static inline void typelib_typedescription_initTables( +static void typelib_typedescription_initTables( typelib_TypeDescription * pTD ) { typelib_InterfaceTypeDescription * pITD = reinterpret_cast(pTD); @@ -1275,7 +1275,7 @@ void deleteExceptions( } // frees anything except typelib_TypeDescription base! -static inline void typelib_typedescription_destructExtendedMembers( +static void typelib_typedescription_destructExtendedMembers( typelib_TypeDescription * pTD ) { OSL_ASSERT( typelib_TypeClass_TYPEDEF != pTD->eTypeClass ); @@ -1585,7 +1585,7 @@ extern "C" void SAL_CALL typelib_typedescription_register( } -static inline bool type_equals( +static bool type_equals( typelib_TypeDescriptionReference const * p1, typelib_TypeDescriptionReference const * p2 ) { return (p1 == p2 || diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index fa22dc661ecf..d442ca0bc7d7 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -51,7 +51,7 @@ namespace { -inline bool td_equals( typelib_InterfaceTypeDescription const * pTD1, +bool td_equals( typelib_InterfaceTypeDescription const * pTD1, typelib_InterfaceTypeDescription const * pTD2 ) { return (pTD1 == pTD2 || @@ -80,15 +80,15 @@ struct ObjectEntry std::vector< InterfaceEntry > aInterfaces; bool mixedObject; - explicit inline ObjectEntry( const OUString & rOId_ ); + explicit ObjectEntry( const OUString & rOId_ ); - inline void append( + void append( uno_DefaultEnvironment * pEnv, void * pInterface, typelib_InterfaceTypeDescription * pTypeDescr, uno_freeProxyFunc fpFreeProxy ); - inline InterfaceEntry * find( + InterfaceEntry * find( typelib_InterfaceTypeDescription * pTypeDescr ); - inline sal_Int32 find( void const * iface_ptr, std::size_t pos ) const; + sal_Int32 find( void const * iface_ptr, std::size_t pos ) const; }; @@ -118,10 +118,10 @@ struct EnvironmentsData EnvironmentsData() : isDisposing(false) {} ~EnvironmentsData(); - inline void getEnvironment( + void getEnvironment( uno_Environment ** ppEnv, const OUString & rEnvDcp, void * pContext ); - inline void registerEnvironment( uno_Environment ** ppEnv ); - inline void getRegisteredEnvironments( + void registerEnvironment( uno_Environment ** ppEnv ); + void getRegisteredEnvironments( uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc, const OUString & rEnvDcp ); @@ -145,7 +145,7 @@ struct uno_DefaultEnvironment : public uno_ExtEnvironment }; -inline ObjectEntry::ObjectEntry( OUString const & rOId_ ) +ObjectEntry::ObjectEntry( OUString const & rOId_ ) : oid( rOId_ ), nRef( 0 ), mixedObject( false ) @@ -154,7 +154,7 @@ inline ObjectEntry::ObjectEntry( OUString const & rOId_ ) } -inline void ObjectEntry::append( +void ObjectEntry::append( uno_DefaultEnvironment * pEnv, void * pInterface, typelib_InterfaceTypeDescription * pTypeDescr, uno_freeProxyFunc fpFreeProxy ) @@ -179,7 +179,7 @@ inline void ObjectEntry::append( } -inline InterfaceEntry * ObjectEntry::find( +InterfaceEntry * ObjectEntry::find( typelib_InterfaceTypeDescription * pTypeDescr_ ) { OSL_ASSERT( ! aInterfaces.empty() ); @@ -210,7 +210,7 @@ inline InterfaceEntry * ObjectEntry::find( } -inline sal_Int32 ObjectEntry::find( +sal_Int32 ObjectEntry::find( void const * iface_ptr, std::size_t pos ) const { std::size_t size = aInterfaces.size(); @@ -826,7 +826,7 @@ namespace class theStaticOIdPart : public rtl::Static {}; -inline const OUString & unoenv_getStaticOIdPart() +const OUString & unoenv_getStaticOIdPart() { return theStaticOIdPart::get().getOIdPart(); } @@ -912,7 +912,7 @@ EnvironmentsData::~EnvironmentsData() } -inline void EnvironmentsData::getEnvironment( +void EnvironmentsData::getEnvironment( uno_Environment ** ppEnv, const OUString & rEnvDcp, void * pContext ) { if (*ppEnv) @@ -934,7 +934,7 @@ inline void EnvironmentsData::getEnvironment( } -inline void EnvironmentsData::registerEnvironment( uno_Environment ** ppEnv ) +void EnvironmentsData::registerEnvironment( uno_Environment ** ppEnv ) { OSL_ENSURE( ppEnv, "### null ptr!" ); uno_Environment * pEnv = *ppEnv; @@ -973,7 +973,7 @@ inline void EnvironmentsData::registerEnvironment( uno_Environment ** ppEnv ) } -inline void EnvironmentsData::getRegisteredEnvironments( +void EnvironmentsData::getRegisteredEnvironments( uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc, const OUString & rEnvDcp ) { diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index c5ce6709991f..c203523efa2c 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -268,7 +268,7 @@ uno_Mediate_Mapping::uno_Mediate_Mapping( } -static inline OUString getMappingName( +static OUString getMappingName( const Environment & rFrom, const Environment & rTo, const OUString & rAddPurpose ) { OUStringBuffer aKey( 64 ); @@ -285,7 +285,7 @@ static inline OUString getMappingName( return aKey.makeStringAndClear(); } -static inline OUString getBridgeName( +static OUString getBridgeName( const Environment & rFrom, const Environment & rTo, const OUString & rAddPurpose ) { OUStringBuffer aBridgeName( 16 ); @@ -302,7 +302,7 @@ static inline OUString getBridgeName( #ifndef DISABLE_DYNLOADING -static inline void setNegativeBridge( const OUString & rBridgeName ) +static void setNegativeBridge( const OUString & rBridgeName ) { MappingsData & rData = getMappingsData(); MutexGuard aGuard( rData.aNegativeLibsMutex ); @@ -337,7 +337,7 @@ static uno_ext_getMappingFunc selectMapFunc( const OUString & rBridgeName ) #else -static inline bool loadModule(osl::Module & rModule, const OUString & rBridgeName) +static bool loadModule(osl::Module & rModule, const OUString & rBridgeName) { bool bNeg; { @@ -472,7 +472,7 @@ static Mapping getDirectMapping( } -static inline Mapping createMediateMapping( +static Mapping createMediateMapping( const Environment & rFrom, const Environment & rTo, const Mapping & rFrom2Uno, const Mapping & rUno2To, const OUString & rAddPurpose ) diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index 848aaa39f428..97412ba70d08 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -41,7 +41,7 @@ namespace cppu { -static inline uno_Sequence * reallocSeq( +static uno_Sequence * reallocSeq( uno_Sequence * pReallocate, std::size_t nElementSize, sal_Int32 nElements ) { OSL_ASSERT( nElements >= 0 ); @@ -68,7 +68,7 @@ static inline uno_Sequence * reallocSeq( } -static inline bool idefaultConstructElements( +static bool idefaultConstructElements( uno_Sequence ** ppSeq, typelib_TypeDescriptionReference * pElementType, sal_Int32 nStartIndex, sal_Int32 nStopIndex, @@ -310,7 +310,7 @@ static inline bool idefaultConstructElements( } -static inline bool icopyConstructFromElements( +static bool icopyConstructFromElements( uno_Sequence ** ppSeq, void * pSourceElements, typelib_TypeDescriptionReference * pElementType, sal_Int32 nStopIndex, @@ -570,7 +570,7 @@ static inline bool icopyConstructFromElements( } -static inline bool ireallocSequence( +static bool ireallocSequence( uno_Sequence ** ppSequence, typelib_TypeDescriptionReference * pElementType, sal_Int32 nSize, -- cgit