From 81b954718f0cdac6873927e869b3e41f863562e7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 9 Jun 2015 08:55:13 +0200 Subject: loplugin:unnecessaryvirtuals Improve the plugin a little. Create a python script to process the output. Run it again. Change-Id: I05c21d8a21c8f4243af739c412fda0a521f9b5f0 --- compilerplugins/clang/store/removevirtuals.cxx | 18 +- compilerplugins/clang/store/unnecessaryvirtual.cxx | 199 ++++++++++++++++++--- connectivity/source/drivers/file/fanalyzer.cxx | 11 -- connectivity/source/drivers/file/fcode.cxx | 5 - connectivity/source/drivers/file/fcomp.cxx | 2 +- connectivity/source/inc/file/fanalyzer.hxx | 4 +- connectivity/source/inc/file/fcode.hxx | 1 - dbaccess/source/core/api/querydescriptor.hxx | 2 +- .../source/core/dataaccess/commanddefinition.hxx | 22 +-- dbaccess/source/core/inc/TableDeco.hxx | 2 +- dbaccess/source/core/inc/definitioncolumn.hxx | 2 +- dbaccess/source/ui/dlg/generalpage.hxx | 2 +- dbaccess/source/ui/dlg/tablespage.hxx | 2 +- extensions/source/propctrlr/commoncontrol.hxx | 2 +- include/svl/svdde.hxx | 37 ++-- include/svtools/editbrowsebox.hxx | 8 +- include/svx/fmgridcl.hxx | 2 +- include/svx/fmgridif.hxx | 4 +- include/svx/gridctrl.hxx | 22 +-- include/test/beans/xpropertyset.hxx | 2 +- include/vcl/scheduler.hxx | 2 +- include/vcl/window.hxx | 4 +- lotuswordpro/source/filter/lwpoleobject.hxx | 2 +- lotuswordpro/source/filter/lwpparastyle.hxx | 4 +- svx/source/inc/gridcell.hxx | 2 +- vcl/inc/sallayout.hxx | 2 +- 26 files changed, 251 insertions(+), 114 deletions(-) diff --git a/compilerplugins/clang/store/removevirtuals.cxx b/compilerplugins/clang/store/removevirtuals.cxx index c2bf4841d30d..18aebb41e479 100644 --- a/compilerplugins/clang/store/removevirtuals.cxx +++ b/compilerplugins/clang/store/removevirtuals.cxx @@ -53,7 +53,7 @@ static size_t getFilesize(const char* filename) RemoveVirtuals::RemoveVirtuals(InstantiationData const & data): RewritePlugin(data) { - static const char sInputFile[] = "/home/noel/libo4/result.txt"; + static const char sInputFile[] = "/home/noel/libo5/result.txt"; mmapFilesize = getFilesize(sInputFile); //Open file mmapFD = open(sInputFile, O_RDONLY, 0); @@ -120,14 +120,26 @@ bool RemoveVirtuals::VisitCXXMethodDecl( const CXXMethodDecl* functionDecl ) return true; } if (functionDecl->isPure()) { - removeText(functionDecl->getSourceRange()); + if (!removeText(functionDecl->getSourceRange())) { + report( + DiagnosticsEngine::Warning, + "Could not remove unused pure virtual method", + functionDecl->getLocStart()) + << functionDecl->getSourceRange(); + } } else { std::string aOrigText = rewriter->getRewrittenText(functionDecl->getSourceRange()); size_t iVirtualTokenIndex = aOrigText.find_first_of("virtual "); if (iVirtualTokenIndex == std::string::npos) { return true; } - replaceText(functionDecl->getSourceRange(), aOrigText.replace(iVirtualTokenIndex, strlen("virtual "), "")); + if (!replaceText(functionDecl->getSourceRange(), aOrigText.replace(iVirtualTokenIndex, strlen("virtual "), ""))) { + report( + DiagnosticsEngine::Warning, + "Could not remove virtual qualifier from method", + functionDecl->getLocStart()) + << functionDecl->getSourceRange(); + } } return true; } diff --git a/compilerplugins/clang/store/unnecessaryvirtual.cxx b/compilerplugins/clang/store/unnecessaryvirtual.cxx index 0ead077473de..53688cb03a46 100644 --- a/compilerplugins/clang/store/unnecessaryvirtual.cxx +++ b/compilerplugins/clang/store/unnecessaryvirtual.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include "plugin.hxx" #include "compat.hxx" @@ -20,15 +21,14 @@ Then we will post-process the 2 lists and find the set of virtual methods which The process goes something like this: $ make check $ make FORCE_COMPILE_ALL=1 COMPILER_PLUGIN_TOOL='unnecessaryvirtual' check > log.txt - $ grep 'definition' log.txt | cut -f 2 | sort -u > definition.txt - $ grep 'overriding' log.txt | cut -f 2 | sort -u > overriding.txt - $ cat definition.txt overriding.txt | sort | uniq -u > result.txt - $ echo "\n" >> result.txt - $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done + $ ./compilerplugins/clang/unnecessaryvirtual.py log.txt > result.txt + $ for dir in *; do make FORCE_COMPILE_ALL=1 UPDATE_FILES=$dir COMPILER_PLUGIN_TOOL='removevirtuals' $dir; done Note that the actual process may involve a fair amount of undoing, hand editing, and general messing around to get it to work :-) -Notably templates tend to confuse it into removing stuff that is still needed. + +TODO function template instantiations are not handled +TODO some boost bind stuff appears to confuse it, notably in the xmloff module */ namespace { @@ -41,8 +41,10 @@ public: virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } - bool VisitCXXMethodDecl( const CXXMethodDecl* var ); - + bool VisitCXXRecordDecl( const CXXRecordDecl* decl ); + bool VisitCXXMethodDecl( const CXXMethodDecl* decl ); + bool VisitCXXConstructExpr( const CXXConstructExpr* expr ); + void printTemplateInstantiations( const CXXRecordDecl *decl ); }; static std::string niceName(const CXXMethodDecl* functionDecl) @@ -62,48 +64,189 @@ static std::string niceName(const CXXMethodDecl* functionDecl) return s; } +static bool startsWith(const std::string& s, const char* other) +{ + return s.compare(0, strlen(other), other) == 0; +} + +static bool isStandardStuff(const std::string& s) +{ + // ignore UNO interface definitions, cannot change those + return startsWith(s, "com::sun::star::") + // ignore stuff in the C++ stdlib and boost + || startsWith(s, "std::") || startsWith(s, "boost::") || startsWith(s, "__gnu_debug::") + // can't change our rtl layer + || startsWith(s, "rtl::"); +} + +void UnnecessaryVirtual::printTemplateInstantiations( const CXXRecordDecl *recordDecl ) +{ + for(auto functionDecl = recordDecl->method_begin(); + functionDecl != recordDecl->method_end(); ++functionDecl) + { + if (!functionDecl->isUserProvided() || !functionDecl->isVirtual()) { + continue; + } + if (isa(*functionDecl)) { + continue; + } + std::string aNiceName = niceName(*functionDecl); + if (isStandardStuff(aNiceName)) { + continue; + } + if (functionDecl->size_overridden_methods() == 0) { + cout << "definition:\t" << aNiceName << endl; + } else { + for (auto iter = functionDecl->begin_overridden_methods(); + iter != functionDecl->end_overridden_methods(); ++iter) + { + const CXXMethodDecl *pOverriddenMethod = *iter; + // we only care about the first level override to establish that a virtual qualifier was useful. + if (pOverriddenMethod->isPure() || pOverriddenMethod->size_overridden_methods() == 0) { + std::string aOverriddenNiceName = niceName(pOverriddenMethod); + if (isStandardStuff(aOverriddenNiceName)) { + continue; + } + cout << "overriding:\t" << aOverriddenNiceName << endl; + } + } + } + } + for(auto baseSpecifier = recordDecl->bases_begin(); + baseSpecifier != recordDecl->bases_end(); ++baseSpecifier) + { + QualType qt = baseSpecifier->getType().getDesugaredType(compiler.getASTContext()); + if (!qt->isRecordType()) { + continue; + } + const CXXRecordDecl *pSuperclassCXXRecordDecl = qt->getAsCXXRecordDecl(); + std::string aNiceName = pSuperclassCXXRecordDecl->getQualifiedNameAsString(); + if (isStandardStuff(aNiceName)) { + continue; + } + printTemplateInstantiations(pSuperclassCXXRecordDecl); + } +} + +// I need to check construct expressions to see if we are instantiating any templates +// which will effectively generate new methods +bool UnnecessaryVirtual::VisitCXXConstructExpr( const CXXConstructExpr* constructExpr ) +{ + if (ignoreLocation(constructExpr)) { + return true; + } + const CXXConstructorDecl* pConstructorDecl = constructExpr->getConstructor(); + const CXXRecordDecl* recordDecl = pConstructorDecl->getParent(); + printTemplateInstantiations(recordDecl); + return true; +} + +// I need to visit class definitions, so I can scan through the classes they extend to check if +// we have any template instantiations that will create new methods +bool UnnecessaryVirtual::VisitCXXRecordDecl( const CXXRecordDecl* recordDecl ) +{ + if (ignoreLocation(recordDecl)) { + return true; + } + if(!recordDecl->hasDefinition()) { + return true; + } + // ignore uninstantiated templates + if (recordDecl->getTemplateInstantiationPattern()) { + return true; + } + // ignore stuff that forms part of the stable URE interface + if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc( + recordDecl->getLocation()))) { + return true; + } + for(auto baseSpecifier = recordDecl->bases_begin(); + baseSpecifier != recordDecl->bases_end(); ++baseSpecifier) + { + QualType qt = baseSpecifier->getType().getDesugaredType(compiler.getASTContext()); + if (!qt->isRecordType()) { + continue; + } + const CXXRecordDecl *pSuperclassCXXRecordDecl = qt->getAsCXXRecordDecl(); + printTemplateInstantiations(pSuperclassCXXRecordDecl); + } + return true; +} + bool UnnecessaryVirtual::VisitCXXMethodDecl( const CXXMethodDecl* functionDecl ) { if (ignoreLocation(functionDecl)) { return true; } functionDecl = functionDecl->getCanonicalDecl(); + // ignore uninstantiated template methods + if (functionDecl->getTemplatedKind() != FunctionDecl::TemplatedKind::TK_NonTemplate + || functionDecl->getParent()->getDescribedClassTemplate() != nullptr) { + return true; + } // ignore stuff that forms part of the stable URE interface if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc( functionDecl->getNameInfo().getLoc()))) { return true; } - if (!functionDecl->isVirtual()) { + if (isStandardStuff(functionDecl->getParent()->getQualifiedNameAsString())) { return true; } - // ignore UNO interface definitions, cannot change those - static const char cssPrefix[] = "com::sun::star"; - if (functionDecl->getParent()->getQualifiedNameAsString().compare(0, strlen(cssPrefix), cssPrefix) == 0) { + + std::string aNiceName = niceName(functionDecl); + + // for destructors, we need to check if any of the superclass' destructors are virtual + if (isa(functionDecl)) { + /* TODO I need to check if the base class has any virtual functions, since overriding + classes will simply get a compiler-provided virtual destructor by default. + + if (!functionDecl->isVirtual() && !functionDecl->isPure()) { + return true; + } + std::set overriddenSet; + const CXXRecordDecl *pRecordDecl = functionDecl->getParent(); + for(auto baseSpecifier = pRecordDecl->bases_begin(); + baseSpecifier != pRecordDecl->bases_end(); ++baseSpecifier) + { + if (baseSpecifier->getType()->isRecordType()) + { + const CXXRecordDecl *pSuperclassCXXRecordDecl = baseSpecifier->getType()->getAsCXXRecordDecl(); + if (pSuperclassCXXRecordDecl->getDestructor()) + { + std::string aOverriddenNiceName = niceName(pSuperclassCXXRecordDecl->getDestructor()); + overriddenSet.insert(aOverriddenNiceName); + } + } + } + if (overriddenSet.empty()) { + cout << "definition:\t" << aNiceName << endl; + } else { + for(std::string s : overriddenSet) + cout << "overriding:\t" << s << endl; + }*/ return true; } - std::string aNiceName = niceName(functionDecl); - // Ignore virtual destructors for now. - // I cannot currently detect the case where we are overriding a pure virtual destructor. - if (dyn_cast(functionDecl)) { + + if (!functionDecl->isVirtual()) { + return true; + } + if (isStandardStuff(aNiceName)) { return true; } if (functionDecl->size_overridden_methods() == 0) { - // ignore definition of virtual functions in templates -// if (functionDecl->getTemplatedKind() != FunctionDecl::TK_NonTemplate -// && functionDecl->getParent()->getDescribedClassTemplate() == nullptr) -// { - cout << "definition\t" << aNiceName << endl; -// } + cout << "definition:\t" << aNiceName << endl; } else { - for (CXXMethodDecl::method_iterator iter = functionDecl->begin_overridden_methods(); iter != functionDecl->end_overridden_methods(); ++iter) { + for (auto iter = functionDecl->begin_overridden_methods(); + iter != functionDecl->end_overridden_methods(); ++iter) + { const CXXMethodDecl *pOverriddenMethod = *iter; // we only care about the first level override to establish that a virtual qualifier was useful. - if (pOverriddenMethod->size_overridden_methods() == 0) { - // ignore UNO interface definitions, cannot change those - if (pOverriddenMethod->getParent()->getQualifiedNameAsString().compare(0, strlen(cssPrefix), cssPrefix) != 0) { - std::string aOverriddenNiceName = niceName(pOverriddenMethod); - cout << "overriding\t" << aOverriddenNiceName << endl; + if (pOverriddenMethod->isPure() || pOverriddenMethod->size_overridden_methods() == 0) { + std::string aOverriddenNiceName = niceName(pOverriddenMethod); + if (isStandardStuff(aOverriddenNiceName)) { + continue; } + cout << "overriding:\t" << aOverriddenNiceName << endl; } } } diff --git a/connectivity/source/drivers/file/fanalyzer.cxx b/connectivity/source/drivers/file/fanalyzer.cxx index 00e9f387d2d7..3abf3ebea6e4 100644 --- a/connectivity/source/drivers/file/fanalyzer.cxx +++ b/connectivity/source/drivers/file/fanalyzer.cxx @@ -129,17 +129,6 @@ void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvalu OOperandAttr* pAttr = PTR_CAST(OOperandAttr,(*aIter)); if (pAttr) { - if (pAttr->isIndexed() && !m_aCompiler->hasORCondition()) - { - OCode* pCode1 = *(aIter + 1); - OCode* pCode2 = *(aIter + 2); - - if (PTR_CAST(OOperand,pCode1)) - pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode2), PTR_CAST(OOperand,pCode1)); - else - pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode1)); - } - if (pEvaluateSet) { _rEvaluateSetList.push_back(pEvaluateSet); diff --git a/connectivity/source/drivers/file/fcode.cxx b/connectivity/source/drivers/file/fcode.cxx index 73a72421903d..96793912a33e 100644 --- a/connectivity/source/drivers/file/fcode.cxx +++ b/connectivity/source/drivers/file/fcode.cxx @@ -102,11 +102,6 @@ void OOperandValue::setValue(const ORowSetValue& _rVal) m_aValue = _rVal; } -bool OOperandAttr::isIndexed() const -{ - return false; -} - OOperandParam::OOperandParam(OSQLParseNode* pNode, sal_Int32 _nPos) : OOperandRow(static_cast(_nPos), DataType::VARCHAR) // Standard-Type { diff --git a/connectivity/source/drivers/file/fcomp.cxx b/connectivity/source/drivers/file/fcomp.cxx index 69168cf20b9b..b901ff53376d 100644 --- a/connectivity/source/drivers/file/fcomp.cxx +++ b/connectivity/source/drivers/file/fcomp.cxx @@ -451,7 +451,7 @@ OOperand* OPredicateCompiler::execute_Operand(OSQLParseNode* pPredicateNode) thr { if (m_orgColumns->getByName(aColumnName) >>= xCol) { - pOperand = m_pAnalyzer->createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol,m_xIndexes); + pOperand = OSQLAnalyzer::createOperandAttr(Reference< XColumnLocate>(m_orgColumns,UNO_QUERY)->findColumn(aColumnName),xCol,m_xIndexes); } else {// Column doesn't exist in the Result-set diff --git a/connectivity/source/inc/file/fanalyzer.hxx b/connectivity/source/inc/file/fanalyzer.hxx index dc6d0febf384..2f47e6d8b519 100644 --- a/connectivity/source/inc/file/fanalyzer.hxx +++ b/connectivity/source/inc/file/fanalyzer.hxx @@ -41,7 +41,7 @@ namespace connectivity mutable bool m_bHasSelectionCode; mutable bool m_bSelectionFirstTime; - void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList); + static void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList); public: OSQLAnalyzer(OConnection* _pConnection); @@ -76,7 +76,7 @@ namespace connectivity inline bool evaluateRestriction() { return m_aInterpreter->start(); } void setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std::vector& _rColumnMapping); void setOrigColumns(const OFileColumns& rCols); - virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos, + static OOperandAttr* createOperandAttr(sal_Int32 _nPos, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes=NULL); }; diff --git a/connectivity/source/inc/file/fcode.hxx b/connectivity/source/inc/file/fcode.hxx index 681a3e4310d7..2c59dfd9f44b 100644 --- a/connectivity/source/inc/file/fcode.hxx +++ b/connectivity/source/inc/file/fcode.hxx @@ -108,7 +108,6 @@ namespace connectivity OOperandAttr(sal_uInt16 _nPos, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn); - virtual bool isIndexed() const; virtual OEvaluateSet* preProcess(OBoolOperator* pOp, OOperand* pRight = 0) SAL_OVERRIDE; TYPEINFO_OVERRIDE(); }; diff --git a/dbaccess/source/core/api/querydescriptor.hxx b/dbaccess/source/core/api/querydescriptor.hxx index a447818891ce..cbf12e5d981e 100644 --- a/dbaccess/source/core/api/querydescriptor.hxx +++ b/dbaccess/source/core/api/querydescriptor.hxx @@ -100,7 +100,7 @@ protected: */ virtual void rebuildColumns( ); - virtual void disposeColumns(); + void disposeColumns(); // IRefreshableColumns overridables virtual void refreshColumns() SAL_OVERRIDE; diff --git a/dbaccess/source/core/dataaccess/commanddefinition.hxx b/dbaccess/source/core/dataaccess/commanddefinition.hxx index 58640a08e3a0..18469f916267 100644 --- a/dbaccess/source/core/dataaccess/commanddefinition.hxx +++ b/dbaccess/source/core/dataaccess/commanddefinition.hxx @@ -125,17 +125,17 @@ public: { OComponentDefinition::removeEventListener(p1); } // XQueryDefinition properties - virtual OUString getName() throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString getCommand() throw( ::com::sun::star::uno::RuntimeException ); - virtual void setCommand(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); - virtual bool getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException ); - virtual void setEscapeProcessing(bool) throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString getUpdateTableName() throw( ::com::sun::star::uno::RuntimeException ); - virtual void setUpdateTableName(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString getUpdateCatalogName() throw( ::com::sun::star::uno::RuntimeException ); - virtual void setUpdateCatalogName(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); - virtual OUString getUpdateSchemaName() throw( ::com::sun::star::uno::RuntimeException ); - virtual void setUpdateSchemaName(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); + OUString getName() throw( ::com::sun::star::uno::RuntimeException ); + OUString getCommand() throw( ::com::sun::star::uno::RuntimeException ); + void setCommand(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); + bool getEscapeProcessing() throw( ::com::sun::star::uno::RuntimeException ); + void setEscapeProcessing(bool) throw( ::com::sun::star::uno::RuntimeException ); + OUString getUpdateTableName() throw( ::com::sun::star::uno::RuntimeException ); + void setUpdateTableName(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); + OUString getUpdateCatalogName() throw( ::com::sun::star::uno::RuntimeException ); + void setUpdateCatalogName(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); + OUString getUpdateSchemaName() throw( ::com::sun::star::uno::RuntimeException ); + void setUpdateSchemaName(const OUString&) throw( ::com::sun::star::uno::RuntimeException ); // OPropertySetHelper DECLARE_PROPERTYCONTAINER_DEFAULTS( ); diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx index 764610351ae0..73b8b2ab3763 100644 --- a/dbaccess/source/core/inc/TableDeco.hxx +++ b/dbaccess/source/core/inc/TableDeco.hxx @@ -119,7 +119,7 @@ namespace dbaccess ) throw(::com::sun::star::sdbc::SQLException); // ODescriptor - virtual void construct(); + void construct(); //XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; diff --git a/dbaccess/source/core/inc/definitioncolumn.hxx b/dbaccess/source/core/inc/definitioncolumn.hxx index 0fad23fb64fa..d615c55929f3 100644 --- a/dbaccess/source/core/inc/definitioncolumn.hxx +++ b/dbaccess/source/core/inc/definitioncolumn.hxx @@ -209,7 +209,7 @@ namespace dbaccess ) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE; - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); protected: OUString impl_getPropertyNameFromHandle( const sal_Int32 _nHandle ) const; diff --git a/dbaccess/source/ui/dlg/generalpage.hxx b/dbaccess/source/ui/dlg/generalpage.hxx index b30c592abdc7..30b012cb7031 100644 --- a/dbaccess/source/ui/dlg/generalpage.hxx +++ b/dbaccess/source/ui/dlg/generalpage.hxx @@ -181,7 +181,7 @@ namespace dbaui ::std::vector< OUString> m_aEmbeddedURLPrefixes; - virtual OUString getEmbeddedDBName( const SfxItemSet& _rSet ); + OUString getEmbeddedDBName( const SfxItemSet& _rSet ); void initializeEmbeddedDBList(); protected: diff --git a/dbaccess/source/ui/dlg/tablespage.hxx b/dbaccess/source/ui/dlg/tablespage.hxx index a5dc8e8e9dbc..884ef4a499a9 100644 --- a/dbaccess/source/ui/dlg/tablespage.hxx +++ b/dbaccess/source/ui/dlg/tablespage.hxx @@ -58,7 +58,7 @@ namespace dbaui /** will be called when the controls need to be resized. */ - virtual void resizeControls(const Size& _rDiff); + void resizeControls(const Size& _rDiff); OTableSubscriptionPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ,OTableSubscriptionDialog* _pTablesDlg); virtual ~OTableSubscriptionPage(); diff --git a/extensions/source/propctrlr/commoncontrol.hxx b/extensions/source/propctrlr/commoncontrol.hxx index adddbb01f4d9..758ff19ceb95 100644 --- a/extensions/source/propctrlr/commoncontrol.hxx +++ b/extensions/source/propctrlr/commoncontrol.hxx @@ -137,7 +137,7 @@ namespace pcr void SAL_CALL notifyModifiedValue( ) throw (::com::sun::star::uno::RuntimeException); // XComponent - virtual void SAL_CALL dispose(); + void SAL_CALL dispose(); /** (fail-safe) wrapper around calling our context's activateNextControl */ diff --git a/include/svl/svdde.hxx b/include/svl/svdde.hxx index 598aa3d7c384..a616268b5a75 100644 --- a/include/svl/svdde.hxx +++ b/include/svl/svdde.hxx @@ -89,8 +89,8 @@ public: class SVL_DLLPUBLIC DdeTransaction { public: - virtual void Data( const DdeData* ); - virtual void Done( bool bDataValid ); + void Data( const DdeData* ); + void Done( bool bDataValid ); protected: DdeConnection& rDde; DdeData aDdeData; @@ -146,7 +146,7 @@ public: void SetNotifyHdl( const Link<>& rLink ) { aNotify = rLink; } const Link<>& GetNotifyHdl() const { return aNotify; } - virtual void Notify(); + void Notify(); }; @@ -288,18 +288,17 @@ class SVL_DLLPUBLIC DdeTopic SVL_DLLPRIVATE void _Disconnect( sal_IntPtr ); public: - virtual void Connect( sal_IntPtr ); - virtual void Disconnect( sal_IntPtr ); + void Connect( sal_IntPtr ); + void Disconnect( sal_IntPtr ); virtual DdeData* Get(SotClipboardFormatId); - virtual bool Put( const DdeData* ); - virtual bool Execute( const OUString* ); + virtual bool Put( const DdeData* ); + virtual bool Execute( const OUString* ); // Eventually create a new item. return 0 -> Item creation failed - virtual bool MakeItem( const OUString& rItem ); - + virtual bool MakeItem( const OUString& rItem ); // A Warm-/Hot-Link is created. Return true if successful virtual bool StartAdviseLoop(); - virtual bool StopAdviseLoop(); + bool StopAdviseLoop(); private: friend class DdeInternal; @@ -357,18 +356,18 @@ class SVL_DLLPUBLIC DdeService friend class DdeInternal; public: - virtual bool IsBusy(); - virtual OUString GetHelp(); + bool IsBusy(); + OUString GetHelp(); // Eventually creating a new item. return 0 -> Topic creation failed - virtual bool MakeTopic( const OUString& rItem ); + bool MakeTopic( const OUString& rItem ); protected: - virtual OUString Topics(); - virtual OUString Formats(); - virtual OUString SysItems(); - virtual OUString Status(); - virtual OUString SysTopicGet( const OUString& ); - virtual bool SysTopicExecute( const OUString* ); + OUString Topics(); + OUString Formats(); + OUString SysItems(); + OUString Status(); + OUString SysTopicGet( const OUString& ); + bool SysTopicExecute( const OUString* ); const DdeTopic* GetSysTopic() const { return pSysTopic; } private: diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index d2dd6de07466..d0dec9fe7be5 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -540,7 +540,7 @@ namespace svt // should be used instead of GetFieldRectPixel, 'cause this method here takes into account the borders Rectangle GetCellRect(long nRow, sal_uInt16 nColId, bool bRelToBrowser = true) const; virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId); - virtual sal_uInt32 GetAutoColumnWidth(sal_uInt16 nColId); + sal_uInt32 GetAutoColumnWidth(sal_uInt16 nColId); virtual void PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const; virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId) const = 0; @@ -570,14 +570,14 @@ namespace svt virtual CellController* GetController(long nRow, sal_uInt16 nCol); virtual void InitController(CellControllerRef& rController, long nRow, sal_uInt16 nCol); - virtual void ResizeController(CellControllerRef& rController, const Rectangle&); - virtual void ReleaseController(CellControllerRef& pController, long nRow, sal_uInt16 nCol); + static void ResizeController(CellControllerRef& rController, const Rectangle&); + static void ReleaseController(CellControllerRef& pController, long nRow, sal_uInt16 nCol); virtual void DoubleClick(const BrowserMouseEvent&) SAL_OVERRIDE; void ActivateCell() { ActivateCell(GetCurRow(), GetCurColumnId()); } // retrieve the image for the row status - virtual Image GetImage(RowStatus) const; + Image GetImage(RowStatus) const; // inserting columns // if you don't set a width, this will be calculated automatically diff --git a/include/svx/fmgridcl.hxx b/include/svx/fmgridcl.hxx index 7bb356852b28..55e12d0ad030 100644 --- a/include/svx/fmgridcl.hxx +++ b/include/svx/fmgridcl.hxx @@ -173,7 +173,7 @@ protected: // Initialize columns // a.) only by column description - virtual void InitColumnsByModels(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& xColumns); + void InitColumnsByModels(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& xColumns); // b.) during alivemode by database fields virtual void InitColumnsByFields(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xFields) SAL_OVERRIDE; diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx index d752b881e064..330a26b4345a 100644 --- a/include/svx/fmgridif.hxx +++ b/include/svx/fmgridif.hxx @@ -514,8 +514,8 @@ protected: Instead it may use addColumnListeners and removeColumnListeners which are called in all the cases. */ - virtual void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol); - virtual void removeColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol); + void addColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol); + void removeColumnListeners(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xCol); void selectionChanged(); void columnChanged(); diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx index 677e4c9e5595..a672738596ed 100644 --- a/include/svx/gridctrl.hxx +++ b/include/svx/gridctrl.hxx @@ -324,8 +324,8 @@ protected: virtual bool IsModified() const SAL_OVERRIDE; virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth = 0, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = (sal_uInt16)-1) SAL_OVERRIDE; - virtual void RemoveColumn(sal_uInt16 nId); - virtual DbGridColumn* CreateColumn(sal_uInt16 nId) const; + void RemoveColumn(sal_uInt16 nId); + DbGridColumn* CreateColumn(sal_uInt16 nId) const; virtual void ColumnMoved(sal_uInt16 nId) SAL_OVERRIDE; virtual bool SaveRow() SAL_OVERRIDE; virtual bool IsTabAllowed(bool bForward) const SAL_OVERRIDE; @@ -347,12 +347,12 @@ protected: */ virtual void PostExecuteRowContextMenu(sal_uInt16 nRow, const PopupMenu& rMenu, sal_uInt16 nExecutionResult); - virtual void DataSourcePropertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + void DataSourcePropertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); - virtual void FieldValueChanged(sal_uInt16 _nId, const ::com::sun::star::beans::PropertyChangeEvent& _evt); - virtual void FieldListenerDisposing(sal_uInt16 _nId); + void FieldValueChanged(sal_uInt16 _nId, const ::com::sun::star::beans::PropertyChangeEvent& _evt); + void FieldListenerDisposing(sal_uInt16 _nId); - virtual void disposing(sal_uInt16 _nId, const ::com::sun::star::lang::EventObject& _rEvt); + void disposing(sal_uInt16 _nId, const ::com::sun::star::lang::EventObject& _rEvt); // own overridables /// called when the current row changed @@ -396,7 +396,7 @@ public: // the data source // the options can restrict but not extend the update abilities - virtual void setDataSource(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& rCursor, + void setDataSource(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& rCursor, sal_uInt16 nOpts = OPT_INSERT | OPT_UPDATE | OPT_DELETE); virtual void Dispatch(sal_uInt16 nId) SAL_OVERRIDE; @@ -426,7 +426,7 @@ public: bool IsDesignMode() const {return m_bDesignMode;} bool IsOpen() const {return m_pSeekCursor != NULL;} - virtual void SetFilterMode(bool bMode); + void SetFilterMode(bool bMode); bool IsFilterMode() const {return m_bFilterMode;} bool IsFilterRow(long nRow) const {return m_bFilterMode && nRow == 0;} @@ -463,9 +463,9 @@ public: // is the current line being updated bool IsUpdating() const {return m_bUpdating;} - virtual void RowRemoved( long nRow, long nNumRows = 1, bool bDoPaint = true ); - virtual void RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false ); - virtual void RowModified( long nRow, sal_uInt16 nColId = USHRT_MAX ); + void RowRemoved( long nRow, long nNumRows = 1, bool bDoPaint = true ); + void RowInserted( long nRow, long nNumRows = 1, bool bDoPaint = true, bool bKeepSelection = false ); + void RowModified( long nRow, sal_uInt16 nColId = USHRT_MAX ); void resetCurrentRow(); diff --git a/include/test/beans/xpropertyset.hxx b/include/test/beans/xpropertyset.hxx index 19f06356faab..e53cee26e5c5 100644 --- a/include/test/beans/xpropertyset.hxx +++ b/include/test/beans/xpropertyset.hxx @@ -32,7 +32,7 @@ public: void testGetPropertyValue(); protected: - virtual bool isPropertyValueChangeable(const OUString& rName); + bool isPropertyValueChangeable(const OUString& rName); private: void fillPropsToTest(const css::uno::Reference& xPropInfo); diff --git a/include/vcl/scheduler.hxx b/include/vcl/scheduler.hxx index 5ce31e2db795..dfa1483132b2 100644 --- a/include/vcl/scheduler.hxx +++ b/include/vcl/scheduler.hxx @@ -73,7 +73,7 @@ public: virtual void Invoke() = 0; virtual void Start(); - virtual void Stop(); + void Stop(); bool IsActive() const { return mbActive; } void SetInActive() { mbActive = false; } diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 0aa057d21828..a18debc6bbe7 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -837,7 +837,7 @@ protected: OutputDevice::DrawGradientWallpaper(nX, nY, nWidth, nHeight, rWallpaper); } - virtual void DrawGradientWallpaper(vcl::RenderContext& rRenderContext, long nX, long nY, + void DrawGradientWallpaper(vcl::RenderContext& rRenderContext, long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper); virtual void ApplySettings(vcl::RenderContext& rRenderContext); @@ -863,7 +863,7 @@ public: virtual void PrePaint(vcl::RenderContext& rRenderContext); virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect); virtual void PostPaint(vcl::RenderContext& rRenderContext); - virtual void Erase(vcl::RenderContext& rRenderContext); + void Erase(vcl::RenderContext& rRenderContext); virtual void Erase() SAL_OVERRIDE { diff --git a/lotuswordpro/source/filter/lwpoleobject.hxx b/lotuswordpro/source/filter/lwpoleobject.hxx index bcbc8674d86e..a06dbc9eca32 100644 --- a/lotuswordpro/source/filter/lwpoleobject.hxx +++ b/lotuswordpro/source/filter/lwpoleobject.hxx @@ -102,7 +102,7 @@ class LwpGraphicOleObject : public LwpContent public: LwpGraphicOleObject(LwpObjectHeader& objHdr, LwpSvStream* pStrm); virtual void Read() SAL_OVERRIDE; - virtual void GetGrafScaledSize(double& fWidth, double& fHeight); + void GetGrafScaledSize(double& fWidth, double& fHeight); virtual void GetGrafOrgSize(double& rWidth, double& rHeight); protected: LwpObjectID m_pPrevObj; diff --git a/lotuswordpro/source/filter/lwpparastyle.hxx b/lotuswordpro/source/filter/lwpparastyle.hxx index 42bcb4a2a50f..f1d67b2a0505 100644 --- a/lotuswordpro/source/filter/lwpparastyle.hxx +++ b/lotuswordpro/source/filter/lwpparastyle.hxx @@ -82,9 +82,9 @@ public: virtual ~LwpParaStyle(); - void Read() SAL_OVERRIDE; + void Read() SAL_OVERRIDE; - virtual void Apply(XFParaStyle *pStrm); + void Apply(XFParaStyle *pStrm); // 01/26/2005 static void ApplyParaBorder(XFParaStyle* pParaStyle, LwpParaBorderOverride* pBorder); static void ApplyBreaks(XFParaStyle* pParaStyle, LwpBreaksOverride* pBreaks); diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 7cfeeb1294b0..d2af571ef927 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -1110,7 +1110,7 @@ public: static const ::com::sun::star::uno::Sequence& getUnoTunnelId(); // painting the filter text - virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect); + void PaintCell(OutputDevice& rDev, const Rectangle& rRect); void Update(){m_pCellControl->Update();} // OComponentHelper diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx index 9e82f39ece7c..5364eedb954f 100644 --- a/vcl/inc/sallayout.hxx +++ b/vcl/inc/sallayout.hxx @@ -345,7 +345,7 @@ public: // used by upper layers virtual DeviceCoordinate GetTextWidth() const SAL_OVERRIDE; - virtual Rectangle GetTextRect() const; + Rectangle GetTextRect() const; virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const SAL_OVERRIDE; virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const SAL_OVERRIDE; virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const SAL_OVERRIDE; -- cgit