Revert "Remove bailout. It hides lots of warnings for real code to avoid FP in unused templates."

This reverts commit 2a4be5ae1c.

When I look at daca@home now there are still lots of false negatives. So this bailout did not cause as much false negatives as I thought.
This commit is contained in:
Daniel Marjamäki 2019-06-19 22:27:50 +02:00
parent 02cc9ffcd8
commit cf79830afd
2 changed files with 8 additions and 2 deletions

View File

@ -145,6 +145,13 @@ void CheckClass::constructors()
if (!func.hasBody() || !(func.isConstructor() || func.type == Function::eOperatorEqual)) if (!func.hasBody() || !(func.isConstructor() || func.type == Function::eOperatorEqual))
continue; continue;
// Bail: If initializer list is not recognized as a variable or type then skip since parsing is incomplete
if (func.type == Function::eConstructor) {
const Token *initList = func.constructorMemberInitialization();
if (Token::Match(initList, ": %name% (") && initList->next()->tokType() == Token::eName)
break;
}
// Mark all variables not used // Mark all variables not used
clearAllVar(usage); clearAllVar(usage);

View File

@ -3885,8 +3885,7 @@ private:
"};\n" "};\n"
"template<class T1, class T2>\n" "template<class T1, class T2>\n"
"A<B<T1, T2>>::A() : m_value(false) {}\n"); "A<B<T1, T2>>::A() : m_value(false) {}\n");
// TODO: Avoid FP somehow ASSERT_EQUALS("", errout.str());
TODO_ASSERT_EQUALS("", "[test.cpp:10]: (warning) Member variable 'A::m_value' is not initialized in the constructor.\n", errout.str());
} }
}; };