[Libreoffice-commits] core.git: compilerplugins/clang dbaccess/source editeng/source idlc/inc include/editeng include/sfx2 include/svl include/svtools include/tools include/vcl io/source sfx2/source svtools/source

Noel Grandin noel at peralex.com
Mon Aug 8 13:07:33 UTC 2016


 compilerplugins/clang/store/unnecessaryvirtual.cxx       |  228 ---------------
 compilerplugins/clang/store/unnecessaryvirtual.py        |   28 -
 compilerplugins/clang/unnecessaryvirtual.cxx             |  228 +++++++++++++++
 compilerplugins/clang/unnecessaryvirtual.py              |   37 ++
 dbaccess/source/core/inc/ContentHelper.hxx               |    2 
 editeng/source/accessibility/AccessibleComponentBase.cxx |   17 -
 idlc/inc/astscope.hxx                                    |    2 
 include/editeng/AccessibleComponentBase.hxx              |   13 
 include/sfx2/objsh.hxx                                   |    2 
 include/sfx2/templatelocalview.hxx                       |    6 
 include/sfx2/thumbnailviewitem.hxx                       |    2 
 include/svl/style.hxx                                    |    2 
 include/svtools/brwbox.hxx                               |    1 
 include/svtools/parrtf.hxx                               |    4 
 include/tools/stream.hxx                                 |    2 
 include/vcl/outdev.hxx                                   |    2 
 io/source/stm/streamhelper.hxx                           |    2 
 sfx2/source/notebookbar/DropdownBox.hxx                  |    4 
 svtools/source/brwbox/brwbox2.cxx                        |    5 
 svtools/source/brwbox/datwin.cxx                         |    2 
 svtools/source/inc/svimpbox.hxx                          |    2 
 21 files changed, 281 insertions(+), 310 deletions(-)

New commits:
commit 602647c2417e0e19e44f9c35a49fbb88ff8ac261
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Aug 8 09:57:25 2016 +0200

    loplugin:unnecessaryvirtual
    
    Change-Id: If25d9307efda5f57b0f80a0cf5c2c5cab6a752d6
    Reviewed-on: https://gerrit.libreoffice.org/27981
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/compilerplugins/clang/store/unnecessaryvirtual.py b/compilerplugins/clang/store/unnecessaryvirtual.py
deleted file mode 100755
index e05f16c..0000000
--- a/compilerplugins/clang/store/unnecessaryvirtual.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/python
-
-import sys
-import io
-
-definitionSet = set()
-overridingSet = set()
-
-
-with io.open(sys.argv[1], "rb", buffering=1024*1024) as txt:
-    for line in txt:
-    
-        if line.startswith("definition:\t"):
-            idx1 = line.find("\t")
-            clazzName = line[idx1+1 : len(line)-1]
-            definitionSet.add(clazzName)
-            
-        elif line.startswith("overriding:\t"):
-            idx1 = line.find("\t")
-            clazzName = line[idx1+1 : len(line)-1]
-            overridingSet.add(clazzName)
-            
-for clazz in sorted(definitionSet - overridingSet):
-    print clazz
-
-# add an empty line at the end to make it easier for the removevirtuals plugin to mmap() the output file 
-print
-
diff --git a/compilerplugins/clang/store/unnecessaryvirtual.cxx b/compilerplugins/clang/unnecessaryvirtual.cxx
similarity index 98%
rename from compilerplugins/clang/store/unnecessaryvirtual.cxx
rename to compilerplugins/clang/unnecessaryvirtual.cxx
index 463fc23..2964748 100644
--- a/compilerplugins/clang/store/unnecessaryvirtual.cxx
+++ b/compilerplugins/clang/unnecessaryvirtual.cxx
@@ -22,7 +22,7 @@ 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
-  $ ./compilerplugins/clang/unnecessaryvirtual.py unnecessaryvirtual.log > result.txt
+  $ ./compilerplugins/clang/unnecessaryvirtual.py
   $ 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
