Merge pull request #390 from Dmitry-Me/suppressGccShadowingWarning

Avoid GCC name shadowing warning.
This commit is contained in:
PKEuS 2014-08-09 10:34:36 +02:00
commit 728d0fb9dc
1 changed files with 8 additions and 8 deletions

View File

@ -853,26 +853,26 @@ void CheckClass::privateFunctions()
if (Token::findsimplematch(scope->classStart, "; __property ;", scope->classEnd)) if (Token::findsimplematch(scope->classStart, "; __property ;", scope->classEnd))
continue; continue;
std::list<const Function*> privateFunctions; std::list<const Function*> privateFuncs;
for (std::list<Function>::const_iterator func = scope->functionList.begin(); func != scope->functionList.end(); ++func) { for (std::list<Function>::const_iterator func = scope->functionList.begin(); func != scope->functionList.end(); ++func) {
// Get private functions.. // Get private functions..
if (func->type == Function::eFunction && func->access == Private && !func->isOperator) // TODO: There are smarter ways to check private operator usage if (func->type == Function::eFunction && func->access == Private && !func->isOperator) // TODO: There are smarter ways to check private operator usage
privateFunctions.push_back(&*func); privateFuncs.push_back(&*func);
} }
// Bailout for overridden virtual functions of base classes // Bailout for overridden virtual functions of base classes
if (!scope->definedType->derivedFrom.empty()) { if (!scope->definedType->derivedFrom.empty()) {
// Check virtual functions // Check virtual functions
for (std::list<const Function*>::iterator it = privateFunctions.begin(); it != privateFunctions.end();) { for (std::list<const Function*>::iterator it = privateFuncs.begin(); it != privateFuncs.end();) {
if ((*it)->isImplicitlyVirtual(true)) // Give true as default value to be returned if we don't see all base classes if ((*it)->isImplicitlyVirtual(true)) // Give true as default value to be returned if we don't see all base classes
privateFunctions.erase(it++); privateFuncs.erase(it++);
else else
++it; ++it;
} }
} }
while (!privateFunctions.empty()) { while (!privateFuncs.empty()) {
const std::string& funcName = privateFunctions.front()->tokenDef->str(); const std::string& funcName = privateFuncs.front()->tokenDef->str();
// Check that all private functions are used // Check that all private functions are used
bool used = checkFunctionUsage(funcName, &*scope); // Usage in this class bool used = checkFunctionUsage(funcName, &*scope); // Usage in this class
// Check in friend classes // Check in friend classes
@ -885,9 +885,9 @@ void CheckClass::privateFunctions()
} }
if (!used) if (!used)
unusedPrivateFunctionError(privateFunctions.front()->tokenDef, scope->className, funcName); unusedPrivateFunctionError(privateFuncs.front()->tokenDef, scope->className, funcName);
privateFunctions.pop_front(); privateFuncs.pop_front();
} }
} }
} }