Merge remote branch 'remotes/origin/master'

This commit is contained in:
Kimmo Varis 2010-10-18 21:38:53 +03:00
commit f1640d6731
3 changed files with 55 additions and 0 deletions

View File

@ -29,6 +29,8 @@
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="cli/cmdlineparser.cpp" />
<Unit filename="cli/cmdlineparser.h" />
<Unit filename="cli/cppcheckexecutor.cpp" />
<Unit filename="cli/cppcheckexecutor.h" />
<Unit filename="cli/main.cpp" />
@ -45,13 +47,25 @@
<Unit filename="gui/common.h" />
<Unit filename="gui/csvreport.cpp" />
<Unit filename="gui/csvreport.h" />
<Unit filename="gui/erroritem.cpp" />
<Unit filename="gui/erroritem.h" />
<Unit filename="gui/filelist.cpp" />
<Unit filename="gui/filelist.h" />
<Unit filename="gui/fileviewdialog.cpp" />
<Unit filename="gui/fileviewdialog.h" />
<Unit filename="gui/helpwindow.cpp" />
<Unit filename="gui/helpwindow.h" />
<Unit filename="gui/logview.cpp" />
<Unit filename="gui/logview.h" />
<Unit filename="gui/main.cpp" />
<Unit filename="gui/mainwindow.cpp" />
<Unit filename="gui/mainwindow.h" />
<Unit filename="gui/project.cpp" />
<Unit filename="gui/project.h" />
<Unit filename="gui/projectfile.cpp" />
<Unit filename="gui/projectfile.h" />
<Unit filename="gui/projectfiledialog.cpp" />
<Unit filename="gui/projectfiledialog.h" />
<Unit filename="gui/report.cpp" />
<Unit filename="gui/report.h" />
<Unit filename="gui/resultstree.cpp" />
@ -60,6 +74,8 @@
<Unit filename="gui/resultsview.h" />
<Unit filename="gui/settingsdialog.cpp" />
<Unit filename="gui/settingsdialog.h" />
<Unit filename="gui/statsdialog.cpp" />
<Unit filename="gui/statsdialog.h" />
<Unit filename="gui/test.cpp" />
<Unit filename="gui/threadhandler.cpp" />
<Unit filename="gui/threadhandler.h" />
@ -86,8 +102,12 @@
<Unit filename="lib/checkheaders.h" />
<Unit filename="lib/checkmemoryleak.cpp" />
<Unit filename="lib/checkmemoryleak.h" />
<Unit filename="lib/checkobsoletefunctions.cpp" />
<Unit filename="lib/checkobsoletefunctions.h" />
<Unit filename="lib/checkother.cpp" />
<Unit filename="lib/checkother.h" />
<Unit filename="lib/checkpostfixoperator.cpp" />
<Unit filename="lib/checkpostfixoperator.h" />
<Unit filename="lib/checkstl.cpp" />
<Unit filename="lib/checkstl.h" />
<Unit filename="lib/checkunusedfunctions.cpp" />
@ -107,18 +127,27 @@
<Unit filename="lib/filelister_win32.h" />
<Unit filename="lib/mathlib.cpp" />
<Unit filename="lib/mathlib.h" />
<Unit filename="lib/path.cpp" />
<Unit filename="lib/path.h" />
<Unit filename="lib/preprocessor.cpp" />
<Unit filename="lib/preprocessor.h" />
<Unit filename="lib/settings.cpp" />
<Unit filename="lib/settings.h" />
<Unit filename="lib/timer.cpp" />
<Unit filename="lib/timer.h" />
<Unit filename="lib/token.cpp" />
<Unit filename="lib/token.h" />
<Unit filename="lib/tokenize.cpp" />
<Unit filename="lib/tokenize.h" />
<Unit filename="test/options.cpp" />
<Unit filename="test/options.h" />
<Unit filename="test/redirect.h" />
<Unit filename="test/test.cxx" />
<Unit filename="test/testautovariables.cpp" />
<Unit filename="test/testbufferoverrun.cpp" />
<Unit filename="test/testcharvar.cpp" />
<Unit filename="test/testclass.cpp" />
<Unit filename="test/testcmdlineparser.cpp" />
<Unit filename="test/testconstructors.cpp" />
<Unit filename="test/testcppcheck.cpp" />
<Unit filename="test/testdangerousfunctions.cpp" />
@ -128,11 +157,15 @@
<Unit filename="test/testincompletestatement.cpp" />
<Unit filename="test/testmathlib.cpp" />
<Unit filename="test/testmemleak.cpp" />
<Unit filename="test/testobsoletefunctions.cpp" />
<Unit filename="test/testoptions.cpp" />
<Unit filename="test/testother.cpp" />
<Unit filename="test/testpostfixoperator.cpp" />
<Unit filename="test/testpreprocessor.cpp" />
<Unit filename="test/testredundantif.cpp" />
<Unit filename="test/testrunner.cpp" />
<Unit filename="test/testsecurity.cpp" />
<Unit filename="test/testsettings.cpp" />
<Unit filename="test/testsimplifytokens.cpp" />
<Unit filename="test/teststl.cpp" />
<Unit filename="test/testsuite.cpp" />
@ -143,6 +176,12 @@
<Unit filename="test/testunusedfunctions.cpp" />
<Unit filename="test/testunusedprivfunc.cpp" />
<Unit filename="test/testunusedvar.cpp" />
<Unit filename="test/tinyxml/tinystr.cpp" />
<Unit filename="test/tinyxml/tinystr.h" />
<Unit filename="test/tinyxml/tinyxml.cpp" />
<Unit filename="test/tinyxml/tinyxml.h" />
<Unit filename="test/tinyxml/tinyxmlerror.cpp" />
<Unit filename="test/tinyxml/tinyxmlparser.cpp" />
<Unit filename="tools/dmake.cpp" />
<Unit filename="tools/extracttests.cpp" />
<Extensions>

View File

@ -899,6 +899,8 @@ void CheckStl::missingComparison()
incrementToken = tok3;
else if (tok3->varId() == iteratorId && Token::Match(tok3->next(), "!=|=="))
incrementToken = 0;
else if (tok3->str() == "break")
incrementToken = 0;
}
if (incrementToken)
missingComparisonError(incrementToken, tok2->tokAt(16));

View File

@ -98,6 +98,7 @@ private:
TEST_CASE(missingInnerComparison1);
TEST_CASE(missingInnerComparison2); // no FP when there is comparison
TEST_CASE(missingInnerComparison3); // no FP when there is iterator shadowing
TEST_CASE(missingInnerComparison4); // no FP when "break;" is used
// catch common problems when using the string::c_str() function
TEST_CASE(cstr);
@ -1094,6 +1095,19 @@ private:
ASSERT_EQUALS("", errout.str());
}
void missingInnerComparison4()
{
check("function f1(std::list<int> &l1) {\n"
" for(std::list<int>::iterator i = l1.begin(); i != l1.end(); i++) {\n"
" if (*i == 44) {\n"
" l1.insert(++i, 55);\n"
" break;\n"
" }\n"
" }\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void cstr()
{
check("void f() {\n"