[Libreoffice-commits] core.git: bin/find-unused-typedefs.py bin/find-unused-typedefs.sh framework/inc include/basic onlineupdate/source shell/source svx/source ucb/source vcl/inc
Noel Grandin
noel at peralex.com
Mon Aug 3 01:53:42 PDT 2015
bin/find-unused-typedefs.py | 16 +++++++++++
bin/find-unused-typedefs.sh | 26 +++++++++++++++++++
framework/inc/classes/filtercachedata.hxx | 2 -
include/basic/sbxprop.hxx | 1
onlineupdate/source/update/inc/nsWindowsHelpers.h | 4 --
shell/source/tools/lngconvex/defs.hxx | 1
svx/source/accessibility/AccessibleFrameSelector.cxx | 1
ucb/source/ucp/webdav-neon/NeonTypes.hxx | 1
vcl/inc/quartz/salvd.h | 1
9 files changed, 42 insertions(+), 11 deletions(-)
New commits:
commit f5deb463492d5e61e573ba9d533df97c555280d7
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 3 08:44:51 2015 +0200
remove some unused typedefs
Change-Id: I98c1e7eaa66b7afb05255a017a3de54714637501
Reviewed-on: https://gerrit.libreoffice.org/17491
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/bin/find-unused-typedefs.py b/bin/find-unused-typedefs.py
new file mode 100755
index 0000000..e261d13
--- /dev/null
+++ b/bin/find-unused-typedefs.py
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+
+import subprocess
+
+a = subprocess.Popen("git grep -P '^typedef\s+.+\w+;' -- \"[!e][!x][!t]*\"", stdout=subprocess.PIPE, shell=True)
+
+with a.stdout as txt:
+ for line in txt:
+ idx1 = line.rfind(" ")
+ typedefName = line[idx1+1 : len(line)-2]
+ if typedefName.startswith("*"):
+ typedefName = typedefName[1:]
+ # ignore anything less than 5 characters, it's probably a parsing error
+ if len(typedefName) > 4:
+ print typedefName
+
diff --git a/bin/find-unused-typedefs.sh b/bin/find-unused-typedefs.sh
new file mode 100755
index 0000000..a8039f5
--- /dev/null
+++ b/bin/find-unused-typedefs.sh
@@ -0,0 +1,26 @@
+#
+# This is a pretty brute-force approach. It takes several hours to run on a top-spec MacbookAir.
+# It also produces some false positives, so it requires careful examination and testing of the results.
+#
+# Algorithm Summary:
+# First we find all #defines,
+# then we search for each of them in turn,
+# and if we find only one instance of a #define, we print it out.
+#
+# Algorithm Detail:
+# (1) find #defines, excluding the externals folder
+# (2) extract just the constant name from the search results
+# (3) trim blank lines
+# (4) sort the results, mostly so I have an idea how far along the process is
+# (5) for each result:
+# (6) grep for the constant
+# (7) use awk to to check if only one match for a given constant was found
+# (8) if so, generate a sed command to remove the #define
+#
+bin/find-unused-typedefs.py \
+ | sort \
+ | uniq \
+ | xargs -Ixxx -n 1 -P 8 sh -c \
+ "( git grep -w 'xxx' | awk -f bin/find-unused-defines.awk -v p1=xxx ) && echo \"xxx\" 1>&2"
+
+
diff --git a/framework/inc/classes/filtercachedata.hxx b/framework/inc/classes/filtercachedata.hxx
index 395b89d..b01fbbc 100644
--- a/framework/inc/classes/filtercachedata.hxx
+++ b/framework/inc/classes/filtercachedata.hxx
@@ -365,8 +365,6 @@ typedef SetNodeHash< ContentHandler > ContentHandl
typedef OUStringHashMap PreferredHash;
typedef OUStringList OrderList;
-typedef CheckedIterator< OUStringList > CheckedStringListIterator;
-typedef CheckedIterator< FileTypeHash > CheckedTypeIterator;
// Use private static data container to hold all values of configuration!
diff --git a/include/basic/sbxprop.hxx b/include/basic/sbxprop.hxx
index 6587b7f..699fd1d 100644
--- a/include/basic/sbxprop.hxx
+++ b/include/basic/sbxprop.hxx
@@ -36,7 +36,6 @@ public:
virtual SbxClassType GetClass() const SAL_OVERRIDE;
};
-typedef tools::SvRef<SbxProperty> SbxPropertyRef;
#endif
diff --git a/onlineupdate/source/update/inc/nsWindowsHelpers.h b/onlineupdate/source/update/inc/nsWindowsHelpers.h
index c928429..0a64354 100644
--- a/onlineupdate/source/update/inc/nsWindowsHelpers.h
+++ b/onlineupdate/source/update/inc/nsWindowsHelpers.h
@@ -119,10 +119,6 @@ public:
}
};
-typedef nsAutoRef<HKEY> nsAutoRegKey;
-typedef nsAutoRef<SC_HANDLE> nsAutoServiceHandle;
-typedef nsAutoRef<HANDLE> nsAutoHandle;
-typedef nsAutoRef<HMODULE> nsModuleHandle;
namespace {
diff --git a/shell/source/tools/lngconvex/defs.hxx b/shell/source/tools/lngconvex/defs.hxx
index db562e8..8674587 100644
--- a/shell/source/tools/lngconvex/defs.hxx
+++ b/shell/source/tools/lngconvex/defs.hxx
@@ -26,7 +26,6 @@
typedef std::vector<std::string> StringList_t;
-typedef std::vector<int> IntegerList_t;
#endif
diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx
index 1a22ae6..9c26619 100644
--- a/svx/source/accessibility/AccessibleFrameSelector.cxx
+++ b/svx/source/accessibility/AccessibleFrameSelector.cxx
@@ -62,7 +62,6 @@ namespace AwtFocusChangeReason = ::com::sun::star::awt::FocusChangeReason;
typedef ::com::sun::star::awt::Point AwtPoint;
typedef ::com::sun::star::awt::Size AwtSize;
typedef ::com::sun::star::awt::Rectangle AwtRectangle;
-typedef ::com::sun::star::awt::KeyEvent AwtKeyEvent;
typedef ::com::sun::star::awt::FocusEvent AwtFocusEvent;
diff --git a/ucb/source/ucp/webdav-neon/NeonTypes.hxx b/ucb/source/ucp/webdav-neon/NeonTypes.hxx
index b1748c3..3e2a7c5 100644
--- a/ucb/source/ucp/webdav-neon/NeonTypes.hxx
+++ b/ucb/source/ucp/webdav-neon/NeonTypes.hxx
@@ -46,7 +46,6 @@
typedef ne_session HttpSession;
typedef ne_status HttpStatus;
-typedef ne_server_capabilities HttpServerCapabilities;
typedef ne_propname NeonPropName;
typedef ne_prop_result_set NeonPropFindResultSet;
diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h
index b380988..90843d7 100644
--- a/vcl/inc/quartz/salvd.h
+++ b/vcl/inc/quartz/salvd.h
@@ -37,7 +37,6 @@ struct SalVirDevData
};
typedef struct SalVirDevData SalVirDevData;
-typedef SalVirDevData** SalVirDevDataHandle;
class AquaSalGraphics;
More information about the Libreoffice-commits
mailing list