Skip to content

Commit

Permalink
small check*.h cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Feb 4, 2024
1 parent 731513e commit d307417
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
9 changes: 4 additions & 5 deletions lib/checkautovariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,12 @@ class CPPCHECKLIB CheckAutoVariables : public Check {
void errorUselessAssignmentPtrArg(const Token *tok);

void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
ErrorPath errorPath;
CheckAutoVariables c(nullptr,settings,errorLogger);
c.errorAutoVariableAssignment(nullptr, false);
c.errorReturnReference(nullptr, errorPath, false);
c.errorDanglingReference(nullptr, nullptr, errorPath);
c.errorReturnTempReference(nullptr, errorPath, false);
c.errorDanglingTempReference(nullptr, std::move(errorPath), false);
c.errorReturnReference(nullptr, ErrorPath{}, false);
c.errorDanglingReference(nullptr, nullptr, ErrorPath{});
c.errorReturnTempReference(nullptr, ErrorPath{}, false);
c.errorDanglingTempReference(nullptr, ErrorPath{}, false);
c.errorInvalidDeallocation(nullptr, nullptr);
c.errorUselessAssignmentArg(nullptr);
c.errorUselessAssignmentPtrArg(nullptr);
Expand Down
10 changes: 4 additions & 6 deletions lib/checkother.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ class CPPCHECKLIB CheckOther : public Check {
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override {
CheckOther c(nullptr, settings, errorLogger);

ErrorPath errorPath;

// error
c.zerodivError(nullptr, nullptr);
c.misusedScopeObjectError(nullptr, "varname");
Expand Down Expand Up @@ -326,12 +324,12 @@ class CPPCHECKLIB CheckOther : public Check {
c.selfAssignmentError(nullptr, "varname");
c.clarifyCalculationError(nullptr, "+");
c.clarifyStatementError(nullptr);
c.duplicateBranchError(nullptr, nullptr, errorPath);
c.duplicateBranchError(nullptr, nullptr, ErrorPath{});
c.duplicateAssignExpressionError(nullptr, nullptr, true);
c.oppositeExpressionError(nullptr, errorPath);
c.duplicateExpressionError(nullptr, nullptr, nullptr, errorPath);
c.oppositeExpressionError(nullptr, ErrorPath{});
c.duplicateExpressionError(nullptr, nullptr, nullptr, ErrorPath{});
c.duplicateValueTernaryError(nullptr);
c.duplicateExpressionTernaryError(nullptr, std::move(errorPath));
c.duplicateExpressionTernaryError(nullptr, ErrorPath{});
c.duplicateBreakError(nullptr, false);
c.unreachableCodeError(nullptr, nullptr, false);
c.unsignedLessThanZeroError(nullptr, nullptr, "varname");
Expand Down
5 changes: 2 additions & 3 deletions lib/checkstl.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,14 @@ class CPPCHECKLIB CheckStl : public Check {
void localMutexError(const Token *tok);

void getErrorMessages(ErrorLogger* errorLogger, const Settings* settings) const override {
ErrorPath errorPath;
CheckStl c(nullptr, settings, errorLogger);
c.outOfBoundsError(nullptr, "container", nullptr, "x", nullptr);
c.invalidIteratorError(nullptr, "iterator");
c.iteratorsError(nullptr, "container1", "container2");
c.iteratorsError(nullptr, nullptr, "container0", "container1");
c.iteratorsError(nullptr, nullptr, "container");
c.invalidContainerLoopError(nullptr, nullptr, errorPath);
c.invalidContainerError(nullptr, nullptr, nullptr, std::move(errorPath));
c.invalidContainerLoopError(nullptr, nullptr, ErrorPath{});
c.invalidContainerError(nullptr, nullptr, nullptr, ErrorPath{});
c.mismatchingContainerIteratorError(nullptr, nullptr, nullptr);
c.mismatchingContainersError(nullptr, nullptr);
c.mismatchingContainerExpressionError(nullptr, nullptr);
Expand Down
3 changes: 1 addition & 2 deletions lib/checkuninitvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ class CPPCHECKLIB CheckUninitVar : public Check {
void uninitdataError(const Token *tok, const std::string &varname);
void uninitvarError(const Token *tok, const std::string &varname, ErrorPath errorPath);
void uninitvarError(const Token *tok, const std::string &varname) {
ErrorPath errorPath;
uninitvarError(tok, varname, std::move(errorPath));
uninitvarError(tok, varname, ErrorPath{});
}
void uninitvarError(const Token *tok, const std::string &varname, Alloc alloc) {
if (alloc == NO_CTOR_CALL || alloc == CTOR_CALL)
Expand Down

0 comments on commit d307417

Please sign in to comment.