[Libreoffice-commits] core.git: bin/find-headers-to-move-inside-modules.py include/cppcanvas include/sfx2 include/unotest solenv/clang-format

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Feb 2 18:39:33 UTC 2020


 bin/find-headers-to-move-inside-modules.py |   52 ++++++++++++++++++++++++++++
 include/cppcanvas/font.hxx                 |   41 ----------------------
 include/sfx2/sidebar/ToolBox.hxx           |   53 -----------------------------
 include/unotest/assertion_traits.hxx       |   42 ----------------------
 solenv/clang-format/blacklist              |    2 -
 5 files changed, 52 insertions(+), 138 deletions(-)

New commits:
commit 14b6fae258fe74c5cccf1e6d63ff32ae698d0f6c
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Feb 2 12:51:23 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Feb 2 19:38:58 2020 +0100

    remove some unused headers
    
    found with a little python script(include) and some grepping, so probably
    not 100% reliable.
    
    Change-Id: I1a26a37ef7297c2cc07ed5fd2e0af45280e64c13
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87824
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/bin/find-headers-to-move-inside-modules.py b/bin/find-headers-to-move-inside-modules.py
new file mode 100755
index 000000000000..c8a9dc989069
--- /dev/null
+++ b/bin/find-headers-to-move-inside-modules.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+# Look for headers inside include/ that can be moved into their respective modules.
+
+import subprocess
+import sys
+
+headerSet = set()
+a = subprocess.Popen("git ls-files include/", stdout=subprocess.PIPE, shell=True)
+with a.stdout as txt:
+    for line in txt:
+        header = line[8:].strip();
+        if "README" in header: continue
+        if header == "version.hrc": continue
+        if header == "svtools/editimplementation.hxx": continue
+        # ignore URE headers
+        if header.startswith("IwyuFilter_include.yaml"): continue
+        if header.startswith("cppu/"): continue
+        if header.startswith("cppuhelper/"): continue
+        if header.startswith("osl/"): continue
+        if header.startswith("sal/"): continue
+        if header.startswith("salhelper/"): continue
+        if header.startswith("uno/"): continue
+        # these are direct copies of mozilla code
+        if header.startswith("onlineupdate/mozilla/"): continue
+        headerSet.add(header)
+
+headerSetUnused = headerSet.copy()
+headerSetOnlyInOwnModule = headerSet.copy()
+a = subprocess.Popen("git grep '^#include <'", stdout=subprocess.PIPE, shell=True)
+with a.stdout as txt:
+    for line in txt:
+        idx1 = line.find("#include <")
+        include = line[idx1 + 10 : len(line)-2]
+        headerSetUnused.discard(include)
+        #
+        idx1 = line.find("/")
+        includedFromModule = line[0 : idx1]
+        idx1 = include.find("/")
+        module = include[0 : idx1]
+        if module != includedFromModule:
+            headerSetOnlyInOwnModule.discard(include)
+
+print "completely unused"
+print "----------------------------"
+for x in sorted(headerSetUnused):
+    print x
+print ""
+print "only used in own module"
+print "----------------------------"
+for x in sorted(headerSetOnlyInOwnModule):
+    print x
diff --git a/include/cppcanvas/font.hxx b/include/cppcanvas/font.hxx
deleted file mode 100644
index e52a5778f56f..000000000000
--- a/include/cppcanvas/font.hxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_CPPCANVAS_FONT_HXX
-#define INCLUDED_CPPCANVAS_FONT_HXX
-
-#include <memory>
-
-/* Definition of Font class */
-
-namespace cppcanvas
-{
-
-    class Font
-    {
-    public:
-        virtual ~Font() {}
-    };
-
-    typedef std::shared_ptr< ::cppcanvas::Font > FontSharedPtr;
-}
-
-#endif // INCLUDED_CPPCANVAS_FONT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/sidebar/ToolBox.hxx b/include/sfx2/sidebar/ToolBox.hxx
deleted file mode 100644
index 834d7cb2b7a0..000000000000
--- a/include/sfx2/sidebar/ToolBox.hxx
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SFX2_SOURCE_SIDEBAR_TOOLBOX_HXX
-#define INCLUDED_SFX2_SOURCE_SIDEBAR_TOOLBOX_HXX
-
-#include <vcl/toolbox.hxx>
-
-namespace sfx2 { namespace sidebar {
-
-class ToolBox
-    : public ::ToolBox
-{
-public:
-    MenuButton (vcl::Window* pParentWindow);
-    virtual ~MenuButton();
-
-    virtual void Paint (const Rectangle& rUpdateArea);
-    virtual void MouseMove (const MouseEvent& rEvent);
-    virtual void MouseButtonDown (const MouseEvent& rMouseEvent);
-    virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
-
-protected:
-    using CheckBox::FillLayoutData;
-
-private:
-    bool mbIsLeftButtonDown;
-    enum PaintType {
-        PT_Native,
-        PT_Theme
-    } mePaintType;
-};
-
-} } // end of namespace sfx2::sidebar
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotest/assertion_traits.hxx b/include/unotest/assertion_traits.hxx
deleted file mode 100644
index da6d8d87d0ee..000000000000
--- a/include/unotest/assertion_traits.hxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_UNOTEST_ASSERTION_TRAITS_HXX
-#define INCLUDED_UNOTEST_ASSERTION_TRAITS_HXX
-
-// sal/types.h declares typedefs to signed char (sal_Int8) and unsigned char
-// (sal_uInt8, sal_Bool), so better specialize CppUnit::assertion_traits for
-// those two types to treat the toString() value as an integer rather than a
-// character:
-
-#include <sal/config.h>
-
-#include <string>
-
-namespace CppUnit {
-
-template<> struct assertion_traits<signed char> {
-    static bool equal(signed char x, signed char y) { return x == y; }
-
-    static std::string toString(signed char x)
-    { return std::to_string(static_cast<int>(x)); }
-};
-
-template<> struct assertion_traits<unsigned char> {
-    static bool equal(unsigned char x, unsigned char y) { return x == y; }
-
-    static std::string toString(unsigned char x)
-    { return std::to_string(static_cast<unsigned int>(x)); }
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 10be36f3b785..454e57c4d1d1 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -6736,7 +6736,6 @@ include/sfx2/sidebar/TabBar.hxx
 include/sfx2/sidebar/TabItem.hxx
 include/sfx2/sidebar/Theme.hxx
 include/sfx2/sidebar/TitleBar.hxx
-include/sfx2/sidebar/ToolBox.hxx
 include/sfx2/sidebar/Tools.hxx
 include/sfx2/sidebar/UnoDeck.hxx
 include/sfx2/sidebar/UnoDecks.hxx
@@ -7599,7 +7598,6 @@ include/uno/sequence2.h
 include/uno/threadpool.h
 include/unoidl/detail/dllapi.hxx
 include/unoidl/unoidl.hxx
-include/unotest/assertion_traits.hxx
 include/unotest/bootstrapfixturebase.hxx
 include/unotest/detail/unotestdllapi.hxx
 include/unotest/directories.hxx


More information about the Libreoffice-commits mailing list