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 <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -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: */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user