Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ void CppCheck::tooManyConfigsError(const std::string &file, const int numberOfCo
msg << "Too many #ifdef configurations - cppcheck only checks " << mSettings.maxConfigs;
if (numberOfConfigurations > mSettings.maxConfigs)
msg << " of " << numberOfConfigurations << " configurations. Use --force to check all configurations.\n";
if (file.empty())
else if (file.empty())
msg << " configurations. Use --force to check all configurations. For more details, use --enable=information.\n";
msg << "The checking of the file will be interrupted because there are too many "
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not caused by you. But the verbose message does not say how many configurations are checked or what the maxConfigs options is and that is unfortunate.

"#ifdef configurations. Checking of all #ifdef configurations can be forced "
Expand Down
7 changes: 7 additions & 0 deletions test/testcppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ class TestCppcheck : public TestFixture {
ErrorLogger2 errorLogger;
CppCheck::getErrorMessages(errorLogger);
ASSERT(!errorLogger.ids.empty());
ASSERT(!errorLogger.errmsgs.empty());

const auto it = std::next(errorLogger.errmsgs.cbegin());
const std::string shortMsg = it->toString(false, templateFormat, "");
const std::string debugMsg = it->toString(true, templateFormat, "");
ASSERT_EQUALS(shortMsg, "nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]");
ASSERT_EQUALS(debugMsg, "nofile:0:0: information: The checking of the file will be interrupted because there are too many #ifdef configurations. Checking of all #ifdef configurations can be forced by --force command line option or from GUI preferences. However that may increase the checking time. For more details, use --enable=information. [toomanyconfigs]");

// Check if there are duplicate error ids in errorLogger.id
std::string duplicate;
Expand Down
Loading