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/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 @@ -1252,8 +1252,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 -1255 to +1256
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.

Copy link
Owner

Choose a reason for hiding this comment

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

ok. I have no strong opinion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It still feels a bit awkward but at least it is a bit more specific and the product name is gone.

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.

Copy link
Owner

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.

Yes this can be discussed. I don't see many such reports either because people don't report or because they don't see this. Personally, I rarelly report bugs I see in software.

Please report this to the developers.

this sentence could be interpreted as we are saying that the developers of the checked code should fix this themselves.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please report this to the developers.

this sentence could be interpreted as we are saying that the developers of the checked code should fix this themselves.

Right - this made it ambiguous. I will just drop it as a whole.

}
}

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.

Copy link
Owner

Choose a reason for hiding this comment

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

lgtm

"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 @@ -3152,7 +3152,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.

Copy link
Owner

Choose a reason for hiding this comment

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

imho I prefer to mention that it CAN be adjusted not that it SHOULD be adjusted. This change lgtm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should probably drop that sentence as a whole. If you reference to a knob we might need to mention it but then that would be a CLI option and be of no value for GUI user (thinking of that we should never mention any option in the messages - but something for later).

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/cli/helloworld_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def test_missing_include_system(): # #11283
]

_, _, stderr = cppcheck(args, cwd=__script_dir)
assert stderr.replace('\\', '/') == 'helloworld/main.c:1:2: information: Include file: <stdio.h> not found. Please note: Cppcheck does not need standard library headers to get proper results. [missingIncludeSystem]\n'
assert stderr.replace('\\', '/') == 'helloworld/main.c:1:2: information: Include file: <stdio.h> not found. Please note: Standard library headers do not need to be provided to get proper results. [missingIncludeSystem]\n'


def test_sarif():
Expand Down
2 changes: 1 addition & 1 deletion test/cli/other_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4018,7 +4018,7 @@ def test_no_valid_configuration(tmp_path):
'{}:1:2: error: No header in #include [syntaxError]'.format(test_file),
'{}:1:2: error: No header in #include [syntaxError]'.format(test_file),
'{}:1:2: error: No header in #include [syntaxError]'.format(test_file),
'{}:0:0: information: This file is not analyzed. Cppcheck failed to extract a valid configuration. Use -v for more details. [noValidConfiguration]'.format(test_file)
'{}:0:0: information: This file is not analyzed. No working configuration could be extracted. Use -v for more details. [noValidConfiguration]'.format(test_file)
]


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 @@ -2563,7 +2563,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 @@ -2578,7 +2578,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 @@ -2631,7 +2631,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 @@ -2654,8 +2654,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 @@ -2691,11 +2691,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
Loading