This commit is contained in:
PKEuS 2012-09-11 14:14:35 +02:00
parent 50f9dd52ab
commit 623ffe23f0
2 changed files with 10 additions and 1 deletions

View File

@ -265,7 +265,8 @@ void Variables::write(unsigned int varid, const Token* tok)
if (usage) {
usage->_write = true;
usage->_read = false;
if (!usage->_var->isStatic())
usage->_read = false;
usage->_lastAccess = tok;
}
}

View File

@ -2901,6 +2901,14 @@ private:
" return x ? a : c;\n"
"}");
ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'b' is assigned a value that is never used\n", errout.str());
functionVariableUsage("void foo()\n"
"{\n"
" static int i = 0;\n"
" if(i < foo())\n"
" i += 5;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void localvarextern() {