diff --git a/lib/checkother.h b/lib/checkother.h index 52ab7a913..b96f73cc1 100644 --- a/lib/checkother.h +++ b/lib/checkother.h @@ -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(); diff --git a/test/testother.cpp b/test/testother.cpp index ef5a6701c..4ce046bf6 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -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"