@@ -56,7 +56,7 @@ public:
         for (const std::string & s : overridingSet)
             output += "overriding:\t" + s + "\n";
         ofstream myfile;
-        myfile.open( SRCDIR "/unnecessaryvirtual.log", ios::app | ios::out);
+        myfile.open( SRCDIR "/loplugin.unnecessaryvirtual.log", ios::app | ios::out);
         myfile << output;
         myfile.close();
     }
diff --git a/compilerplugins/clang/unnecessaryvirtual.py b/compilerplugins/clang/unnecessaryvirtual.py
new file mode 100755
index 0000000..cd56137
--- /dev/null
+++ b/compilerplugins/clang/unnecessaryvirtual.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+import sys
+import io
+
+definitionSet = set()
+overridingSet = set()
+
+
+with io.open("loplugin.unnecessaryvirtual.log", "rb", buffering=1024*1024) as txt:
+    for line in txt:
+    
+        if line.startswith("definition:\t"):
+            idx1 = line.find("\t")
+            clazzName = line[idx1+1 : len(line)-1]
+            definitionSet.add(clazzName)
+            
+        elif line.startswith("overriding:\t"):
+            idx1 = line.find("\t")
+            clazzName = line[idx1+1 : len(line)-1]
+            overridingSet.add(clazzName)
+            
+with open("loplugin.unnecessaryvirtual.report", "wt") as f:
+    for clazz in sorted(definitionSet - overridingSet):
+        # external code
+        if clazz.startswith("std::"): continue
+        if clazz.startswith("icu_"): continue
+        if clazz.startswith("__cxx"): continue
+        # windows-specific stuff
+        if clazz.startswith("canvas::"): continue
+        if clazz.startswith("psp::PrinterInfoManager"): continue
+        # some test magic
+        if clazz.startswith("apitest::"): continue
+        f.write(clazz + "\n")
+    # add an empty line at the end to make it easier for the removevirtuals plugin to mmap() the output file 
+    f.write("\n")
+
diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx
index c83001f..287e13b 100644
--- a/dbaccess/source/core/inc/ContentHelper.hxx
+++ b/dbaccess/source/core/inc/ContentHelper.hxx
@@ -115,7 +115,7 @@ namespace dbaccess
         // helper
         virtual void SAL_CALL disposing() override;
 
-        virtual void notifyDataSourceModified();
+        void notifyDataSourceModified();
 
         /**
         * This method can be used to propagate changes of property values.
diff --git a/editeng/source/accessibility/AccessibleComponentBase.cxx b/editeng/source/accessibility/AccessibleComponentBase.cxx
index 5feb3d0..495f84f 100644
--- a/editeng/source/accessibility/AccessibleComponentBase.cxx
+++ b/editeng/source/accessibility/AccessibleComponentBase.cxx
@@ -98,23 +98,6 @@ css::awt::Size SAL_CALL AccessibleComponentBase::getSize()
 }
 
 
-void SAL_CALL AccessibleComponentBase::addFocusListener (
-    const css::uno::Reference<
-    css::awt::XFocusListener >& /*xListener*/)
-    throw (css::uno::RuntimeException)
-{
-    // Ignored
-}
-
-
-void SAL_CALL AccessibleComponentBase::removeFocusListener (const css::uno::Reference<
-    css::awt::XFocusListener >& /*xListener*/ )
-    throw (css::uno::RuntimeException)
-{
-    // Ignored
-}
-
-
 void SAL_CALL AccessibleComponentBase::grabFocus()
     throw (css::uno::RuntimeException, std::exception)
 {
diff --git a/idlc/inc/astscope.hxx b/idlc/inc/astscope.hxx
index 9db54d6..7a4e475 100644
--- a/idlc/inc/astscope.hxx
+++ b/idlc/inc/astscope.hxx
@@ -34,7 +34,7 @@ public:
     NodeType getScopeNodeType() const
         { return m_nodeType; }
 
-    virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl);
+    AstDeclaration* addDeclaration(AstDeclaration* pDecl);
 
     sal_uInt32 nMembers() const
         { return (sal_uInt32)(m_declarations.size()); }
diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx
index 929de95..c5ae524 100644
--- a/include/editeng/AccessibleComponentBase.hxx
+++ b/include/editeng/AccessibleComponentBase.hxx
@@ -87,19 +87,6 @@ public:
     virtual css::awt::Size SAL_CALL getSize()
         throw (css::uno::RuntimeException, std::exception) override;
 
-    /** The default implementation ignores this call.
-    */
-    virtual void SAL_CALL addFocusListener (
-        const css::uno::Reference<
-        css::awt::XFocusListener >& xListener)
-        throw (css::uno::RuntimeException);
-
-    /** The default implementation ignores this call.
-    */
-    virtual void SAL_CALL removeFocusListener (const css::uno::Reference<
-        css::awt::XFocusListener >& xListener )
-        throw (css::uno::RuntimeException);
-
     /** The default implementation does nothing.
     */
     virtual void SAL_CALL grabFocus()
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index cc4b74c..3c7f9e8 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -435,7 +435,7 @@ public:
     static sal_uInt32           HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDoc );
 
     virtual bool                PrepareClose(bool bUI = true);
-    virtual bool                IsInformationLost();
+    bool                        IsInformationLost();
     virtual HiddenInformation   GetHiddenInformationState( HiddenInformation nStates );
     sal_Int16                   QueryHiddenInformation( HiddenWarningFact eFact, vcl::Window* pParent );
     bool                        IsSecurityOptOpenReadOnly() const;
diff --git a/include/sfx2/templatelocalview.hxx b/include/sfx2/templatelocalview.hxx
index 3db8397..f139b26 100644
--- a/include/sfx2/templatelocalview.hxx
+++ b/include/sfx2/templatelocalview.hxx
@@ -87,13 +87,13 @@ public:
     void insertItems (const std::vector<TemplateItemProperties> &rTemplates, bool isRegionSelected = true, bool bShowCategoryInTooltip = false);
 
     // Fill view with template folders thumbnails
-    virtual void Populate ();
+    void Populate ();
 
     virtual void reload ();
 
     virtual void showAllTemplates ();
 
-    virtual void showRegion (TemplateContainerItem *pItem);
+    void showRegion (TemplateContainerItem *pItem);
 
     void showRegion (const OUString &rName);
 
@@ -116,7 +116,7 @@ public:
     std::vector<TemplateItemProperties>
         getFilteredItems (const std::function<bool (const TemplateItemProperties&) > &rFunc) const;
 
-    virtual sal_uInt16 createRegion (const OUString &rName);
+    sal_uInt16 createRegion (const OUString &rName);
 
     bool renameRegion(const OUString &rTitle, const OUString &rNewTitle);
 
diff --git a/include/sfx2/thumbnailviewitem.hxx b/include/sfx2/thumbnailviewitem.hxx
index ed3c423..b39c1d2 100644
--- a/include/sfx2/thumbnailviewitem.hxx
+++ b/include/sfx2/thumbnailviewitem.hxx
@@ -105,7 +105,7 @@ public:
     void setHelpText (const OUString &sText) { maHelpText = sText; }
 
     virtual OUString getHelpText() const { return maHelpText; };
-    virtual OUString getTitle() const { return maTitle; };
+    OUString getTitle() const { return maTitle; };
 
     void setTitle (const OUString& rTitle);
 
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index b0acd32..c82ff8c 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -95,7 +95,7 @@ protected:
     SfxStyleSheetBase( const SfxStyleSheetBase& );
     virtual ~SfxStyleSheetBase();
     virtual void Load( SvStream&, sal_uInt16 );
-    virtual void Store( SvStream& );
+    void Store( SvStream& );
 
 public:
 
diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx
index 132a550..b7d72e9 100644
--- a/include/svtools/brwbox.hxx
+++ b/include/svtools/brwbox.hxx
@@ -388,7 +388,6 @@ private:
 protected:
     // callbacks for the data window
     virtual void    ImplStartTracking();
