Update errormessage.h and code using it.
This commit is contained in:
parent
cec57b76d3
commit
2b2152919f
|
@ -428,7 +428,7 @@ void CheckOther::CheckUnsignedDivision()
|
|||
|
||||
else if (!Token::Match(tok, "[).]") && Token::Match(tok->next(), "%var% / - %num%"))
|
||||
{
|
||||
if (ErrorMessage::udivError(_settings))
|
||||
if (ErrorMessage::udivError())
|
||||
{
|
||||
const char *varname1 = tok->strAt(1);
|
||||
char sign1 = varsign[varname1];
|
||||
|
@ -441,7 +441,7 @@ void CheckOther::CheckUnsignedDivision()
|
|||
|
||||
else if (Token::Match(tok, "[([=*/+-] - %num% / %var%"))
|
||||
{
|
||||
if (ErrorMessage::udivError(_settings))
|
||||
if (ErrorMessage::udivError())
|
||||
{
|
||||
const char *varname2 = tok->strAt(4);
|
||||
char sign2 = varsign[varname2];
|
||||
|
|
|
@ -235,7 +235,7 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
|
|||
// The 'memset' function can do dangerous things if used wrong.
|
||||
// Important: The checking doesn't work on simplified tokens list.
|
||||
CheckClass checkClass(&_tokenizer, _settings, this);
|
||||
if (ErrorMessage::memsetClass(_settings))
|
||||
if (ErrorMessage::memsetClass())
|
||||
checkClass.noMemset();
|
||||
|
||||
|
||||
|
@ -243,7 +243,7 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
|
|||
CheckOther checkOther(&_tokenizer, _settings, this);
|
||||
|
||||
// Check for unsigned divisions where one operand is signed
|
||||
if (ErrorMessage::udivWarning(_settings) || ErrorMessage::udivError(_settings))
|
||||
if (ErrorMessage::udivWarning(_settings) || ErrorMessage::udivError())
|
||||
checkOther.CheckUnsignedDivision();
|
||||
|
||||
// Give warning when using char variable as array index
|
||||
|
@ -267,15 +267,15 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
|
|||
|
||||
// Memory leak
|
||||
CheckMemoryLeakClass checkMemoryLeak(&_tokenizer, _settings, this);
|
||||
if (ErrorMessage::memleak(_settings) && ErrorMessage::mismatchAllocDealloc(_settings))
|
||||
if (ErrorMessage::memleak() && ErrorMessage::mismatchAllocDealloc())
|
||||
checkMemoryLeak.CheckMemoryLeak();
|
||||
|
||||
// Check that all class constructors are ok.
|
||||
if (ErrorMessage::noConstructor(_settings) && ErrorMessage::uninitVar(_settings))
|
||||
if (ErrorMessage::noConstructor(_settings) && ErrorMessage::uninitVar())
|
||||
checkClass.constructors();
|
||||
|
||||
// Check that all base classes have virtual destructors
|
||||
if (ErrorMessage::virtualDestructor(_settings))
|
||||
if (ErrorMessage::virtualDestructor())
|
||||
checkClass.virtualDestructor();
|
||||
|
||||
// Array index out of bounds / Buffer overruns..
|
||||
|
@ -302,8 +302,8 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
|
|||
checkOther.WarningRedundantCode();
|
||||
|
||||
// strtol and strtoul usage
|
||||
if (ErrorMessage::dangerousUsageStrtol(_settings) ||
|
||||
ErrorMessage::sprintfOverlappingData(_settings))
|
||||
if (ErrorMessage::dangerousUsageStrtol() ||
|
||||
ErrorMessage::sprintfOverlappingData())
|
||||
checkOther.InvalidFunctionUsage();
|
||||
|
||||
// Check that all private functions are called.
|
||||
|
@ -323,15 +323,15 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
|
|||
checkOther.CheckStructMemberUsage();
|
||||
|
||||
// Unreachable code below a 'return' statement
|
||||
if (ErrorMessage::unreachableCode(_settings))
|
||||
if (ErrorMessage::unreachableCode())
|
||||
checkOther.unreachableCode();
|
||||
|
||||
// Check if a constant function parameter is passed by value
|
||||
if (ErrorMessage::passedByValue(_settings))
|
||||
if (ErrorMessage::passedByValue())
|
||||
checkOther.CheckConstantFunctionParameter();
|
||||
|
||||
// Variable scope (check if the scope could be limited)
|
||||
if (ErrorMessage::variableScope(_settings))
|
||||
if (ErrorMessage::variableScope())
|
||||
checkOther.CheckVariableScope();
|
||||
|
||||
// Check for various types of incomplete statements that could for example
|
||||
|
@ -340,7 +340,7 @@ void CppCheck::checkFile(const std::string &code, const char FileName[])
|
|||
checkOther.CheckIncompleteStatement();
|
||||
|
||||
// Unusual pointer arithmetic
|
||||
if (ErrorMessage::strPlusChar(_settings))
|
||||
if (ErrorMessage::strPlusChar())
|
||||
checkOther.strPlusChar();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "" + what + " is out of bounds";
|
||||
}
|
||||
static bool outOfBounds(const Settings &s)
|
||||
static bool outOfBounds()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Uninitialized member variable '" + classname + "::" + varname + "'";
|
||||
}
|
||||
static bool uninitVar(const Settings &s)
|
||||
static bool uninitVar()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Using '" + memfunc + "' on class";
|
||||
}
|
||||
static bool memsetClass(const Settings &s)
|
||||
static bool memsetClass()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Using '" + memfunc + "' on struct that contains a 'std::" + classname + "'";
|
||||
}
|
||||
static bool memsetStruct(const Settings &s)
|
||||
static bool memsetStruct()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Class " + Base + " which is inherited by class " + Derived + " does not have a virtual destructor";
|
||||
}
|
||||
static bool virtualDestructor(const Settings &s)
|
||||
static bool virtualDestructor()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Mismatching allocation and deallocation: " + varname + "";
|
||||
}
|
||||
static bool mismatchAllocDealloc(const Settings &s)
|
||||
static bool mismatchAllocDealloc()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Memory leak: " + varname + "";
|
||||
}
|
||||
static bool memleak(const Settings &s)
|
||||
static bool memleak()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Resource leak: " + varname + "";
|
||||
}
|
||||
static bool resourceLeak(const Settings &s)
|
||||
static bool resourceLeak()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Deallocating a deallocated pointer: " + varname + "";
|
||||
}
|
||||
static bool deallocDealloc(const Settings &s)
|
||||
static bool deallocDealloc()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Invalid radix in call to strtol or strtoul. Must be 0 or 2-36";
|
||||
}
|
||||
static bool dangerousUsageStrtol(const Settings &s)
|
||||
static bool dangerousUsageStrtol()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Overlapping data buffer " + varname + "";
|
||||
}
|
||||
static bool sprintfOverlappingData(const Settings &s)
|
||||
static bool sprintfOverlappingData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Unsigned division. The result will be wrong.";
|
||||
}
|
||||
static bool udivError(const Settings &s)
|
||||
static bool udivError()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Unreachable code below a 'return'";
|
||||
}
|
||||
static bool unreachableCode(const Settings &s)
|
||||
static bool unreachableCode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Function parameter '" + parname + "' is passed by value. It could be passed by reference instead.";
|
||||
}
|
||||
static bool passedByValue(const Settings &s)
|
||||
static bool passedByValue()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "The scope of the variable " + varname + " can be limited";
|
||||
}
|
||||
static bool variableScope(const Settings &s)
|
||||
static bool variableScope()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ public:
|
|||
{
|
||||
return msg1(tokenizer, Location) + "Unusual pointer arithmetic";
|
||||
}
|
||||
static bool strPlusChar(const Settings &s)
|
||||
static bool strPlusChar()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue