This commit is contained in:
PKEuS 2012-01-15 12:32:02 +01:00
parent c294b15360
commit 461565c50a
2 changed files with 8 additions and 7 deletions

View File

@ -67,6 +67,7 @@ public:
checkOther.checkDuplicateExpression();
checkOther.checkUnreachableCode();
checkOther.checkSuspiciousSemicolon();
checkOther.checkWrongPrintfScanfArguments();
// information checks
checkOther.checkVariableScope();
@ -91,7 +92,6 @@ public:
checkOther.checkCCTypeFunctions();
checkOther.checkFflushOnInputStream();
checkOther.invalidScanf();
checkOther.checkWrongPrintfScanfArguments();
checkOther.checkCoutCerrMisusage();
checkOther.checkIncorrectLogicOperator();

View File

@ -2027,9 +2027,9 @@ private:
" fclose(file);\n"
" return b;\n"
"}");
ASSERT_EQUALS("[test.cpp:6]: (warning) scanf without field width limits can crash with huge input data\n"
"[test.cpp:7]: (warning) scanf without field width limits can crash with huge input data\n"
"[test.cpp:8]: (warning) fscanf format string has 0 parameters but 1 are given\n", errout.str());
ASSERT_EQUALS("[test.cpp:8]: (warning) fscanf format string has 0 parameters but 1 are given\n"
"[test.cpp:6]: (warning) scanf without field width limits can crash with huge input data\n"
"[test.cpp:7]: (warning) scanf without field width limits can crash with huge input data\n", errout.str());
}
void testScanf2() {
@ -2044,9 +2044,9 @@ private:
" fclose(file);\n"
" return b;\n"
"}");
ASSERT_EQUALS("[test.cpp:6]: (warning) scanf without field width limits can crash with huge input data\n"
"[test.cpp:7]: (warning) scanf without field width limits can crash with huge input data\n"
"[test.cpp:8]: (warning) fscanf format string has 0 parameters but 1 are given\n", errout.str());
ASSERT_EQUALS("[test.cpp:8]: (warning) fscanf format string has 0 parameters but 1 are given\n"
"[test.cpp:6]: (warning) scanf without field width limits can crash with huge input data\n"
"[test.cpp:7]: (warning) scanf without field width limits can crash with huge input data\n", errout.str());
}
void testScanf3() {
@ -2212,6 +2212,7 @@ private:
" printf(\"%G\", bp);\n"
" printf(\"%f\", d);\n"
" printf(\"%f\", b);\n"
" printf(\"%f\", (float)cpi);\n"
"}");
ASSERT_EQUALS("[test.cpp:3]: (warning) %e in format string (no. 1) requires a floating point number given in the argument list\n"
"[test.cpp:4]: (warning) %E in format string (no. 1) requires a floating point number given in the argument list\n"