diff options
29 files changed, 42 insertions, 48 deletions
diff --git a/bin/find-unused-using.sh b/bin/find-unused-using.sh new file mode 100755 index 000000000000..3521f64f49fd --- /dev/null +++ b/bin/find-unused-using.sh @@ -0,0 +1,42 @@ +# 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/. +#!/bin/bash + +# TODO search also for 'using namespace com/::com/css' - this is likely the fattest target and clang-tidy can't do it +for ns in accessibility basegfx chart com css cppu comphelper connectivity formula dbtools editeng rtl sfx2 svt osl oox sax_fastparser sal sd ucbhelper utl vcl xmloff; do + echo "Searching for namespace: $ns"; + # search in cxx files, excluding URE headers, plus some files with false positives + for file in $(git grep -l "^\s*using :*$ns::" *hxx *cxx \ + ':!include/com/' \ + ':!include/cppu/' \ + ':!include/cppuhelper/' \ + ':!include/osl/' \ + ':!include/rtl/' \ + ':!include/sal/' \ + ':!include/salhelper/' \ + ':!include/systools/' \ + ':!include/typelib/' \ + ':!include/uno/' \ + ':!include/sfx2/stbitem.hxx' \ + ':!sw/source/uibase/inc/maildispatcher.hxx' + ) ; do + for class in $(git grep -h "using :*$ns::" "$file" | rev | cut -d : -f -1 | rev | cut -d " " -f 1 | tr -d ";") ; do + if [ "$ns" == "com" ] ; then # com namespace may be mentioned in relevant header name too + if [[ $(grep -c "$class" "$file") -eq 1 || $(grep -c "$class" "$file") -le 2 && $(grep -c -e "$class".hpp -e "$class".hxx -e "$class".h "$file") -eq 1 ]]; then + echo "$file"; + echo "Class name in above file is mentioned once or twice: $class"; + fi + else + if [ $(grep -c -F "$class" "$file") -eq 1 ]; then + echo "$file"; + echo "Class name in above file is mentioned once: $class"; + fi + fi + done + done +done + +# vim: set noet sw=4 ts=4: diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx index 4d5abf1e229c..995a0f92cf4d 100644 --- a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx @@ -32,7 +32,6 @@ using namespace ::com::sun::star; using ::com::sun::star::beans::Property; -using ::osl::MutexGuard; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 5e1c76958ab4..f5cc10484417 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -79,7 +79,6 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; using ::com::sun::star::chart::XAxis; -using ::osl::MutexGuard; namespace { diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx index edf955b43f7f..9ec8f02819ef 100644 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx @@ -42,7 +42,6 @@ using namespace ::com::sun::star; using ::com::sun::star::beans::Property; -using ::osl::MutexGuard; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index edd88fc96393..75d6c9e98f1f 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -43,7 +43,6 @@ using namespace ::com::sun::star; using ::com::sun::star::beans::Property; -using ::osl::MutexGuard; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx index bc6f15505471..dc5742aef63b 100644 --- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx @@ -34,7 +34,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; using ::com::sun::star::beans::Property; -using ::osl::MutexGuard; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; diff --git a/chart2/source/tools/CachedDataSequence.cxx b/chart2/source/tools/CachedDataSequence.cxx index 440e9f736fb6..d0f4c93ee848 100644 --- a/chart2/source/tools/CachedDataSequence.cxx +++ b/chart2/source/tools/CachedDataSequence.cxx @@ -35,8 +35,6 @@ using ::osl::MutexGuard; // necessary for MS compiler using ::comphelper::OPropertyContainer; -using ::comphelper::OMutexAndBroadcastHelper; -using ::comphelper::OPropertyArrayUsageHelper; using ::chart::impl::CachedDataSequence_Base; namespace diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 5edb3949c977..d26a30e0ff20 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -51,7 +51,6 @@ using ::com::sun::star::task::PasswordRequestMode; using ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER; using ::com::sun::star::task::PasswordRequestMode_PASSWORD_REENTER; using ::com::sun::star::task::XInteractionHandler; -using ::com::sun::star::task::XInteractionRequest; using namespace ::com::sun::star; diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx index aa443bad8350..8e07123a2b0f 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.cxx +++ b/connectivity/source/drivers/postgresql/pq_driver.cxx @@ -40,8 +40,6 @@ #include "pq_driver.hxx" -using osl::MutexGuard; - using com::sun::star::uno::Sequence; using com::sun::star::uno::Reference; using com::sun::star::uno::XInterface; diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index c761f8afe370..f51ff855b3a8 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -47,12 +47,10 @@ namespace dbaccess { using css::uno::Reference; - using css::uno::XInterface; using css::uno::UNO_QUERY; using css::uno::UNO_QUERY_THROW; using css::uno::UNO_SET_THROW; using css::uno::Exception; - using css::uno::RuntimeException; using css::uno::Any; using css::uno::Sequence; using css::uno::XComponentContext; diff --git a/dbaccess/source/ui/misc/controllerframe.cxx b/dbaccess/source/ui/misc/controllerframe.cxx index 67696042d9da..365e144390c0 100644 --- a/dbaccess/source/ui/misc/controllerframe.cxx +++ b/dbaccess/source/ui/misc/controllerframe.cxx @@ -42,7 +42,6 @@ namespace dbaui using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; using ::com::sun::star::frame::XFrame; using ::com::sun::star::frame::FrameAction; diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 304b8e5ebf94..3646cf09b6cd 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -117,7 +117,6 @@ namespace pcr using com::sun::star::uri::UriReferenceFactory; using com::sun::star::uri::XUriReferenceFactory; using com::sun::star::uri::XVndSunStarScriptUrlReference; - using ::com::sun::star::lang::XEventListener; namespace PropertyControlType = css::inspection::PropertyControlType; namespace PropertyAttribute = css::beans::PropertyAttribute; diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index 9cb97988d97e..368673a88318 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -55,8 +55,6 @@ using com::sun::star::form::submission::XSubmissionVetoListener; using com::sun::star::lang::WrappedTargetException; using com::sun::star::lang::NoSupportException; using com::sun::star::task::XInteractionHandler; -using com::sun::star::task::XInteractionRequest; -using com::sun::star::task::XInteractionContinuation; using com::sun::star::xforms::XModel; using com::sun::star::xforms::InvalidDataOnSubmitException; using com::sun::star::xml::xpath::XXPathObject; diff --git a/fpicker/source/office/contentenumeration.cxx b/fpicker/source/office/contentenumeration.cxx index 6ac33673909e..2a5b0156480a 100644 --- a/fpicker/source/office/contentenumeration.cxx +++ b/fpicker/source/office/contentenumeration.cxx @@ -63,7 +63,6 @@ namespace svt using ::com::sun::star::ucb::CommandAbortedException; using ::com::sun::star::ucb::XContentAccess; using ::com::sun::star::ucb::XCommandEnvironment; - using ::ucbhelper::ResultSetInclude; using ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS; diff --git a/fpicker/source/win32/WinImplHelper.cxx b/fpicker/source/win32/WinImplHelper.cxx index 5d6e20d92319..9f81f6b60ffc 100644 --- a/fpicker/source/win32/WinImplHelper.cxx +++ b/fpicker/source/win32/WinImplHelper.cxx @@ -24,12 +24,6 @@ #include <rtl/ustrbuf.hxx> #include <com/sun/star/uno/Sequence.hxx> -using ::com::sun::star::lang::IllegalArgumentException; -using ::com::sun::star::uno::Reference; -using ::com::sun::star::uno::XInterface; -using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::Sequence; - const sal_Unicode TILDE_SIGN = L'~'; const sal_Unicode AMPERSAND_SIGN = L'&'; diff --git a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx index a36e801382f7..d0fc8141db1d 100644 --- a/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/ListenerHelper.cxx @@ -26,7 +26,6 @@ using com::sun::star::frame::XDispatch; using com::sun::star::frame::XStatusListener; using com::sun::star::lang::EventObject; using com::sun::star::uno::Reference; -using com::sun::star::uno::RuntimeException; using com::sun::star::frame::FeatureStateEvent; static AllListeners aListeners; diff --git a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx index b67d3c93fb68..44201fb3be01 100644 --- a/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx +++ b/odk/examples/cpp/complextoolbarcontrols/MyJob.cxx @@ -31,9 +31,6 @@ using com::sun::star::uno::Reference; using com::sun::star::uno::Any; using com::sun::star::uno::UNO_QUERY; using com::sun::star::uno::XInterface; -using com::sun::star::uno::Exception; -using com::sun::star::uno::RuntimeException; -using com::sun::star::lang::IllegalArgumentException; using com::sun::star::lang::XMultiServiceFactory; using com::sun::star::beans::NamedValue; using com::sun::star::document::XEventBroadcaster; diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 40f59f9b0151..69345ad42989 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -1055,8 +1055,6 @@ void lcl_syncFlags(const ScDocument* pDocument, ScFlatBoolColSegments& rColSegme ScBitMaskCompressedArray<SCCOL, CRFlags>* pColFlags, ScBitMaskCompressedArray<SCROW, CRFlags>* pRowFlags, const CRFlags nFlagMask) { - using ::sal::static_int_cast; - CRFlags nFlagMaskComplement = ~nFlagMask; pRowFlags->AndValue(0, pDocument->MaxRow(), nFlagMaskComplement); diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 71b08db448f0..218ec3c3b28f 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -71,7 +71,6 @@ #include <string_view> using ::osl::MutexGuard; -using ::osl::ClearableMutexGuard; using ::com::sun::star::table::BorderLine; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx index 1e8d21d6034c..94f416c2d786 100644 --- a/sfx2/source/doc/docundomanager.cxx +++ b/sfx2/source/doc/docundomanager.cxx @@ -39,7 +39,6 @@ namespace sfx2 using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; - using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; using ::com::sun::star::document::XUndoAction; using ::com::sun::star::lang::NotInitializedException; diff --git a/shell/source/win32/simplemail/smplmailclient.cxx b/shell/source/win32/simplemail/smplmailclient.cxx index b4bef54ef15f..d40577892cb3 100644 --- a/shell/source/win32/simplemail/smplmailclient.cxx +++ b/shell/source/win32/simplemail/smplmailclient.cxx @@ -46,7 +46,6 @@ using css::uno::UNO_QUERY; using css::uno::Reference; using css::uno::Exception; -using css::uno::RuntimeException; using css::uno::Sequence; using css::lang::IllegalArgumentException; diff --git a/shell/source/win32/simplemail/smplmailsuppl.cxx b/shell/source/win32/simplemail/smplmailsuppl.cxx index 8fbd89b21c95..6f4eb0ea09a9 100644 --- a/shell/source/win32/simplemail/smplmailsuppl.cxx +++ b/shell/source/win32/simplemail/smplmailsuppl.cxx @@ -27,7 +27,6 @@ #include <windows.h> using com::sun::star::uno::Reference; -using com::sun::star::uno::RuntimeException; using com::sun::star::uno::Sequence; using com::sun::star::lang::XServiceInfo; using com::sun::star::system::XSimpleMailClientSupplier; diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index db211cae16dc..27eddc715420 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -109,7 +109,6 @@ namespace sdr::contact { using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; - using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::awt::XControl; using ::com::sun::star::awt::XControlModel; using ::com::sun::star::awt::XControlContainer; diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx index 8753cf46cbae..f3e19683419c 100644 --- a/vcl/win/dtrans/MtaOleClipb.cxx +++ b/vcl/win/dtrans/MtaOleClipb.cxx @@ -48,11 +48,6 @@ #include <comphelper/windowserrorstring.hxx> -// namespace directives - -using osl::MutexGuard; -using osl::ClearableMutexGuard; - namespace /* private */ { const wchar_t g_szWndClsName[] = L"MtaOleReqWnd###"; diff --git a/writerperfect/source/common/DocumentHandler.cxx b/writerperfect/source/common/DocumentHandler.cxx index bfa9bb53a5d2..28730ab5ee99 100644 --- a/writerperfect/source/common/DocumentHandler.cxx +++ b/writerperfect/source/common/DocumentHandler.cxx @@ -108,7 +108,6 @@ static void unescapeXML(const char* s, const unsigned long sz, librevenge::RVNGS } using com::sun::star::uno::Reference; -using com::sun::star::xml::sax::XAttributeList; using com::sun::star::xml::sax::XDocumentHandler; DocumentHandler::DocumentHandler(Reference<XDocumentHandler> const& xHandler) diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index 68b29fd2d3c7..cd3d40eb144e 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -53,8 +53,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::lang ; -using ::com::sun::star::lang::XMultiServiceFactory ; -using ::com::sun::star::lang::XSingleServiceFactory ; using ::com::sun::star::xml::crypto::XSecurityEnvironment ; using ::com::sun::star::security::XCertificate ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx index 7d71d4863894..f024a39b4791 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx @@ -30,8 +30,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::lang ; -using ::com::sun::star::lang::XMultiServiceFactory ; -using ::com::sun::star::lang::XSingleServiceFactory ; using ::com::sun::star::xml::crypto::XSecurityEnvironment ; using ::com::sun::star::xml::crypto::XXMLSecurityContext ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx index d20aa649efdb..2a3709938a59 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx @@ -38,11 +38,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno ; using namespace ::com::sun::star::lang ; -using ::com::sun::star::lang::XMultiServiceFactory ; -using ::com::sun::star::lang::XSingleServiceFactory ; using ::com::sun::star::xml::wrapper::XXMLElementWrapper ; -using ::com::sun::star::xml::wrapper::XXMLDocumentWrapper ; using ::com::sun::star::xml::crypto::XSecurityEnvironment ; using ::com::sun::star::xml::crypto::XXMLSignature ; using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ; diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index aa0b0c2d4612..32ece48520d6 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -57,7 +57,6 @@ using namespace com::sun::star; using namespace ::com::sun::star::uno ; using namespace ::com::sun::star::lang ; -using ::com::sun::star::xml::crypto::XSecurityEnvironment ; using ::com::sun::star::security::XCertificate ; namespace std |