-    virtual void    ImplTracking();
     virtual void    ImplEndTracking();
 
 public:
diff --git a/include/svtools/parrtf.hxx b/include/svtools/parrtf.hxx
index 871dac5..b913a99 100644
--- a/include/svtools/parrtf.hxx
+++ b/include/svtools/parrtf.hxx
@@ -53,8 +53,8 @@ protected:
     virtual int GetNextToken_() override;
 
     void ReadUnknownData();
-    virtual void ReadBitmapData();
-    virtual void ReadOLEData();
+    void ReadBitmapData();
+    void ReadOLEData();
 
     virtual ~SvRTFParser();
 
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 4475433..7d5726a 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -121,7 +121,7 @@ public:
 
     const SvStream * GetStream() const { return m_pStream; }
 
-    virtual void    SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; }
+    void            SetSynchronMode(bool bTheSync = true) { m_bSync = bTheSync; }
     bool            IsSynchronMode() const { return m_bSync; }
 
     virtual ErrCode ReadAt(sal_uInt64 nPos, void * pBuffer, sal_Size nCount,
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index ff331a5..9bfc0d6 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -972,7 +972,7 @@ public:
     virtual void                Erase( const Rectangle& rRect ) { DrawWallpaper( rRect, GetBackground() ); }
 
 protected:
-    virtual void                DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
+    void                        DrawGradientWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
 
 private:
     SAL_DLLPRIVATE void         DrawWallpaper( long nX, long nY, long nWidth, long nHeight, const Wallpaper& rWallpaper );
diff --git a/io/source/stm/streamhelper.hxx b/io/source/stm/streamhelper.hxx
index a9edbb1..519d0e7 100644
--- a/io/source/stm/streamhelper.hxx
+++ b/io/source/stm/streamhelper.hxx
@@ -47,7 +47,7 @@ public:
     sal_Int32   getSize() const throw();
     void    forgetFromStart(sal_Int32 nBytesToForget) throw(css::io::BufferSizeExceededException);
 
-    virtual void shrink() throw();
+    void shrink() throw();
 
 private:
 
diff --git a/sfx2/source/notebookbar/DropdownBox.hxx b/sfx2/source/notebookbar/DropdownBox.hxx
index cf6011b..d0794b3 100644
--- a/sfx2/source/notebookbar/DropdownBox.hxx
+++ b/sfx2/source/notebookbar/DropdownBox.hxx
@@ -42,8 +42,8 @@ public:
     virtual ~DropdownBox() override;
     virtual void dispose() override;
 
-    virtual void HideContent();
-    virtual void ShowContent();
+    void HideContent();
+    void ShowContent();
 
 private:
     DECL_LINK_TYPED(PBClickHdl, Button*, void);
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 45fa1c4..5245edc 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -191,11 +191,6 @@ void BrowseBox::ImplStartTracking()
 }
 
 
-void BrowseBox::ImplTracking()
-{
-}
-
-
 void BrowseBox::ImplEndTracking()
 {
 }
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index 392140b..ceb5c3a 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -559,8 +559,6 @@ void BrowserDataWin::Tracking( const TrackingEvent& rTEvt )
     }
     else
     {
-        GetParent()->ImplTracking();
-
         long nDragRowDividerCurrentPos = aMousePos.Y() + m_nDragRowDividerOffset;
 
         // care for minimum row height
diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx
index 5c18142..7ba18da 100644
--- a/svtools/source/inc/svimpbox.hxx
+++ b/svtools/source/inc/svimpbox.hxx
@@ -276,7 +276,7 @@ public:
     virtual void        UpdateAll( bool bInvalidateCompleteView );
     void                SetEntryHeight( short nHeight );
     void                InvalidateEntry( SvTreeListEntry* );
-    virtual void        RecalcFocusRect();
+    void                RecalcFocusRect();
 
     void SelectEntry( SvTreeListEntry* pEntry, bool bSelect );
     void                SetDragDropMode( DragDropMode eDDMode );


More information about the Libreoffice-commits mailing list