Skip to content

Commit 6f108bd

Browse files
committed
added some missing --errorlist entries
1 parent 44d2ca3 commit 6f108bd

15 files changed

+48
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ $(libcppdir)/clangimport.o: lib/clangimport.cpp lib/addoninfo.h lib/checkers.h l
557557
$(libcppdir)/color.o: lib/color.cpp lib/color.h lib/config.h
558558
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/color.cpp
559559

560-
$(libcppdir)/cppcheck.o: lib/cppcheck.cpp externals/picojson/picojson.h externals/simplecpp/simplecpp.h externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkers.h lib/checkunusedfunctions.h lib/clangimport.h lib/color.h lib/config.h lib/cppcheck.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/json.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/version.h lib/vfvalue.h lib/xml.h
560+
$(libcppdir)/cppcheck.o: lib/cppcheck.cpp externals/picojson/picojson.h externals/simplecpp/simplecpp.h externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/analyzerinfo.h lib/check.h lib/checkers.h lib/checkunusedfunctions.h lib/clangimport.h lib/color.h lib/config.h lib/cppcheck.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/filesettings.h lib/json.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/valueflow.h lib/version.h lib/vfvalue.h lib/xml.h
561561
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $(libcppdir)/cppcheck.cpp
562562

563563
$(libcppdir)/ctu.o: lib/ctu.cpp externals/tinyxml2/tinyxml2.h lib/addoninfo.h lib/astutils.h lib/check.h lib/checkers.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/smallvector.h lib/sourcelocation.h lib/standards.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h lib/xml.h

lib/checkbufferoverrun.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,4 +1235,7 @@ void CheckBufferOverrun::getErrorMessages(ErrorLogger *errorLogger, const Settin
12351235
c.argumentSizeError(nullptr, "function", 1, "buffer", nullptr, nullptr);
12361236
c.negativeMemoryAllocationSizeError(nullptr, nullptr);
12371237
c.negativeArraySizeError(nullptr);
1238+
c.terminateStrncpyError(nullptr, "var_name");
1239+
// TODO: ctuArrayIndex
1240+
// TODO: ctuPointerArith
12381241
}

lib/checkclass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,4 +3814,5 @@ void CheckClass::getErrorMessages(ErrorLogger *errorLogger, const Settings *sett
38143814
c.virtualFunctionCallInConstructorError(nullptr, std::list<const Token *>(), "f");
38153815
c.thisUseAfterFree(nullptr, nullptr, nullptr);
38163816
c.unsafeClassRefMemberError(nullptr, "UnsafeClass::var");
3817+
// TODO: ctuOneDefinitionRuleViolation
38173818
}

