Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/checkcondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,8 @@ void CheckConditionImpl::alwaysTrueFalse()
continue;
if (Token::simpleMatch(condition, "return") && Token::Match(tok, "%assign%"))
continue;
if (Token::simpleMatch(tok->astParent(), "return") && Token::Match(tok, ".|%var%"))
if (Token::simpleMatch(tok->astParent(), "return") && Token::Match(tok, ".|%var%") &&
!(tok->hasKnownValue(ValueFlow::Value::ValueType::SYMBOLIC) && tok->getKnownValue(ValueFlow::Value::ValueType::SYMBOLIC)->tokvalue->str() == "("))
continue;
bool warnForNumber = false;
if (Token::Match(tok, "%num%|%bool%|%char%")) {
Expand Down
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2368,7 +2368,7 @@ bool SymbolDatabase::isRecordTypeWithoutSideEffects(const Type* type) const
for (const Variable& var : type->classScope->varlist) {
withoutSideEffects = isVariableWithoutSideEffects(var, type);
if (!withoutSideEffects) {
return withoutSideEffects;
return false;
}
}
return (withoutSideEffects = true);
Expand Down
2 changes: 1 addition & 1 deletion test/testcondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4878,7 +4878,7 @@ class TestCondition : public TestFixture {
" }\n"
" return false;\n"
"}\n");
TODO_ASSERT_EQUALS("[test.cpp:6:12] -> [test.cpp:7:21]: (style) Assigned value 's.g()' is always true [knownConditionTrueFalse]\n", "", errout_str());
ASSERT_EQUALS("[test.cpp:6:12] -> [test.cpp:8:16]: (style) Return value 'b' is always true [knownConditionTrueFalse]\n", errout_str());

check("static bool parse(int r) {\n" // #15031
" bool res = false;\n"
Expand Down
Loading