Skip to content

Commit

Permalink
Revert "removed deprecated --showtime= value top5 (danmar#5904)" (d…
Browse files Browse the repository at this point in the history
…anmar#5906)

This reverts commit fd9af82.

We have a very outdated daca client which is wrecking havoc because it
still relies on this.
  • Loading branch information
firewave committed Jan 22, 2024
1 parent 2bd7737 commit 915824a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 7 additions & 1 deletion cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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=<id> Set standard.\n"
" The available options are:\n"
" * c89\n"
Expand Down
2 changes: 1 addition & 1 deletion man/cppcheck.1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ There are false positives with this option. Each result must be carefully invest
</term>
<listitem>
<para>Show timing information. The available mode are:
<glosslist><glossentry><glossterm>none</glossterm><glossdef><para>Show nothing (default)</para></glossdef></glossentry><glossentry><glossterm>file</glossterm><glossdef><para>Show for each processed file</para></glossdef></glossentry><glossentry><glossterm>file-total</glossterm><glossdef><para>Show total time only for each processed file</para></glossdef></glossentry><glossentry><glossterm>summary</glossterm><glossdef><para>Show a summary at the end</para></glossdef></glossentry><glossentry><glossterm>top5_file</glossterm><glossdef><para>Show the top 5 for each processed file</para></glossdef></glossentry><glossentry><glossterm>top5_summary</glossterm><glossdef><para>Show the top 5 summary at the end</para></glossdef></glossentry></glosslist>
<glosslist><glossentry><glossterm>none</glossterm><glossdef><para>Show nothing (default)</para></glossdef></glossentry><glossentry><glossterm>file</glossterm><glossdef><para>Show for each processed file</para></glossdef></glossentry><glossentry><glossterm>file-total</glossterm><glossdef><para>Show total time only for each processed file</para></glossdef></glossentry><glossentry><glossterm>summary</glossterm><glossdef><para>Show a summary at the end</para></glossdef></glossentry><glossentry><glossterm>top5_file</glossterm><glossdef><para>Show the top 5 for each processed file</para></glossdef></glossentry><glossentry><glossterm>top5_summary</glossterm><glossdef><para>Show the top 5 summary at the end</para></glossdef></glossentry><glossentry><glossterm>top5</glossterm><glossdef><para>Alias for top5_file (deprecated)</para></glossdef></glossentry></glosslist>
</para>
</listitem>
</varlistentry>
Expand Down
1 change: 0 additions & 1 deletion releasenotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 4 additions & 3 deletions test/testcmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 915824a

Please sign in to comment.