summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-03 15:53:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 11:42:37 +0200
commitf59d9e7ea09482c2e9e5f52a8d0445e4cebc3df5 (patch)
tree32660175a848b4cbb80d7c4f1d2fe04e790fb6e2
parent97db1d17be599c8627110cbb4f57f0cb36da178c (diff)
new loplugin:unusedvariableplus
a particularly aggressive checker, which is why it is off by default Change-Id: Id5a0faa50b3ecc75e01f4aedc6579c5209e585da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91643 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/unusedvariableplus.cxx510
-rw-r--r--dbaccess/source/filter/xml/xmlExport.cxx1
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx1
-rw-r--r--desktop/source/deployment/registry/dp_backenddb.cxx1
-rw-r--r--editeng/source/uno/unoedprx.cxx1
-rw-r--r--extensions/source/bibliography/framectr.cxx1
-rw-r--r--filter/qa/unit/textfilterdetect.cxx2
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx1
-rw-r--r--framework/source/fwe/classes/addonmenu.cxx1
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx2
-rw-r--r--linguistic/source/convdic.cxx6
-rw-r--r--sdext/source/pdfimport/tree/drawtreevisiting.cxx3
-rw-r--r--svx/source/form/fmshimp.cxx1
-rw-r--r--testtools/source/bridgetest/bridgetest.cxx1
-rw-r--r--xmlsecurity/source/helper/xsecverify.cxx1
15 files changed, 515 insertions, 18 deletions
diff --git a/compilerplugins/clang/unusedvariableplus.cxx b/compilerplugins/clang/unusedvariableplus.cxx
new file mode 100644
index 000000000000..fa0e9e3992b1
--- /dev/null
+++ b/compilerplugins/clang/unusedvariableplus.cxx
@@ -0,0 +1,510 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * Based on LLVM/Clang.
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ */
+
+#ifndef LO_CLANG_SHARED_PLUGINS
+
+#include "plugin.hxx"
+#include <unordered_set>
+
+/*
+ * Very aggressive unused variable checker, we whitelist types that are known
+ * good when unused.
+*/
+
+namespace
+{
+static bool startswith(const std::string& rStr, const char* pSubStr)
+{
+ return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
+}
+
+class UnusedVariablePlus : public loplugin::FilteringPlugin<UnusedVariablePlus>
+{
+public:
+ explicit UnusedVariablePlus(loplugin::InstantiationData const& data)
+ : FilteringPlugin(data)
+ {
+ }
+
+ virtual bool preRun() override
+ {
+ std::string fn(handler.getMainFileName());
+ loplugin::normalizeDotDotInFilePath(fn);
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/canvas/workben/"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/source/uipreviewer/previewer.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/vcl/workben/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/vcl/qa/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/vcl/backendtest/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/lotuswordpro/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/salhelper/qa/"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/qa/"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/idl/source/prj/svidl.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sot/source/unoolestorage/xolesimplestorage.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/core/tool/interpr7.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/vba/vbaapplication.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/doc/doccomp.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/core/swg/SwXMLTextBlocks.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sw/source/filter/ww8/wrtw8esh.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR
+ "/shell/source/sessioninstall/SyncDbusSessionHelper.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svl/qa/unit/items/test_IndexedStyleSheets.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sd/qa/unit/export-tests-ooxml2.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/qa/unit/subsequent_export-test.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/vcl/skia/SkiaHelper.cxx"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/dialog/dlgctrl.cxx"))
+ return false;
+
+ // clang has a bug here, with vars in destructing assignments
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/binaryurp/"))
+ return false;
+ if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/excel/xestring.cxx"))
+ return false;
+ return true;
+ }
+
+ virtual void run() override
+ {
+ if (preRun())
+ TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+ }
+
+ bool VisitVarDecl(const VarDecl* var)
+ {
+ if (ignoreLocation(var))
+ return true;
+ if (var->isReferenced() || var->isUsed())
+ return true;
+ if (var->isDefinedOutsideFunctionOrMethod())
+ return true;
+ if (var->isExceptionVariable()) // not interesting
+ return true;
+
+ auto type = var->getType().getCanonicalType().getUnqualifiedType();
+ auto typeName = type.getAsString();
+ if (typeName.compare(0, 7, "struct ") == 0)
+ typeName = typeName.substr(7);
+ if (typeName.compare(0, 6, "class ") == 0)
+ typeName = typeName.substr(6);
+ if (typeName.compare(0, 2, "::") == 0)
+ typeName = typeName.substr(2);
+ if (typeName.compare(0, 23, "(anonymous namespace)::") == 0)
+ typeName = typeName.substr(23);
+ static std::unordered_set<std::string> ignoreClassNamesSet{
+ "apphelper::NegativeGuard<class osl::Mutex>",
+ "avmedia::gstreamer::(anonymous namespace)::FlagGuard",
+ "BoolEnv_Impl",
+ "BoolResetter",
+ "boost::io::basic_ios_all_saver<char, struct std::char_traits<char> >",
+ "BorderLinesGuard",
+ "BroadcastRecalcOnRefMoveGuard",
+ "CacheLockGuard",
+ "cc_reset",
+ "ViewCallback",
+ "chart::ControllerLockGuard",
+ "chart::ControllerLockGuardUNO",
+ "chart::HiddenUndoContext",
+ "chart::sidebar::(anonymous namespace)::PreventUpdate",
+ "chart::TimerTriggeredControllerLock",
+ "chart::TrueGuard",
+ "ClearableClipRegion",
+ "osl::ClearableGuard<class osl::Mutex>",
+ "rptui::ColorChanger",
+ "SortRefUpdateSetter",
+ "SortRefNoUpdateSetter",
+ "com::sun::star::uno::ContextLayer",
+ "comphelper::FlagGuard",
+ "comphelper::FlagRestorationGuard",
+ "comphelper::ValueRestorationGuard<_Bool>",
+ "comphelper::(anonymous namespace)::ProfileZone",
+ "comphelper::ProfileZone",
+ "comphelper::ORelease<class osl::Mutex>",
+ "comphelper::OStreamSection",
+ "ConfigurationController::Lock",
+ "SortTypeSetter",
+ "SkiaZone",
+ "MockMetadatable",
+ "connectivity::(anonymous namespace)::ForbidQueryName",
+ "connectivity::calc::OCalcConnection::ODocHolder",
+ "connectivity::writer::OWriterConnection::ODocHolder",
+ "connectivity::jdbc::ContextClassLoaderScope",
+ "CurrShell",
+ "dbaccess::ModifyLock",
+ "dbaccess::NameChangeNotifier",
+ "dbaccess::OFilteredContainer::EnsureReset",
+ "dbaccess::OQuery::OAutoActionReset",
+ "dbaccess::OQueryContainer::OAutoActionReset",
+ "dbaccess::(anonymous namespace)::LayoutManagerLock",
+ "dbaccess::(anonymous namespace)::LockModifiable",
+ "dbaccess::(anonymous namespace)::OExecuteImpl",
+ "dbaccess::(anonymous namespace)::PreserveVisualAreaSize",
+ "dbaccess::(anonymous namespace)::ProtectFlag",
+ "dbaui::BrowserViewStatusDisplay",
+ "dbaui::SbaXDataBrowserController::FormErrorHelper",
+ "dbaui::(anonymous namespace)::SelectionGuard",
+ "dbaxml::(anonymous namespace)::FocusWindowWaitGuard",
+ "DBG_Model",
+ "DeactivateUpdateMode",
+ "desktop::Desktop",
+ "desktop::(anonymous namespace)::ConditionSetGuard",
+ "desktop::(anonymous namespace)::RefClearGuard<class "
+ "com::sun::star::uno::Reference<class com::sun::star::frame::XSynchronousDispatch> "
+ ">",
+ "DetachCurrentThread",
+ "DialogReleaseGuard",
+ "DisableCallbackAction",
+ "DisableCallbacks",
+ "DisableGetPivotData",
+ "DispatchMutexLock_Impl",
+ "DocTemplLocker_Impl",
+ "DocumentSettingsGuard",
+ "DocxTableExportContext",
+ "dp_misc::AbortChannel::Chain",
+ "dp_misc::ProgressLevel",
+ "E3DModifySceneSnapRectUpdater",
+ "E3dObjFactory",
+ "ErrorHdlResetter",
+ "EscherExAtom",
+ "EscherExContainer",
+ "ExportDataSaveRestore",
+ "ExtensionRemoveGuard",
+ "frm::(anonymous namespace)::FieldChangeNotifier",
+ "frm::(anonymous namespace)::DocumentModifyGuard",
+ "FieldDeletionModify",
+ "FieldDeletionListener",
+ "FileHandle_Impl::Guard",
+ "FlowFrameJoinLockGuard",
+ "FmXFormShell::SuspendPropertyTracking",
+ "FocusWindowWaitCursor",
+ "formula::(anonymous namespace)::OpCodeList",
+ "formula::(anonymous namespace)::FormulaCompilerRecursionGuard",
+ "FontCacheGuard",
+ "FontLockGuard",
+ "FormatLevel",
+ "FormulaGrammarSwitch",
+ "framework::DocumentUndoGuard",
+ "framework::ShareGuard",
+ "framework::TransactionGuard",
+ "framework::(anonymous namespace)::QuickstartSuppressor",
+ "GalApp",
+ "GalleryProgress",
+ "GlibThreadDefaultMainContextScope",
+ "Guard",
+ "HandleResetAttrAtTextNode",
+ "HandleSetAttrAtTextNode",
+ "HelpParser",
+ "HtmlExport",
+ "HTMLSaveData",
+ "IMapCompat",
+ "jni_uno::JLocalAutoRef",
+ "LoadMediumGuard",
+ "LockGuard",
+ "MacroInterpretIncrementer",
+ "MailMergeExecuteFinalizer",
+ "ModifyBlocker_Impl",
+ "MutexRelease",
+ "MutexType",
+ "NewTextListsHelper",
+ "OAutoRegistration",
+ "rptui::GeometryHandler::OBlocker",
+ "rptui::OXReportControllerObserver::OEnvLock",
+ "oglcanvas::TransformationPreserver",
+ "io_acceptor::(anonymous namespace)::BeingInAccept",
+ "desktop::LibLibreOffice_Impl",
+ "ToolbarUnoDispatcher",
+ "ooo::vba::excel::(anonymous namespace)::PasteCellsWarningReseter",
+ "oox::drawingml::(anonymous namespace)::ActionLockGuard",
+ "oox::dump::IndentGuard",
+ "oox::dump::ItemGuard",
+ "oox::dump::MultiItemsGuard",
+ "oox::dump::TableGuard",
+ "OpenCLInitialZone",
+ "OpenCLZone",
+ "OpenGLVCLContextZone",
+ "OpenGLZone",
+ "osl::MutexGuard",
+ "rptui::OXUndoEnvironment::OUndoMode",
+ "rptui::OXUndoEnvironment::OUndoEnvLock",
+ "PaMIntoCursorShellRing",
+ "ParserCleanup",
+ "BorderTest",
+ "pcr::ComposedUIAutoFireGuard",
+ "writerperfect::(anonymous namespace)::PositionHolder",
+ "pq_sdbc_driver::DisposeGuard",
+ "PropertyChangeNotifier",
+ "ProtectFormulaGroupContext",
+ "PreventUpdate",
+ "pyuno::PyThreadAttach",
+ "pyuno::PyThreadDetach",
+ "pyuno_loader::(anonymous namespace)::PythonInit",
+ "RecursionCounter",
+ "RefGuard",
+ "icu_65::RegexMatcher",
+ "RestoreMapMode",
+ "Runner",
+ "pyuno::Runtime",
+ "salhelper::ConditionModifier",
+ "salhelper::ConditionWaiter",
+ "SaveRunState",
+ "SbiExpression",
+ "sc::AutoCalcSwitch",
+ "sc::DelayFormulaGroupingSwitch",
+ "sc::IdleSwitch",
+ "sc::UndoSwitch",
+ "ScBulkBroadcast",
+ "ScChartLockGuard",
+ "ScCompiler",
+ "ScDocument::NumFmtMergeHandler",
+ "ScDocShellModificator",
+ "ScDocShell::PrepareSaveGuard",
+ "ScExternalRefManager::ApiGuard",
+ "ScFormulaGroupCycleCheckGuard",
+ "ScFormulaGroupDependencyComputeGuard",
+ "SchedulerGuard",
+ "ScMutationDisable",
+ "ScNoteCaptionCreator",
+ "ScValidationRegisteredDlg",
+ "ScopedAntialiasing",
+ "ScRefreshTimerProtector",
+ "ScWaitCursorOff",
+ "ScXMLImport::MutexGuard",
+ "SdIOCompat",
+ "sd::slidesorter::controller::FocusManager::FocusHider",
+ "sd::slidesorter::controller::SlideSorterController::ModelChangeLock",
+ "sd::slidesorter::controller::PageSelector::BroadcastLock",
+ "sd::slidesorter::view::SlideSorterView::DrawLock",
+ "sd::slidesorter::controller::PageSelector::UpdateLock",
+ "sd::ViewShellManager::Implementation::UpdateLock",
+ "sd::(anonymous namespace)::LockUI",
+ "sd::ToolBarManager::UpdateLock",
+ "sd::ViewShellManager::UpdateLock",
+ "sd::OutlineViewPageChangesGuard",
+ "sd::framework::ConfigurationController::Lock",
+ "sd::slidesorter::controller::VisibleAreaManager::TemporaryDisabler",
+ "sd::slidesorter::controller::SelectionObserver::Context",
+ "sd::ToolBarManager::Implementation::UpdateLockImplementation",
+ "sd::OutlineViewModelChangeGuard",
+ "sd::slidesorter::controller::(anonymous "
+ "namespace)::TemporarySlideTrackingDeactivator",
+ "sd::ModifyGuard",
+ "sd::OutlineViewModelChangeGuard",
+ "setFastDocumentHandlerGuard",
+ "SfxErrorContext",
+ "SfxObjectShellLock",
+ "SfxProgress",
+ "SfxSaveGuard",
+ "SfxStack",
+ "ShellMoveCursor",
+ "SkAutoCanvasRestore",
+ "SolarMutexGuard",
+ "SolarMutexReleaser",
+ "StackHack",
+ "std::scoped_lock<class std::mutex>",
+ "std::unique_ptr<class com::sun::star::uno::ContextLayer, struct "
+ "std::default_delete<class com::sun::star::uno::ContextLayer> >",
+ "std::unique_ptr<class weld::WaitObject, struct std::default_delete<class "
+ "weld::WaitObject> >",
+ "std::unique_ptr<class ClearableClipRegion, struct o3tl::default_delete<class "
+ "ClearableClipRegion> >",
+ "std::unique_ptr<class SwDocShell::LockAllViewsGuard, struct "
+ "std::default_delete<class "
+ "SwDocShell::LockAllViewsGuard> >",
+ "std::unique_ptr<class SwSaveFootnoteHeight, struct std::default_delete<class "
+ "SwSaveFootnoteHeight> >",
+ "std::unique_ptr<class SwModelTestBase::Resetter, struct std::default_delete<class "
+ "SwModelTestBase::Resetter> >",
+ "StreamExceptionsEnabler",
+ "SvAddressParser_Impl",
+ "svl::undo::impl::LockGuard",
+ "svt::table::(anonymous namespace)::SuppressCursor",
+ "svx::(anonymous namespace)::FontSwitch",
+ "SvXMLElementExport",
+ "svxform::(anonymous namespace)::QuitGuard",
+ "sw::DrawUndoGuard",
+ "sw::UndoGuard",
+ "sw::GroupUndoGuard",
+ "sw::(anonymous namespace)::CursorGuard",
+ "SwActContext",
+ "SwAutoFormat",
+ "SwCallLink",
+ "SwContentNotify",
+ "SwCursorSaveState",
+ "SwCSS1OutMode",
+ "SwDataChanged",
+ "SwDigitModeModifier",
+ "SwDrawViewSave",
+ "SwDropSave",
+ "SwEnhancedPDFExportHelper",
+ "SwEnterLeave",
+ "SwFieldSlot",
+ "SwFilterOptions",
+ "SwFntAccess",
+ "SwFontSave",
+ "SwFootnoteSave",
+ "SwFrameDeleteGuard",
+ "SwModelTestBase::Resetter",
+ "std::unique_ptr<class ScTokenArray, struct std::default_delete<class "
+ "ScTokenArray> >", // ScCompiler::CompileString has nasty semantics
+ "Resetter",
+ "SwFrameSwapper",
+ "SwFlyNotify",
+ "SwForbidFollowFormat",
+ "SwHandleAnchorNodeChg",
+ "SwHookOut",
+ "SwImplShellAction",
+ "SwKeepConversionDirectionStateContext",
+ "SwLayIdle",
+ "SwLayNotify",
+ "SwLayoutModeModifier",
+ "SwMvContext",
+ "SwNotifyAccAboutInvalidTextSelections",
+ "SwObjPositioningInProgress",
+ "SwParaSelection",
+ "SwPauseThreadStarting",
+ "SwPosNotify",
+ "SwRedlineItr", // ???
+ "SwRegHistory",
+ "SwSaveFootnoteHeight",
+ "SwSaveSetLRUOfst",
+ "SwStyleBase_Impl::ItemSetOverrider",
+ "SwSwapIfNotSwapped",
+ "SwSwapIfSwapped",
+ "SwTableNumFormatMerge",
+ "SwTaggedPDFHelper",
+ "SwTestFormat",
+ "SwTextCursorSave",
+ "SwTextSlot",
+ "SwTrnsfrActionAndUndo",
+ "SwWait",
+ "SwXDispatchProviderInterceptor::DispatchMutexLock_Impl",
+ "TableWait",
+ "TargetStateControl_Impl",
+ "TempErrorHandler",
+ "TemporaryCellGroupMaker",
+ "TemporaryRedlineUpdater",
+ "TextFrameLockGuard",
+ "TimerContext",
+ "TimerTriggeredControllerLock",
+ "ToggleSaveToModule",
+ "toolkit::(anonymous namespace)::ResetFlagOnExit",
+ "TravelSuspension",
+ "TreeUpdateSwitch",
+ "rptui::UndoContext",
+ "rptui::UndoSuppressor",
+ "UndoRedoRedlineGuard",
+ "UnoActionRemoveContext",
+ "UnoActionContext",
+ "UpdateFontsGuard",
+ "utl::CloseableComponent",
+ "utl::DisposableComponent",
+ "ValueCounter_Impl",
+ "VclListenerLock",
+ "vclcanvas::tools::OutDevStateKeeper",
+ "vcl::PaintBufferGuard",
+ "vcl::RoadmapWizardTravelSuspension",
+ "vcl::ScopedAntialiasing",
+ "vcl::WizardTravelSuspension",
+ "VerbExecutionControllerGuard",
+ "VersionCompat",
+ "SlideShowImpl::WaitSymbolLock",
+ "webdav_ucp::NeonHeadRequest",
+ "webdav_ucp::NeonPropFindRequest",
+ "webdav_ucp::NeonUri",
+ "WaitObject",
+ "weld::WaitObject",
+ "writerfilter::ooxml::(anonymous namespace)::StatusIndicatorGuard",
+ "WriterSpecificAutoFormatBlock",
+ "xmloff::OOfficeFormsExport",
+ "xmlscript::(anonymous namespace)::MGuard",
+ "XMLTextCharStyleNamesElementExport",
+ };
+ if (ignoreClassNamesSet.find(typeName) != ignoreClassNamesSet.end())
+ return true;
+ if (startswith(typeName, "comphelper::ScopeGuard<"))
+ return true;
+ if (startswith(typeName, "comphelper::ValueRestorationGuard<"))
+ return true;
+ if (startswith(typeName, "osl::Guard<"))
+ return true;
+ if (startswith(typeName, "dbaui::OMultiInstanceAutoRegistration<"))
+ return true;
+ if (startswith(typeName, "pcr::OAutoRegistration<"))
+ return true;
+
+ if (var->getIdentifier())
+ {
+ auto name = var->getName();
+ if (name == "aBroadcastGuard" || name == "aDeleteRef" || name == "aGuard"
+ || name == "aGuard2" || name == "aHoldSelf" || name == "aKeepDoc"
+ || name == "aAutoRegistration" || name == "aLoadContentIfExists"
+ || name == "aOwnRef" || name == "createImpl" || name == "flyHolder"
+ || name == "guard" || name == "ensureDelete" || name == "s_xTerminateListener"
+ || name == "pThis" || name == "pOldViewShell" || name == "self"
+ || name == "xDocStor" || name == "xDeleteUponLeaving" || name == "xDeleteRef"
+ || name == "xHoldAlive" || name == "xHolder" || name == "xHoldRefForMethodAlive"
+ || name == "xLock" || name == "xMutexGuard" || name == "xKeepAlive"
+ || name == "xKeepContentHolderAlive" || name == "xKeepDocAlive"
+ || name == "xKeepMeAlive" || name == "xKeepProviderAlive"
+ || name == "xOperationHold" || name == "xPreventDelete" || name == "xSelf"
+ || name == "xSelfHold" || name == "xTempHold" || name == "xDisposeAfterNewOne"
+ || name == "xThis" || name == "xThisPackage" || name == "xTriggerInit"
+ || name == "xLifeCycle" || name == "xAnotherLifeCycle")
+ return true;
+ }
+
+ if (isa<ParmVarDecl>(var))
+ return true;
+
+ if (typeName.find("Reference") != std::string::npos && var->getInit())
+ {
+ if (auto cxxConstructExpr
+ = dyn_cast<CXXConstructExpr>(var->getInit()->IgnoreImplicit()))
+ if (cxxConstructExpr->getNumArgs() == 2)
+ if (auto param1 = dyn_cast<DeclRefExpr>(cxxConstructExpr->getArg(1)))
+ if (auto enumDecl = dyn_cast<EnumConstantDecl>(param1->getDecl()))
+ if (enumDecl->getName() == "UNO_QUERY_THROW"
+ || enumDecl->getName() == "UNO_SET_THROW")
+ return true;
+ }
+
+ report(DiagnosticsEngine::Warning, "unused variable %0 of type %1", var->getLocation())
+ << var->getDeclName() << typeName;
+
+ return true;
+ }
+};
+
+loplugin::Plugin::Registration<UnusedVariablePlus> unusedvariableplus("unusedvariableplus", false);
+
+} // namespace
+
+#endif // LO_CLANG_SHARED_PLUGINS
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx
index 8bb174565e4c..014c5efa7e50 100644
--- a/dbaccess/source/filter/xml/xmlExport.cxx
+++ b/dbaccess/source/filter/xml/xmlExport.cxx
@@ -776,7 +776,6 @@ void ODBExport::exportSequence(const Sequence< OUString>& _aValue
,::xmloff::token::XMLTokenEnum _eTokenFilter
,::xmloff::token::XMLTokenEnum _eTokenType)
{
- Reference<XPropertySet> xProp(getDataSource());
if ( _aValue.hasElements() )
{
SvXMLElementExport aElem(*this,XML_NAMESPACE_DB, _eTokenFilter, true, true);
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index ca11affbca7c..9b7d4386fec5 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -324,7 +324,6 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
name = StrTitle::getTitle( ucbContent );
}
- ::ucbhelper::Content ucbContent( url, xCmdEnv, m_xComponentContext );
if (subType.equalsIgnoreAsciiCase( "vnd.sun.star.configuration-data"))
{
return new PackageImpl(
diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx
index 8ee51be6bc28..edc64b1996ef 100644
--- a/desktop/source/deployment/registry/dp_backenddb.cxx
+++ b/desktop/source/deployment/registry/dp_backenddb.cxx
@@ -275,7 +275,6 @@ void BackendDb::writeVectorOfPair(
OSL_ASSERT(!sNameSpace.isEmpty());
const OUString sPrefix(getNSPrefix() + ":");
const Reference<css::xml::dom::XDocument> doc = getDocument();
- const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
const Reference<css::xml::dom::XElement> vectorNode(
doc->createElementNS(sNameSpace, sPrefix + sVectorTagName));
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index 46561a761345..e0109fe6631f 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -463,7 +463,6 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) );
}
- EBulletInfo aBulletInfo1 = GetBulletInfo( aStartIndex.GetParagraph() );
EBulletInfo aBulletInfo2 = GetBulletInfo( aEndIndex.GetParagraph() );
if( aEndIndex.InBullet() )
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index 4bd5bdbd2b27..c3c6d06f8f42 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -515,7 +515,6 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen
bLeft = xCursor->isLast() && nCount > 1;
bRight= !xCursor->isLast();
// ask for confirmation
- Reference< frame::XController > xCtrl = mxImpl->pController;
Reference< form::XConfirmDeleteListener > xConfirm(m_xDatMan->GetFormController(),UNO_QUERY);
if (xConfirm.is())
{
diff --git a/filter/qa/unit/textfilterdetect.cxx b/filter/qa/unit/textfilterdetect.cxx
index f5bf6fc98b42..64a4a1bb64fa 100644
--- a/filter/qa/unit/textfilterdetect.cxx
+++ b/filter/qa/unit/textfilterdetect.cxx
@@ -34,8 +34,6 @@ char const DATA_DIRECTORY[] = "/filter/qa/unit/data/";
CPPUNIT_TEST_FIXTURE(TextFilterDetectTest, testTdf114428)
{
- uno::Reference<uno::XComponentContext> xComponentContext
- = comphelper::getComponentContext(getMultiServiceFactory());
uno::Reference<document::XExtendedFilterDetection> xDetect(
getMultiServiceFactory()->createInstance("com.sun.star.comp.filters.PlainTextFilterDetect"),
uno::UNO_QUERY);
diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx
index b76460d9edbc..78acd82b1659 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -276,7 +276,6 @@ namespace frm
if ( _rPropertyName == PROPERTY_BACKGROUNDCOLOR )
{
- Wallpaper aTest = pNavBar->GetBackground();
if ( bVoid )
{
pNavBar->SetBackground( pNavBar->GetSettings().GetStyleSettings().GetFaceColor() );
diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx
index 6c7f5bcd627a..5a7ab9f5c544 100644
--- a/framework/source/fwe/classes/addonmenu.cxx
+++ b/framework/source/fwe/classes/addonmenu.cxx
@@ -198,7 +198,6 @@ void AddonMenuManager::BuildMenu( PopupMenu* pCurrent
sal_uInt32 i = 0;
sal_uInt32 nElements = 0;
sal_uInt32 nCount = aAddonMenuDefinition.getLength();
- AddonsOptions aAddonsOptions;
OUString aTitle;
OUString aURL;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index 6f57dc19d1e9..ff540cc52325 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -1266,7 +1266,7 @@ void addJavaInfosDirScan(
OUString usDir3(usDir2 + arNames[k]);
DirectoryItem item3;
- if(DirectoryItem::get(usDir3, item) == File::E_None)
+ if(DirectoryItem::get(usDir3, item3) == File::E_None)
{
//remove trailing '/'
sal_Int32 islash = usDir3.lastIndexOf('/');
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 4a9bb04909d9..e4d1b4e82dfc 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -26,6 +26,7 @@
#include <tools/debug.hxx>
#include <tools/stream.hxx>
#include <tools/urlobj.hxx>
+#include <tools/diagnose_ex.h>
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -84,8 +85,6 @@ static void ReadThroughDic( const OUString &rMainURL, ConvDicXMLImport &rImport
if (!xIn.is())
return;
- SvStreamPtr pStream( utl::UcbStreamHelper::CreateStream( xIn ) );
-
// prepare ParserInputSource
xml::sax::InputSource aParserInput;
aParserInput.aInputStream = xIn;
@@ -97,12 +96,15 @@ static void ReadThroughDic( const OUString &rMainURL, ConvDicXMLImport &rImport
}
catch( xml::sax::SAXParseException& )
{
+ TOOLS_WARN_EXCEPTION("linguistic", "");
}
catch( xml::sax::SAXException& )
{
+ TOOLS_WARN_EXCEPTION("linguistic", "");
}
catch( io::IOException& )
{
+ TOOLS_WARN_EXCEPTION("linguistic", "");
}
}
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index b03d5512e504..4ff3c2ad7dab 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -1047,9 +1047,6 @@ void DrawXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_pt
StyleContainer::Style aMPStyle( "style:master-page", aPageProps);
- StyleContainer::Style aHeaderStyle( "style:header", PropertyMap() );
- StyleContainer::Style aFooterStyle( "style:footer", PropertyMap() );
-
elem.StyleId = m_rStyleContainer.impl_getStyleId( aMPStyle,false );
// create styles for children
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index ec321d6b11a0..a4c9357c3457 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -2631,7 +2631,6 @@ void SAL_CALL FmXFormShell::selectionChanged(const lang::EventObject& rEvent)
EnableTrackProperties_Lock(false);
bool bMarkChanged = m_pShell->GetFormView()->checkUnMarkAll(rEvent.Source);
- Reference< XForm > xNewForm( GetForm( rEvent.Source ) );
InterfaceBag aNewSelection;
aNewSelection.insert( Reference<XInterface>( xSelObj, UNO_QUERY ) );
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index 6bae24fe1219..4abda229d830 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -927,7 +927,6 @@ static bool raiseException( const Reference< XBridgeTest > & xLBT )
{
try
{
- TestData aRet, aRet2;
xLBT->raiseException(
5, STRING_TEST_CONSTANT,
xLBT->getInterface() );
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index 1f7fa9ac8ca8..c6a1539f2ac0 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -506,7 +506,6 @@ void XSecController::collectToVerify( const OUString& referenceId )
if ( bJustChainingOn )
{
- cssu::Reference< cssxs::XDocumentHandler > xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), cssu::UNO_QUERY);
m_xSAXEventKeeper->setNextHandler(xHandler);
}
}