Refactorizations:

- Disabled some parts of setVarId() for C code.
- Fixed mistake in <contaier> documentation
This commit is contained in:
PKEuS 2015-01-04 10:52:11 +01:00
parent 8dd569b9e1
commit 016e89e422
2 changed files with 7 additions and 7 deletions

View File

@ -2651,7 +2651,7 @@ void Tokenizer::setVarId()
if (notstart.find(tok2->str()) != notstart.end()) if (notstart.find(tok2->str()) != notstart.end())
continue; continue;
if (Token::simpleMatch(tok2, "const new") && !isC()) if (!isC() && Token::simpleMatch(tok2, "const new"))
continue; continue;
bool decl = setVarIdParseDeclaration(&tok2, variableId, executableScope.top(), isCPP(), isC()); bool decl = setVarIdParseDeclaration(&tok2, variableId, executableScope.top(), isCPP(), isC());
@ -2697,7 +2697,7 @@ void Tokenizer::setVarId()
} else } else
decl = false; decl = false;
} else if (isCPP() && Token::Match(prev2, "%type% {") && Token::simpleMatch(tok2->link(), "} ;")) { // C++11 initialization style } else if (isCPP() && Token::Match(prev2, "%type% {") && Token::simpleMatch(tok2->link(), "} ;")) { // C++11 initialization style
if (Token::Match(prev2, "do|try|else") || Token::Match(prev2->tokAt(-2), "struct|class")) if (Token::Match(prev2, "do|try|else") || Token::Match(prev2->tokAt(-2), "struct|class|:"))
continue; continue;
} else } else
decl = false; decl = false;
@ -2746,7 +2746,7 @@ void Tokenizer::setVarId()
// Member functions and variables in this source // Member functions and variables in this source
std::list<Token *> allMemberFunctions; std::list<Token *> allMemberFunctions;
std::list<Token *> allMemberVars; std::list<Token *> allMemberVars;
{ if (!isC()) {
for (Token *tok2 = list.front(); tok2; tok2 = tok2->next()) { for (Token *tok2 = list.front(); tok2; tok2 = tok2->next()) {
if (Token::Match(tok2, "%var% :: %var%")) { if (Token::Match(tok2, "%var% :: %var%")) {
if (tok2->strAt(3) == "(") if (tok2->strAt(3) == "(")
@ -2806,7 +2806,7 @@ void Tokenizer::setVarId()
tok2->varId(varlist[classname][tok2->str()]); tok2->varId(varlist[classname][tok2->str()]);
} }
if (namesp) if (namesp || isC())
continue; continue;
// Set variable ids in member functions for this class.. // Set variable ids in member functions for this class..

View File

@ -5,7 +5,7 @@
<bookinfo> <bookinfo>
<title>Cppcheck 1.69 dev</title> <title>Cppcheck 1.69 dev</title>
<date>2014-09-28</date> <date>2015-01-03</date>
</bookinfo> </bookinfo>
<chapter> <chapter>
@ -938,8 +938,8 @@ Checking unusedvar.cpp...
&lt;/size&gt; &lt;/size&gt;
&lt;access indexOperator="array-like"&gt; &lt;access indexOperator="array-like"&gt;
&lt;function name="at" yields="at_index"/&gt; &lt;function name="at" yields="at_index"/&gt;
&lt;function name="front" yields="fixed"/&gt; &lt;function name="front" yields="item"/&gt;
&lt;function name="back" yields="fixed"/&gt; &lt;function name="back" yields="item"/&gt;
&lt;/access&gt; &lt;/access&gt;
&lt;/container&gt; &lt;/container&gt;
&lt;/def&gt;</programlisting> &lt;/def&gt;</programlisting>