checkautovariables: added newlines to make code more readable.

No code change.
This commit is contained in:
Slava Semushin 2009-07-28 00:34:17 +07:00
parent bb4b2b707c
commit 82ae0e305b
2 changed files with 8 additions and 0 deletions

View File

@ -78,6 +78,7 @@ bool CheckAutoVariables::errorAv(const Token* left, const Token* right)
return true;
}
bool CheckAutoVariables::isAutoVar(const Token* t)
{
std::list<std::string>::iterator id_vd;
@ -90,6 +91,7 @@ bool CheckAutoVariables::isAutoVar(const Token* t)
}
return false;
}
void print(const Token *tok, int num)
{
const Token *t = tok;
@ -101,6 +103,7 @@ void print(const Token *tok, int num)
}
std::cout << std::endl;
}
bool isTypeName(const Token *tok)
{
bool ret = false;
@ -110,6 +113,7 @@ bool isTypeName(const Token *tok)
ret |= (_str == type[i]);
return !ret;
}
bool isExternOrStatic(const Token *tok)
{
bool res = false;
@ -125,6 +129,7 @@ bool isExternOrStatic(const Token *tok)
return res;
}
void CheckAutoVariables::addVD(const Token* tok)
{
std::string var_name(tok->str());
@ -132,6 +137,7 @@ void CheckAutoVariables::addVD(const Token* tok)
//std::cout << "VD " << tok->linenr() << " " << var_name << std::endl;
vd_list.push_back(var_name);
}
void CheckAutoVariables::autoVariables()
{
bool begin_function = false;

View File

@ -87,6 +87,7 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
}
void testautovararray()
{
check("void func1(int* arr[2])\n"
@ -95,6 +96,7 @@ private:
"arr[0]=&num;}");
ASSERT_EQUALS("[test.cpp:3]: (error) Wrong assignement of an auto-variable to an effective parameter of a function\n", errout.str());
}
void testautovarreturn()
{
check("int* func1()\n"