Fixed typos. There are no real changes.
This commit is contained in:
parent
ed453d24da
commit
919f8ac323
|
@ -73,10 +73,10 @@ bool isWithoutSideEffects(bool cpp, const Token* tok);
|
||||||
bool isReturnScope(const Token *endToken);
|
bool isReturnScope(const Token *endToken);
|
||||||
|
|
||||||
/** Is variable changed by function call?
|
/** Is variable changed by function call?
|
||||||
* In case the anser of the question is inconclusive, e.g. because the function declaration is not known
|
* In case the answer of the question is inconclusive, e.g. because the function declaration is not known
|
||||||
* the return value is false and the output parameter inconclusive is set to true
|
* the return value is false and the output parameter inconclusive is set to true
|
||||||
*
|
*
|
||||||
* @param tok token of varible in function call
|
* @param tok token of variable in function call
|
||||||
* @param settings program settings
|
* @param settings program settings
|
||||||
* @param inconclusive pointer to output variable which indicates that the answer of the question is inconclusive
|
* @param inconclusive pointer to output variable which indicates that the answer of the question is inconclusive
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Variable;
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
||||||
/** @brief checks dealing with suspicous usage of boolean type (not for evaluating conditions) */
|
/** @brief checks dealing with suspicious usage of boolean type (not for evaluating conditions) */
|
||||||
|
|
||||||
class CPPCHECKLIB CheckBool : public Check {
|
class CPPCHECKLIB CheckBool : public Check {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -521,7 +521,7 @@ void CheckIO::checkWrongPrintfScanfArguments()
|
||||||
if (!findFormat(1, tok->tokAt(2), &formatStringTok, &argListTok))
|
if (!findFormat(1, tok->tokAt(2), &formatStringTok, &argListTok))
|
||||||
continue;
|
continue;
|
||||||
} else if (Token::simpleMatch(tok, "swprintf (") && !Token::Match(tok->tokAt(2)->nextArgument(), "%str%")) {
|
} else if (Token::simpleMatch(tok, "swprintf (") && !Token::Match(tok->tokAt(2)->nextArgument(), "%str%")) {
|
||||||
// Find forth parameter and format string
|
// Find fourth parameter and format string
|
||||||
if (!findFormat(2, tok->tokAt(2), &formatStringTok, &argListTok))
|
if (!findFormat(2, tok->tokAt(2), &formatStringTok, &argListTok))
|
||||||
continue;
|
continue;
|
||||||
} else if (isWindows && Token::Match(tok, "sprintf_s|swprintf_s (")) {
|
} else if (isWindows && Token::Match(tok, "sprintf_s|swprintf_s (")) {
|
||||||
|
|
|
@ -1649,7 +1649,7 @@ void CheckOther::checkIncompleteStatement()
|
||||||
else if (Token::Match(tok,"> %name% {") || Token::Match(tok, "[;{}] return {"))
|
else if (Token::Match(tok,"> %name% {") || Token::Match(tok, "[;{}] return {"))
|
||||||
tok = tok->linkAt(2);
|
tok = tok->linkAt(2);
|
||||||
|
|
||||||
// C++11 initialize set in initalizer list : [,:] std::set<int>{1} [{,]
|
// C++11 initialize set in initializer list : [,:] std::set<int>{1} [{,]
|
||||||
else if (Token::simpleMatch(tok,"> {") && tok->link())
|
else if (Token::simpleMatch(tok,"> {") && tok->link())
|
||||||
tok = tok->next()->link();
|
tok = tok->next()->link();
|
||||||
|
|
||||||
|
@ -1774,7 +1774,7 @@ void CheckOther::nanInArithmeticExpressionError(const Token *tok)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Creating instance of clases which are destroyed immediately
|
// Creating instance of classes which are destroyed immediately
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void CheckOther::checkMisusedScopedObject()
|
void CheckOther::checkMisusedScopedObject()
|
||||||
{
|
{
|
||||||
|
@ -2104,7 +2104,7 @@ void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse()
|
||||||
const unsigned int varidLeft = tok->tokAt(2)->varId();// get the left varid
|
const unsigned int varidLeft = tok->tokAt(2)->varId();// get the left varid
|
||||||
const unsigned int varidRight = tok->tokAt(4)->varId();// get the right varid
|
const unsigned int varidRight = tok->tokAt(4)->varId();// get the right varid
|
||||||
// compare varids: if they are not zero but equal
|
// compare varids: if they are not zero but equal
|
||||||
// --> the comparison function is calles with the same variables
|
// --> the comparison function is called with the same variables
|
||||||
if (varidLeft == varidRight) {
|
if (varidLeft == varidRight) {
|
||||||
const std::string& functionName = tok->str(); // store function name
|
const std::string& functionName = tok->str(); // store function name
|
||||||
const std::string& varNameLeft = tok->strAt(2); // get the left variable name
|
const std::string& varNameLeft = tok->strAt(2); // get the left variable name
|
||||||
|
@ -2290,7 +2290,7 @@ void CheckOther::redundantCopyError(const Token *tok,const std::string& varname)
|
||||||
"The const variable '"+varname+"' is assigned a copy of the data. You can avoid "
|
"The const variable '"+varname+"' is assigned a copy of the data. You can avoid "
|
||||||
"the unnecessary data copying by converting '" + varname + "' to const reference.",
|
"the unnecessary data copying by converting '" + varname + "' to const reference.",
|
||||||
CWE398,
|
CWE398,
|
||||||
true); // since #5618 that check became inconlusive
|
true); // since #5618 that check became inconclusive
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -2672,7 +2672,7 @@ void CheckOther::checkEvaluationOrder()
|
||||||
if (!tok3)
|
if (!tok3)
|
||||||
continue;
|
continue;
|
||||||
if (tok3->str() == "&" && !tok3->astOperand2())
|
if (tok3->str() == "&" && !tok3->astOperand2())
|
||||||
continue; // don't handle adress-of for now
|
continue; // don't handle address-of for now
|
||||||
if (tok3->str() == "(" && Token::simpleMatch(tok3->previous(), "sizeof"))
|
if (tok3->str() == "(" && Token::simpleMatch(tok3->previous(), "sizeof"))
|
||||||
continue; // don't care about sizeof usage
|
continue; // don't care about sizeof usage
|
||||||
tokens.push(tok3->astOperand1());
|
tokens.push(tok3->astOperand1());
|
||||||
|
|
|
@ -332,7 +332,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Convert XML-sensitive characters into XML entities
|
* Convert XML-sensitive characters into XML entities
|
||||||
* @param str The input string containing XML-sensitive characters
|
* @param str The input string containing XML-sensitive characters
|
||||||
* @return The ouput string containing XML entities
|
* @return The output string containing XML entities
|
||||||
*/
|
*/
|
||||||
static std::string toxml(const std::string &str);
|
static std::string toxml(const std::string &str);
|
||||||
};
|
};
|
||||||
|
|
|
@ -118,7 +118,7 @@ private:
|
||||||
TEST_CASE(clarifyStatement);
|
TEST_CASE(clarifyStatement);
|
||||||
|
|
||||||
TEST_CASE(duplicateBranch);
|
TEST_CASE(duplicateBranch);
|
||||||
TEST_CASE(duplicateBranch1); // tests extracted by http://www.viva64.com/en/b/0149/ ( Comparison between PVS-Studio and cppcheck ): Errors detected in Quake 3: Arena by PVS-Studio: Fragement 2
|
TEST_CASE(duplicateBranch1); // tests extracted by http://www.viva64.com/en/b/0149/ ( Comparison between PVS-Studio and cppcheck ): Errors detected in Quake 3: Arena by PVS-Studio: Fragment 2
|
||||||
TEST_CASE(duplicateBranch2); // empty macro
|
TEST_CASE(duplicateBranch2); // empty macro
|
||||||
TEST_CASE(duplicateExpression1);
|
TEST_CASE(duplicateExpression1);
|
||||||
TEST_CASE(duplicateExpression2); // ticket #2730
|
TEST_CASE(duplicateExpression2); // ticket #2730
|
||||||
|
@ -3338,7 +3338,7 @@ private:
|
||||||
void duplicateBranch1() {
|
void duplicateBranch1() {
|
||||||
|
|
||||||
// tests inspired by http://www.viva64.com/en/b/0149/ ( Comparison between PVS-Studio and cppcheck )
|
// tests inspired by http://www.viva64.com/en/b/0149/ ( Comparison between PVS-Studio and cppcheck )
|
||||||
// Errors detected in Quake 3: Arena by PVS-Studio: Fragement 2
|
// Errors detected in Quake 3: Arena by PVS-Studio: Fragment 2
|
||||||
check("void f()\n"
|
check("void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" if (front < 0)\n"
|
" if (front < 0)\n"
|
||||||
|
|
Loading…
Reference in New Issue