diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index a89501f21ed..f15f37b8b62 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -1098,6 +1098,10 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a mSettings.showtime = SHOWTIME_MODES::SHOWTIME_FILE_TOTAL; else if (showtimeMode == "summary") mSettings.showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY; + else if (showtimeMode == "top5") { + mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE; + mLogger.printMessage("--showtime=top5 is deprecated and will be removed in Cppcheck 2.14. Please use --showtime=top5_file or --showtime=top5_summary instead."); + } else if (showtimeMode == "top5_file") mSettings.showtime = SHOWTIME_MODES::SHOWTIME_TOP5_FILE; else if (showtimeMode == "top5_summary") @@ -1109,7 +1113,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a return Result::Fail; } else { - mLogger.printError("unrecognized --showtime mode: '" + showtimeMode + "'. Supported modes: file, file-total, summary, top5_file, top5_summary."); + mLogger.printError("unrecognized --showtime mode: '" + showtimeMode + "'. Supported modes: file, file-total, summary, top5, top5_file, top5_summary."); return Result::Fail; } } @@ -1578,6 +1582,8 @@ void CmdLineParser::printHelp() const " Show the top 5 for each processed file\n" " * top5_summary\n" " Show the top 5 summary at the end\n" + " * top5\n" + " Alias for top5_file (deprecated)\n" " --std= Set standard.\n" " The available options are:\n" " * c89\n" diff --git a/man/cppcheck.1.xml b/man/cppcheck.1.xml index d75cd498065..f6838587b62 100644 --- a/man/cppcheck.1.xml +++ b/man/cppcheck.1.xml @@ -574,7 +574,7 @@ There are false positives with this option. Each result must be carefully invest Show timing information. The available mode are: - noneShow nothing (default)fileShow for each processed filefile-totalShow total time only for each processed filesummaryShow a summary at the endtop5_fileShow the top 5 for each processed filetop5_summaryShow the top 5 summary at the end + noneShow nothing (default)fileShow for each processed filefile-totalShow total time only for each processed filesummaryShow a summary at the endtop5_fileShow the top 5 for each processed filetop5_summaryShow the top 5 summary at the endtop5Alias for top5_file (deprecated) diff --git a/releasenotes.txt b/releasenotes.txt index 1679d80e224..6b313cce25d 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -22,4 +22,3 @@ Other: - Using Visual Studio with CMake now checks if the CMake version is at least 3.13. This was always required but was not checked explicitly. - Added '--template=simple'. It is expands to '{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]' without any additional location details. - Removed deprecated platform type 'Unspecified'. Please use 'unspecified' instead. -- Removed deprecated '--showtime=' value 'top5'. Please use 'top5_file' or 'top5_summary' instead. \ No newline at end of file diff --git a/test/testcmdlineparser.cpp b/test/testcmdlineparser.cpp index a9886cd1304..07d179b2b33 100644 --- a/test/testcmdlineparser.cpp +++ b/test/testcmdlineparser.cpp @@ -1743,8 +1743,9 @@ class TestCmdlineParser : public TestFixture { REDIRECT; const char * const argv[] = {"cppcheck", "--showtime=top5", "file.cpp"}; settings->showtime = SHOWTIME_MODES::SHOWTIME_NONE; - ASSERT_EQUALS(CmdLineParser::Result::Fail, parser->parseFromArgs(3, argv)); - ASSERT_EQUALS("cppcheck: error: unrecognized --showtime mode: 'top5'. Supported modes: file, file-total, summary, top5_file, top5_summary.\n", logger->str()); + ASSERT_EQUALS(CmdLineParser::Result::Success, parser->parseFromArgs(3, argv)); + ASSERT(settings->showtime == SHOWTIME_MODES::SHOWTIME_TOP5_FILE); + ASSERT_EQUALS("cppcheck: --showtime=top5 is deprecated and will be removed in Cppcheck 2.14. Please use --showtime=top5_file or --showtime=top5_summary instead.\n", logger->str()); } void showtimeTop5File() { @@ -1782,7 +1783,7 @@ class TestCmdlineParser : public TestFixture { REDIRECT; const char * const argv[] = {"cppcheck", "--showtime=top10", "file.cpp"}; ASSERT_EQUALS(CmdLineParser::Result::Fail, parser->parseFromArgs(3, argv)); - ASSERT_EQUALS("cppcheck: error: unrecognized --showtime mode: 'top10'. Supported modes: file, file-total, summary, top5_file, top5_summary.\n", logger->str()); + ASSERT_EQUALS("cppcheck: error: unrecognized --showtime mode: 'top10'. Supported modes: file, file-total, summary, top5, top5_file, top5_summary.\n", logger->str()); } void errorlist() {