lib/checkfunctions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ void CheckFunctions::getErrorMessages(ErrorLogger *errorLogger, const Settings *
865865
c.invalidFunctionArgBoolError(nullptr, "func_name", 1);
866866
c.invalidFunctionArgStrError(nullptr, "func_name", 1);
867867
c.ignoredReturnValueError(nullptr, "malloc");
868+
c.ignoredReturnErrorCode(nullptr, "func_name");
868869
c.mathfunctionCallWarning(nullptr);
869870
c.mathfunctionCallWarning(nullptr, "1 - erf(x)", "erfc(x)");
870871
c.memsetZeroBytesError(nullptr);
@@ -873,4 +874,5 @@ void CheckFunctions::getErrorMessages(ErrorLogger *errorLogger, const Settings *
873874
c.missingReturnError(nullptr);
874875
c.copyElisionError(nullptr);
875876
c.useStandardLibraryError(nullptr, "memcpy");
877+
// TODO: allocaCalled, <funcname>Called
876878
}

lib/checknullpointer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,5 +719,9 @@ void CheckNullPointer::getErrorMessages(ErrorLogger *errorLogger, const Settings
719719
CheckNullPointer c(nullptr, settings, errorLogger);
720720
c.nullPointerError(nullptr, "pointer", nullptr, false);
721721
c.pointerArithmeticError(nullptr, nullptr, false);
722+
// TODO: nullPointerArithmeticOutOfMemory
722723
c.redundantConditionWarning(nullptr, nullptr, nullptr, false);
724+
// TODO: ctunullpointer
725+
// TODO: ctunullpointerOutOfMemory
726+
// TODO: ctunullpointerOutOfResources
723727
}

lib/checkother.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4580,6 +4580,8 @@ void CheckOther::getErrorMessages(ErrorLogger *errorLogger, const Settings *sett
45804580
c.intToPointerCastError(nullptr, "decimal");
45814581
c.suspiciousFloatingPointCastError(nullptr);
45824582
c.passedByValueError(nullptr, false);
4583+
// TODO: iterateByValue
4584+
// TODO: passedByValueCallback
45834585
c.constVariableError(nullptr, nullptr);
45844586
c.constStatementError(nullptr, "type", false);
45854587
c.signedCharArrayIndexError(nullptr);
@@ -4623,8 +4625,10 @@ void CheckOther::getErrorMessages(ErrorLogger *errorLogger, const Settings *sett
46234625
c.knownArgumentError(nullptr, nullptr, nullptr, "x", false);
46244626
c.knownPointerToBoolError(nullptr, nullptr);
46254627
c.comparePointersError(nullptr, nullptr, nullptr);
4628+
// TODO: subtractPointers
46264629
c.redundantAssignmentError(nullptr, nullptr, "var", false);
46274630
c.redundantInitializationError(nullptr, nullptr, "var", false);
4631+
c.redundantContinueError(nullptr);
46284632

46294633
const std::vector<const Token *> nullvec;
46304634
c.funcArgOrderDifferent("function", nullptr, nullptr, nullvec, nullvec);

lib/checkstl.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,8 @@ void CheckStl::uselessCallsSubstrError(const Token *tok, SubstrErrorType type)
23452345

23462346
void CheckStl::uselessCallsConstructorError(const Token *tok)
23472347
{
2348-
const std::string msg = "Inefficient constructor call: container '" + tok->str() + "' is assigned a partial copy of itself. Use erase() or resize() instead.";
2348+
const std::string container = tok ? tok->str() : "";
2349+
const std::string msg = "Inefficient constructor call: container '" + container + "' is assigned a partial copy of itself. Use erase() or resize() instead.";
23492350
reportError(tok, Severity::performance, "uselessCallsConstructor", msg, CWE398, Certainty::normal);
23502351
}
23512352

@@ -3451,6 +3452,7 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34513452
c.iteratorsError(nullptr, nullptr, "container");
34523453
c.invalidContainerLoopError(nullptr, nullptr, ErrorPath{});
34533454
c.invalidContainerError(nullptr, nullptr, nullptr, ErrorPath{});
3455+
c.invalidContainerReferenceError(nullptr, nullptr, ErrorPath{});
34543456
c.mismatchingContainerIteratorError(nullptr, nullptr, nullptr);
34553457
c.mismatchingContainersError(nullptr, nullptr);
34563458
c.mismatchingContainerExpressionError(nullptr, nullptr);
@@ -3465,19 +3467,26 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34653467
c.string_c_strError(nullptr);
34663468
c.string_c_strReturn(nullptr);
34673469
c.string_c_strParam(nullptr, 0);
3470+
c.string_c_strConstructor(nullptr);
3471+
c.string_c_strAssignment(nullptr);
3472+
c.string_c_strConcat(nullptr);
3473+
c.string_c_strStream(nullptr);
34683474
c.string_c_strThrowError(nullptr);
34693475
c.sizeError(nullptr);
34703476
c.missingComparisonError(nullptr, nullptr);
34713477
c.redundantIfRemoveError(nullptr);
34723478
c.uselessCallsReturnValueError(nullptr, "str", "find");
34733479
c.uselessCallsSwapError(nullptr, "str");
34743480
c.uselessCallsSubstrError(nullptr, SubstrErrorType::COPY);
3481+
c.uselessCallsConstructorError(nullptr);
34753482
c.uselessCallsEmptyError(nullptr);
34763483
c.uselessCallsRemoveError(nullptr, "remove");
34773484
c.dereferenceInvalidIteratorError(nullptr, "i");
3485+
// TODO: derefInvalidIteratorRedundantCheck
34783486
c.eraseIteratorOutOfBoundsError(nullptr, nullptr);
34793487
c.useStlAlgorithmError(nullptr, "");
34803488
c.knownEmptyContainerError(nullptr, "");
34813489
c.globalLockGuardError(nullptr);
34823490
c.localMutexError(nullptr);
3491+
c.outOfBoundsIndexExpressionError(nullptr, nullptr);
34833492
}

lib/checktype.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ void CheckType::getErrorMessages(ErrorLogger *errorLogger, const Settings *setti
540540
c.tooBigBitwiseShiftError(nullptr, 32, ValueFlow::Value(64));
541541
c.tooBigSignedBitwiseShiftError(nullptr, 31, ValueFlow::Value(31));
542542
c.integerOverflowError(nullptr, ValueFlow::Value(1LL<<32));
543+
// TODO: integerOverflowCond
543544
c.signConversionError(nullptr, nullptr, false);
545+
// TODO: signConversionCond
544546
c.longCastAssignError(nullptr);
545547
c.longCastReturnError(nullptr);
546548
ValueFlow::Value f;

lib/checkuninitvar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ void CheckUninitVar::getErrorMessages(ErrorLogger* errorLogger, const Settings*
18131813

18141814
ValueFlow::Value v{};
18151815

1816-
c.uninitvarError(nullptr, v);
1816+
c.uninitvarError(nullptr, v); // TODO: does not produce any output
18171817
c.uninitdataError(nullptr, "varname");
18181818
c.uninitStructMemberError(nullptr, "a.b");
18191819
}

lib/checkunusedfunctions.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,9 @@ static bool isOperatorFunction(const std::string & funcName)
339339
return std::find(additionalOperators.cbegin(), additionalOperators.cend(), funcName.substr(operatorPrefix.length())) != additionalOperators.cend();
340340
}
341341

342-
static void staticFunctionError(ErrorLogger& errorLogger,
343-
const std::string &filename,
344-
unsigned int fileIndex,
345-
unsigned int lineNumber,
346-
const std::string &funcname)
342+
void CheckUnusedFunctions::staticFunctionError(ErrorLogger& errorLogger,
343+
const std::string &filename, unsigned int fileIndex, unsigned int lineNumber,
344+
const std::string &funcname)
347345
{
348346
std::list<ErrorMessage::FileLocation> locationList;
349347
if (!filename.empty()) {

0 commit comments

Comments
 (0)