compilerplugins/clang/test/unusedvariablecheck.cxx | 1 + compilerplugins/clang/unusedvariablecheck.cxx | 2 +- sfx2/source/doc/doctemplates.cxx | 9 +++------ 3 files changed, 5 insertions(+), 7 deletions(-)
New commits: commit 800e7fd2ff89e0dbe589115243244dbf643a0249 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Feb 23 09:45:48 2026 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Feb 23 14:38:56 2026 +0100 Simplify mutex handling here, use more RAII That required improving UnusedVariableCheck to honor [[maybe_unused]]. Change-Id: I01f3fd92d78726582f873681c807315b029c4e89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200032 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/compilerplugins/clang/test/unusedvariablecheck.cxx b/compilerplugins/clang/test/unusedvariablecheck.cxx index b020fba3eb4e..06ad536e985a 100644 --- a/compilerplugins/clang/test/unusedvariablecheck.cxx +++ b/compilerplugins/clang/test/unusedvariablecheck.cxx @@ -33,6 +33,7 @@ int main() v4; // expected-error {{unused variable 'v4' [loplugin:unusedvariablecheck]}} S v5; // expected-error {{unused variable 'v5' [loplugin:unusedvariablecheck]}} S v6(nullptr); + [[maybe_unused]] S v7; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/compilerplugins/clang/unusedvariablecheck.cxx b/compilerplugins/clang/unusedvariablecheck.cxx index 9ff433d65a1a..cd08a6c44650 100644 --- a/compilerplugins/clang/unusedvariablecheck.cxx +++ b/compilerplugins/clang/unusedvariablecheck.cxx @@ -50,7 +50,7 @@ bool UnusedVariableCheck::VisitVarDecl( const VarDecl* var ) { if( ignoreLocation( var )) return true; - if( var->isReferenced() || var->isUsed()) + if( var->isReferenced() || var->isUsed() || var->hasAttr<UnusedAttr>()) return true; if( var->isDefinedOutsideFunctionOrMethod()) return true; diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 8ec12d9119a1..5ff7e3801d13 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -462,17 +462,14 @@ void SfxDocTplService::init_Impl() if ( bNeedsUpdate ) { aGuard.clear(); - SolarMutexClearableGuard aSolarGuard; + SolarMutexGuard aSolarGuard; - VclPtrInstance< WaitWindow_Impl > pWin; - aSolarGuard.clear(); + [[maybe_unused]] ScopedVclPtrInstance<WaitWindow_Impl> pWin; { + SolarMutexReleaser aSolarReleaser; osl::MutexGuard anotherGuard(maMutex); doUpdate(); } - SolarMutexGuard aSecondSolarGuard; - - pWin.disposeAndClear(); } else if ( needsUpdate() ) // the UI should be shown only on the first update
