Skip to content
Draft
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/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ void CheckOther::commaSeparatedReturnError(const Token *tok)
" if (x)\n"
" return a + 1,\n"
" b++;\n"
"However it can be useful to use comma in macros. Cppcheck does not warn when such a "
"However it can be useful to use comma in macros. No warning is reported when such a "
"macro is then used in a return statement, it is less likely such code is misunderstood.", CWE398, Certainty::normal);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,8 +1251,8 @@ unsigned int CppCheck::checkInternal(const FileWithDetails& file, const std::str

if (!hasValidConfig && configurations.size() > 1 && mSettings.severity.isEnabled(Severity::information)) {
std::string msg;
msg = "This file is not analyzed. Cppcheck failed to extract a valid configuration. Use -v for more details.";
msg += "\nThis file is not analyzed. Cppcheck failed to extract a valid configuration. The tested configurations have these preprocessor errors:";
msg = "This file is not analyzed. No working configuration could be extracted. Use -v for more details.";
msg += "\nThis file is not analyzed. No working configuration could be extracted. The tested configurations have these preprocessor errors:";
Comment on lines -1254 to +1255
Copy link
Collaborator Author

@firewave firewave Jan 2, 2026

Choose a reason for hiding this comment

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

Aside from dropping the product name I think this explains it better.

for (const std::string &s : configurationError)
msg += '\n' + s;

Expand Down
4 changes: 2 additions & 2 deletions lib/importproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings &setti
else if (strcmp(childname, Settings::SafeChecks::XmlExternalVariables) == 0)
temp.safeChecks.externalVariables = true;
else {
errors.emplace_back("Unknown '" + std::string(Settings::SafeChecks::XmlRootName) + "' element '" + childname + "' in Cppcheck project file");
errors.emplace_back("Unknown '" + std::string(Settings::SafeChecks::XmlRootName) + "' element '" + childname + "' in Cppcheck GUI project file");
return false;
}
}
Expand All @@ -1451,7 +1451,7 @@ bool ImportProject::importCppcheckGuiProject(std::istream &istr, Settings &setti
else if (strcmp(name, CppcheckXml::ProjectNameElementName) == 0)
; // no-op
else {
errors.emplace_back("Unknown element '" + std::string(name) + "' in Cppcheck project file");
errors.emplace_back("Unknown element '" + std::string(name) + "' in Cppcheck GUI project file");
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/mathlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ std::string MathLib::calculate(const std::string &first, const std::string &seco
return MathLib::toString(MathLib::toBigNumber(first) ^ MathLib::toBigNumber(second)) + intsuffix(first, second);

default:
throw InternalError(nullptr, std::string("Unexpected action '") + action + "' in MathLib::calculate(). Please report this to Cppcheck developers.");
throw InternalError(nullptr, std::string("Unexpected action '") + action + "' in MathLib::calculate(). Please report this to the developers.");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not so sure about explicit mentions to report this. I would hope that users are reporting any of the internal errors they cannot fix by themselves.

}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ void Preprocessor::missingInclude(const std::string &filename, unsigned int line
}
ErrorMessage errmsg(std::move(locationList), mFile0, Severity::information,
(headerType==SystemHeader) ?
"Include file: <" + header + "> not found. Please note: Cppcheck does not need standard library headers to get proper results." :
"Include file: <" + header + "> not found. Please note: Standard library headers do not need to be provided to get proper results." :
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Aside from dropping the product name I think this explains it better.

"Include file: \"" + header + "\" not found.",
(headerType==SystemHeader) ? "missingIncludeSystem" : "missingInclude",
Certainty::normal);
Expand Down
2 changes: 1 addition & 1 deletion lib/templatesimplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3147,7 +3147,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
"templateRecursion",
"TemplateSimplifier: max template recursion ("
+ std::to_string(mSettings.maxTemplateRecursion)
+ ") reached for template '"+typeForNewName+"'. You might want to limit Cppcheck recursion.",
+ ") reached for template '"+typeForNewName+"'. You might want to adjust the template recursion limit.",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure if we should mention that the limit should be adjusted.

Certainty::normal);
mErrorLogger.reportErr(errmsg);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ int multiComparePercent(const Token *tok, const char*& haystack, nonneg int vari
return 1;
} else { // %varid%
if (varid == 0) {
throw InternalError(tok, "Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers");
throw InternalError(tok, "Internal error. Token::Match called with varid 0. Please report this to the developers");
}

haystack += 6;
Expand Down
2 changes: 1 addition & 1 deletion test/testmathlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class TestMathLib : public TestFixture {
ASSERT_EQUALS("1", MathLib::calculate("0", "1", '^'));

// Unknown action should throw exception
ASSERT_THROW_INTERNAL_EQUALS(MathLib::calculate("1","2",'j'),INTERNAL, "Unexpected action 'j' in MathLib::calculate(). Please report this to Cppcheck developers.");
ASSERT_THROW_INTERNAL_EQUALS(MathLib::calculate("1","2",'j'),INTERNAL, "Unexpected action 'j' in MathLib::calculate(). Please report this to the developers.");
}

void calculate1() const {
Expand Down
16 changes: 8 additions & 8 deletions test/testpreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2561,7 +2561,7 @@ class TestPreprocessor : public TestFixture {
const char code[] = "#include <header.h>";
(void)getcodeforcfg(settings, *this, code, "", "test.c");

ASSERT_EQUALS("test.c:1:2: information: Include file: <header.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout_str());
ASSERT_EQUALS("test.c:1:2: information: Include file: <header.h> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n", errout_str());
}

// test for missing system include
Expand All @@ -2576,7 +2576,7 @@ class TestPreprocessor : public TestFixture {
const char code[] = "#include <header.h>";
(void)getcodeforcfg(settings, *this, code, "", "test.c");

ASSERT_EQUALS("test.c:1:2: information: Include file: <header.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout_str());
ASSERT_EQUALS("test.c:1:2: information: Include file: <header.h> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n", errout_str());
}

// test for existing system include in system include path
Expand Down Expand Up @@ -2629,7 +2629,7 @@ class TestPreprocessor : public TestFixture {
std::string code("#include <" + header + ">");
(void)getcodeforcfg(settings, *this, code.data(), code.size(), "", "test.c");

ASSERT_EQUALS("test.c:1:2: information: Include file: <" + header + "> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout_str());
ASSERT_EQUALS("test.c:1:2: information: Include file: <" + header + "> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n", errout_str());
}

// test for missing local and system include
Expand All @@ -2652,8 +2652,8 @@ class TestPreprocessor : public TestFixture {
(void)getcodeforcfg(settings, *this, code, "", "test.c");

ASSERT_EQUALS("test.c:1:2: information: Include file: \"missing.h\" not found. [missingInclude]\n"
"test.c:2:2: information: Include file: <header.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n"
"test.c:3:2: information: Include file: <missing2.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout_str());
"test.c:2:2: information: Include file: <header.h> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n"
"test.c:3:2: information: Include file: <missing2.h> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n", errout_str());
}

void testMissingIncludeCheckConfig() {
Expand Down Expand Up @@ -2689,11 +2689,11 @@ class TestPreprocessor : public TestFixture {
(void)getcodeforcfg(settings, *this, code.data(), code.size(), "", "test.c");

ASSERT_EQUALS("test.c:1:2: information: Include file: \"missing.h\" not found. [missingInclude]\n"
"test.c:2:2: information: Include file: <header.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n"
"test.c:3:2: information: Include file: <missing2.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n"
"test.c:2:2: information: Include file: <header.h> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n"
"test.c:3:2: information: Include file: <missing2.h> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n"
"test.c:6:2: information: Include file: \"header4.h\" not found. [missingInclude]\n"
"test.c:9:2: information: Include file: \"" + missing3 + "\" not found. [missingInclude]\n"
"test.c:11:2: information: Include file: <" + missing4 + "> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n", errout_str());
"test.c:11:2: information: Include file: <" + missing4 + "> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n", errout_str());
}

void hasInclude() {
Expand Down
2 changes: 1 addition & 1 deletion test/testtoken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ class TestToken : public TestFixture {
ASSERT(var.tokenize("int a ; int b ;"));

// Varid == 0 should throw exception
ASSERT_THROW_INTERNAL_EQUALS((void)Token::Match(var.tokens(), "%type% %varid% ; %type% %name%", 0),INTERNAL,"Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers");
ASSERT_THROW_INTERNAL_EQUALS((void)Token::Match(var.tokens(), "%type% %varid% ; %type% %name%", 0),INTERNAL,"Internal error. Token::Match called with varid 0. Please report this to the developers");

ASSERT_EQUALS(true, Token::Match(var.tokens(), "%type% %varid% ; %type% %name%", 1));
ASSERT_EQUALS(true, Token::Match(var.tokens(), "%type% %name% ; %type% %varid%", 2));
Expand Down