Skip to content

Commit 812bdd4

Browse files
committed
added some missing --errorlist entries
1 parent 30ad5ee commit 812bdd4

13 files changed

+44
-6
lines changed

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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3451,6 +3451,7 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34513451
c.iteratorsError(nullptr, nullptr, "container");
34523452
c.invalidContainerLoopError(nullptr, nullptr, ErrorPath{});
34533453
c.invalidContainerError(nullptr, nullptr, nullptr, ErrorPath{});
3454+
c.invalidContainerReferenceError(nullptr, nullptr, ErrorPath{});
34543455
c.mismatchingContainerIteratorError(nullptr, nullptr, nullptr);
34553456
c.mismatchingContainersError(nullptr, nullptr);
34563457
c.mismatchingContainerExpressionError(nullptr, nullptr);
@@ -3465,19 +3466,26 @@ void CheckStl::getErrorMessages(ErrorLogger* errorLogger, const Settings* settin
34653466
c.string_c_strError(nullptr);
34663467
c.string_c_strReturn(nullptr);
34673468
c.string_c_strParam(nullptr, 0);
3469+
c.string_c_strConstructor(nullptr);
3470+
c.string_c_strAssignment(nullptr);
3471+
c.string_c_strConcat(nullptr);
3472+
c.string_c_strStream(nullptr);
34683473
c.string_c_strThrowError(nullptr);
34693474
c.sizeError(nullptr);
34703475
c.missingComparisonError(nullptr, nullptr);
34713476
c.redundantIfRemoveError(nullptr);
34723477
c.uselessCallsReturnValueError(nullptr, "str", "find");
34733478
c.uselessCallsSwapError(nullptr, "str");
34743479
c.uselessCallsSubstrError(nullptr, SubstrErrorType::COPY);
3480+
c.uselessCallsConstructorError(nullptr);
34753481
c.uselessCallsEmptyError(nullptr);
34763482
c.uselessCallsRemoveError(nullptr, "remove");
34773483
c.dereferenceInvalidIteratorError(nullptr, "i");
3484+
// TODO: derefInvalidIteratorRedundantCheck
34783485
c.eraseIteratorOutOfBoundsError(nullptr, nullptr);
34793486
c.useStlAlgorithmError(nullptr, "");
34803487
c.knownEmptyContainerError(nullptr, "");
34813488
c.globalLockGuardError(nullptr);
34823489
c.localMutexError(nullptr);
3490+
c.outOfBoundsIndexExpressionError(nullptr, nullptr);
34833491
}

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()) {

lib/checkunusedfunctions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class CPPCHECKLIB CheckUnusedFunctions {
5858

5959
static void getErrorMessages(ErrorLogger &errorLogger) {
6060
unusedFunctionError(errorLogger, "", 0, 0, "funcName");
61+
staticFunctionError(errorLogger, "", 0, 0, "funcName");
6162
}
6263

6364
// Return true if an error is reported.
@@ -70,6 +71,10 @@ class CPPCHECKLIB CheckUnusedFunctions {
7071
const std::string &filename, unsigned int fileIndex, unsigned int lineNumber,
7172
const std::string &funcname);
7273

74+
static void staticFunctionError(ErrorLogger& errorLogger,
75+
const std::string &filename, unsigned int fileIndex, unsigned int lineNumber,
76+
const std::string &funcname);
77+
7378
struct CPPCHECKLIB FunctionUsage {
7479
std::string filename;
7580
unsigned int lineNumber{};

lib/cppcheck.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "settings.h"
3636
#include "standards.h"
3737
#include "suppressions.h"
38+
#include "symboldatabase.h"
3839
#include "timer.h"
3940
#include "token.h"
4041
#include "tokenize.h"
@@ -1933,6 +1934,7 @@ void CppCheck::getErrorMessages(ErrorLogger &errorlogger)
19331934
CheckUnusedFunctions::getErrorMessages(errorlogger);
19341935
Preprocessor::getErrorMessages(errorlogger, s);
19351936
Tokenizer::getErrorMessages(errorlogger, s);
1937+
SymbolDatabase::getErrorMessages(errorlogger);
19361938
}
19371939

19381940
void CppCheck::analyseClangTidy(const FileSettings &fileSettings)

lib/symboldatabase.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8388,3 +8388,10 @@ ValueType::MatchResult ValueType::matchParameter(const ValueType *call, const Va
83888388
}
83898389
return res;
83908390
}
8391+
8392+
void SymbolDatabase::getErrorMessages(ErrorLogger&/*errorLogger*/)
8393+
{
8394+
// TODO
8395+
//SymbolDatabase symdb;
8396+
//symdb.returnImplicitIntError(nullptr);
8397+
}

lib/symboldatabase.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,8 @@ class CPPCHECKLIB SymbolDatabase {
14201420
/* returns the opening { if tok points to enum */
14211421
static const Token* isEnumDefinition(const Token* tok);
14221422

1423+
static void getErrorMessages(ErrorLogger &errorLogger);
1424+
14231425
private:
14241426
friend class Scope;
14251427
friend class Function;

0 commit comments

Comments
 (0)