From 016e89e4222a8ec652a8c8f051d55542daeff664 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 4 Jan 2015 10:52:11 +0100 Subject: [PATCH] Refactorizations: - Disabled some parts of setVarId() for C code. - Fixed mistake in documentation --- lib/tokenize.cpp | 8 ++++---- man/manual.docbook | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index bfad7ac95..573a41539 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2651,7 +2651,7 @@ void Tokenizer::setVarId() if (notstart.find(tok2->str()) != notstart.end()) continue; - if (Token::simpleMatch(tok2, "const new") && !isC()) + if (!isC() && Token::simpleMatch(tok2, "const new")) continue; bool decl = setVarIdParseDeclaration(&tok2, variableId, executableScope.top(), isCPP(), isC()); @@ -2697,7 +2697,7 @@ void Tokenizer::setVarId() } else decl = false; } 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; } else decl = false; @@ -2746,7 +2746,7 @@ void Tokenizer::setVarId() // Member functions and variables in this source std::list allMemberFunctions; std::list allMemberVars; - { + if (!isC()) { for (Token *tok2 = list.front(); tok2; tok2 = tok2->next()) { if (Token::Match(tok2, "%var% :: %var%")) { if (tok2->strAt(3) == "(") @@ -2806,7 +2806,7 @@ void Tokenizer::setVarId() tok2->varId(varlist[classname][tok2->str()]); } - if (namesp) + if (namesp || isC()) continue; // Set variable ids in member functions for this class.. diff --git a/man/manual.docbook b/man/manual.docbook index 6eecba9fb..e3a80b7a8 100644 --- a/man/manual.docbook +++ b/man/manual.docbook @@ -5,7 +5,7 @@ Cppcheck 1.69 dev - 2014-09-28 + 2015-01-03 @@ -938,8 +938,8 @@ Checking unusedvar.cpp... </size> <access indexOperator="array-like"> <function name="at" yields="at_index"/> - <function name="front" yields="fixed"/> - <function name="back" yields="fixed"/> + <function name="front" yields="item"/> + <function name="back" yields="item"/> </access> </container> </def>