summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-02-02 12:51:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-02 19:38:58 +0100
commit14b6fae258fe74c5cccf1e6d63ff32ae698d0f6c (patch)
treebf9f9333c263b57f30d7c75e59c298f41f40f219 /bin
parentff546a5dd35d6a31f01c70a9b995afc1f7b7389e (diff)
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@collabora.co.uk>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/find-headers-to-move-inside-modules.py52
1 files changed, 52 insertions, 0 deletions
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