No unused variable messages about std::unique_ptr|shared_ptr|auto_ptr (#4355)
This commit is contained in:
parent
78932094c8
commit
8f4662de92
|
@ -691,8 +691,7 @@ void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(const Scope* const
|
||||||
i->typeEndToken()->isStandardType() ||
|
i->typeEndToken()->isStandardType() ||
|
||||||
isRecordTypeWithoutSideEffects(i->type()) ||
|
isRecordTypeWithoutSideEffects(i->type()) ||
|
||||||
(i->isStlType() &&
|
(i->isStlType() &&
|
||||||
i->typeStartToken()->strAt(2) != "lock_guard" &&
|
!Token::Match(i->typeStartToken()->tokAt(2), "lock_guard|unique_lock|shared_ptr|unique_ptr|auto_ptr")))
|
||||||
i->typeStartToken()->strAt(2) != "unique_lock"))
|
|
||||||
type = Variables::standard;
|
type = Variables::standard;
|
||||||
if (type == Variables::none || isPartOfClassStructUnion(i->typeStartToken()))
|
if (type == Variables::none || isPartOfClassStructUnion(i->typeStartToken()))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -3685,6 +3685,11 @@ private:
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
functionVariableUsage("void f() {\n"
|
||||||
|
" pLocker = std::shared_ptr<jfxLocker>(new jfxLocker(m_lock, true));\n" // Could have side-effects (#4355)
|
||||||
|
"}");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
functionVariableUsage("void f() {\n"
|
functionVariableUsage("void f() {\n"
|
||||||
" std::mutex m;\n"
|
" std::mutex m;\n"
|
||||||
" std::unique_lock<std::mutex> lock(m);\n" // #4624
|
" std::unique_lock<std::mutex> lock(m);\n" // #4624
|
||||||
|
|
Loading…
Reference in New Issue