Skip to content
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/scriptcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
steps:
- uses: actions/checkout@v4

# TODO: bailout on error
- name: Restore Cppcheck
uses: actions/cache@v4
with:
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ if(LIBXML2_XMLLINT_EXECUTABLE)
add_custom_target(validateRules ${LIBXML2_XMLLINT_EXECUTABLE} --noout ${CMAKE_SOURCE_DIR}/rules/*.xml)
endif()

# TODO: add the following Makefile features:
# - "man/cppcheck.1" target
# - "tags" target
# - Cygwin handling
# - MinGW handling

if(BUILD_TESTS)
enable_testing()
endif()
Expand Down
1 change: 1 addition & 0 deletions addons/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def validate_regex(expr):
elif arg[:11] == '--function=':
RE_FUNCTIONNAME = arg[11:]
validate_regex(RE_FUNCTIONNAME)
# TODO: bail out on unknown parameter


def reportError(token, severity, msg, errorId):
Expand Down
1 change: 1 addition & 0 deletions cli/cmdlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ CmdLineParser::Result CmdLineParser::parseFromArgs(int argc, const char* const a
// --project-configuration
else if (std::strncmp(argv[i], "--project-configuration=", 24) == 0) {
mVSConfig = argv[i] + 24;
// TODO: provide error when this does nothing
if (!mVSConfig.empty() && (project.projectType == ImportProject::Type::VS_SLN || project.projectType == ImportProject::Type::VS_VCXPROJ))
project.ignoreOtherConfigs(mVSConfig);
}
Expand Down
1 change: 1 addition & 0 deletions gui/projectfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class ProjectFile : public QObject {
QStringList getAddonsAndTools() const;

bool getClangAnalyzer() const {
// TODO
return false; //mClangAnalyzer;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void Check::writeToErrorList(const ErrorMessage &errmsg)

void Check::reportError(const std::list<const Token *> &callstack, Severity severity, const std::string &id, const std::string &msg, const CWE &cwe, Certainty certainty)
{
// TODO: report debug warning when error is for a disabled severity
const ErrorMessage errmsg(callstack, mTokenizer ? &mTokenizer->list : nullptr, severity, id, msg, cwe, certainty);
if (mErrorLogger)
mErrorLogger->reportErr(errmsg);
Expand All @@ -72,6 +73,7 @@ void Check::reportError(const std::list<const Token *> &callstack, Severity seve

void Check::reportError(const ErrorPath &errorPath, Severity severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty)
{
// TODO: report debug warning when error is for a disabled severity
const ErrorMessage errmsg(errorPath, mTokenizer ? &mTokenizer->list : nullptr, severity, id, msg, cwe, certainty);
if (mErrorLogger)
mErrorLogger->reportErr(errmsg);
Expand Down
5 changes: 3 additions & 2 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,14 +493,14 @@ unsigned int CppCheck::checkClang(const FileWithDetails &file)
reportErr(errorMessage);
};
if (reportClangErrors(fin, reportError, compilerWarnings))
return 0;
return 0; // TODO: report as failure?
} else {
std::istringstream istr(output2);
auto reportError = [this](const ErrorMessage& errorMessage) {
reportErr(errorMessage);
};
if (reportClangErrors(istr, reportError, compilerWarnings))
return 0;
return 0; // TODO: report as failure?
}

if (!mSettings.buildDir.empty()) {
Expand Down Expand Up @@ -1056,6 +1056,7 @@ void CppCheck::checkNormalTokens(const Tokenizer &tokenizer)
CheckUnusedFunctions unusedFunctionsChecker;

// TODO: this should actually be the behavior if only "--enable=unusedFunction" is specified - see #10648
// TODO: log message when this is active?
const char* unusedFunctionOnly = std::getenv("UNUSEDFUNCTION_ONLY");
const bool doUnusedFunctionOnly = unusedFunctionOnly && (std::strcmp(unusedFunctionOnly, "1") == 0);

Expand Down
1 change: 1 addition & 0 deletions lib/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static constexpr bool caseInsensitiveFilesystem()
return true;
#else
// TODO: Non-windows filesystems might be case insensitive
// needs to be determined per filesystem and location - e.g. /sys/fs/ext4/features/casefold
return false;
#endif
}
Expand Down
1 change: 0 additions & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,6 @@ void Variable::evaluate(const Settings& settings)

const Library & lib = settings.library;

// TODO: ValueType::parseDecl() is also performing a container lookup
bool isContainer = false;
if (mNameToken)
setFlag(fIsArray, arrayDimensions(settings, isContainer));
Expand Down
2 changes: 2 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ void Tokenizer::simplifyTypedef()
simplifyTypedefCpp();
}

// TODO: rename - it is not C++ specific
void Tokenizer::simplifyTypedefCpp()
{
const bool cpp = isCPP();
Expand Down Expand Up @@ -3477,6 +3478,7 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)

// TODO: apply this through Settings::ValueFlowOptions
// TODO: do not run valueflow if no checks are being performed at all - e.g. unusedFunctions only
// TODO: log message when this is active?
const char* disableValueflowEnv = std::getenv("DISABLE_VALUEFLOW");
const bool doValueFlow = !disableValueflowEnv || (std::strcmp(disableValueflowEnv, "1") != 0);

Expand Down
2 changes: 1 addition & 1 deletion lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5476,7 +5476,7 @@ void ValueFlow::setValues(TokenList& tokenlist,

runner.run_once({
VFA(valueFlowDynamicBufferSize(tokenlist, symboldatabase, errorLogger, settings)),
VFA(analyzeDebug(tokenlist, errorLogger, settings)),
VFA(analyzeDebug(tokenlist, errorLogger, settings)), // TODO: add option to print it after each step/iteration
});
}

Expand Down
1 change: 1 addition & 0 deletions test/fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ std::size_t TestFixture::runTests(const options& args)
countTests = 0;
errmsg.str("");

// TODO: bail out when given class/test is not found?
for (std::string classname : args.which_test()) {
std::string testname;
if (classname.find("::") != std::string::npos) {
Expand Down
1 change: 1 addition & 0 deletions test/testmathlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ class TestMathLib : public TestFixture {
//ASSERT_THROW_INTERNAL_EQUALS(MathLib::toDoubleNumber("1.0LL"), INTERNAL, "Internal Error. MathLib::toDoubleNumber: input was not completely consumed: 1.0LL");

// verify: string --> double --> string conversion
// TODO: add L, min/max
ASSERT_EQUALS("1.0", MathLib::toString(MathLib::toDoubleNumber("1.0f")));
ASSERT_EQUALS("1.0", MathLib::toString(MathLib::toDoubleNumber("1.0")));
ASSERT_EQUALS("0.0", MathLib::toString(MathLib::toDoubleNumber("0.0f")));
Expand Down
1 change: 1 addition & 0 deletions tools/donate-cpu-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# changes)
SERVER_VERSION = "1.3.63"

# TODO: fetch from GitHub tags
OLD_VERSION = '2.16.0'

HEAD_MARKER = 'head results:'
Expand Down