refactoring - added 'getErrorMessages' to all check classes

This commit is contained in:
Daniel Marjamäki 2009-03-22 08:20:15 +01:00
parent 0a71771c6a
commit e017d5a079
8 changed files with 72 additions and 2 deletions

View File

@ -61,8 +61,7 @@ public:
virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) = 0;
/** get error messages */
virtual void getErrorMessages()
{ }
virtual void getErrorMessages() = 0;
protected:
const Tokenizer * const _tokenizer;

View File

@ -54,6 +54,11 @@ private:
bool error_av(const Token* left, const Token* right);
bool is_auto_var(const Token* t);
void addVD(const Token* t);
void getErrorMessages()
{
reportError(0, "error", "autoVariables", "Wrong assignement of an auto-variable to an effective parameter of a function");
}
};
//---------------------------------------------------------------------------

View File

@ -72,6 +72,14 @@ private:
void bufferOverrun(const Token *tok);
void strncatUsage(const Token *tok);
void outOfBounds(const Token *tok, const std::string &what);
void getErrorMessages()
{
arrayIndexOutOfBounds(0);
bufferOverrun(0);
strncatUsage(0);
outOfBounds(0, "index");
}
};
//---------------------------------------------------------------------------

View File

@ -107,6 +107,17 @@ private:
void operatorEqError(const Token *tok);
void virtualDestructorError(const Token *tok, const std::string &Base, const std::string &Derived);
void getErrorMessages()
{
noConstructorError(0, "classname");
uninitVarError(0, "classname", "varname");
unusedPrivateFunctionError(0, "classname", "funcname");
memsetClassError(0, "memfunc");
memsetStructError(0, "memfunc", "classname");
operatorEqError(0);
virtualDestructorError(0, "Base", "Derived");
}
};
//---------------------------------------------------------------------------
#endif

View File

@ -52,6 +52,12 @@ private:
void dangerousFunctiongets(const Token *tok);
void dangerousFunctionscanf(const Token *tok);
void getErrorMessages()
{
dangerousFunctionmktemp(0);
dangerousFunctiongets(0);
dangerousFunctionscanf(0);
}
};

View File

@ -133,6 +133,21 @@ private:
void mismatchSizeError(const Token *tok, const std::string &sz);
void mismatchAllocDealloc(const std::list<const Token *> &callstack, const std::string &varname);
void getErrorMessages()
{
memleakError(0, "varname");
memleakallError(0, "varname");
resourceLeakError(0, "varname");
deallocDeallocError(0, "varname");
deallocuseError(0, "varname");
mismatchSizeError(0, "sz");
std::list<const Token *> callstack;
mismatchAllocDealloc(callstack, "varname");
}
// Experimental functionality..
protected:
Token *functionParameterCode(const Token *ftok, int parameter);

View File

@ -132,6 +132,27 @@ private:
void strPlusChar(const Token *tok);
void returnLocalVariable(const Token *tok);
void getErrorMessages()
{
cstyleCastError(0);
redundantIfDelete0Error(0);
redundantIfRemoveError(0);
dangerousUsageStrtolError(0);
ifNoActionError(0);
sprintfOverlappingDataError(0, "varname");
udivError(0);
udivWarning(0);
unusedStructMemberError(0, "structname", "varname");
passedByValueError(0, "parname");
constStatementError(0, "type");
charArrayIndexError(0);
charBitOpError(0);
variableScopeError(0, "varname");
conditionAlwaysTrueFalse(0, "true/false");
strPlusChar(0);
returnLocalVariable(0);
}
};
//---------------------------------------------------------------------------

View File

@ -52,6 +52,11 @@ public:
private:
void unvalidatedInput(const Token *tok);
void getErrorMessages()
{
unvalidatedInput(0);
}
};
//---------------------------------------------------------------------------