summaryrefslogtreecommitdiffstats
path: root/bin/find-unused-defines.py
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-05 10:54:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-06 07:41:36 +0100
commit0c1ca08318bd370280e124ea05d9bf0d2535d3e1 (patch)
treebe8a131324a78b1c6459838a2cd691e182bfc6cf /bin/find-unused-defines.py
parentuse std::unique_ptr in GDIMetaFile (diff)
downloadcore-0c1ca08318bd370280e124ea05d9bf0d2535d3e1.tar.gz
core-0c1ca08318bd370280e124ea05d9bf0d2535d3e1.zip
remove unused defines
In particular, the STR_SVT_MIMETYPE defines are dead since commit 1b694dad643334ec1bab3f823dcd68f44a05ebe3 Date: Thu Aug 24 22:14:27 2017 +0200 loplugin:unusedmethods Change-Id: I641ec0a14efedc55c9d6a4de4a28784c273602e9 Reviewed-on: https://gerrit.libreoffice.org/47464 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'bin/find-unused-defines.py')
-rwxr-xr-xbin/find-unused-defines.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/find-unused-defines.py b/bin/find-unused-defines.py
index 2c08cc6cd342..ad96c0c24118 100755
--- a/bin/find-unused-defines.py
+++ b/bin/find-unused-defines.py
@@ -119,6 +119,12 @@ with a.stdout as txt:
cnt = 0
for line2 in txt2:
line2 = line2.strip() # otherwise the comparisons below will not work
+ # ignore if/undef magic, does not indicate an actual use (most of the time)
+ if "ifdef" in line2: continue
+ if "undef" in line2: continue
+ # ignore commented out code
+ if line2.startswith("//"): continue
+ if line2.startswith("/*"): continue
# check if we found one in actual code
if idName.startswith("SID_"):
if not ".hrc:" in line2 and not ".src:" in line2 and not ".sdi:" in line2: found_reason_to_exclude = True
@@ -143,8 +149,6 @@ with a.stdout as txt:
if "sw/source/uibase/inc/ribbar.hrc:" in line2 and "STR_IMGBTN_" in idName: found_reason_to_exclude = True
if "sw/source/core/undo/undo.hrc:" in line2: found_reason_to_exclude = True
if "sw/inc/poolfmt.hrc:" in line2: found_reason_to_exclude = True
- # not sure about these, looks suspicious
- if "sd/source/ui/app/strings.src:" in line2 and idName.endswith("_TOOLBOX"): found_reason_to_exclude = True
# used via a macro that hides them from search
if "dbaccess/" in line2 and idName.startswith("PROPERTY_ID_"): found_reason_to_exclude = True
if "reportdesign/" in line2 and idName.startswith("HID_RPT_PROP_"): found_reason_to_exclude = True