Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0. Run astyle

This commit is contained in:
Alexander Mai 2015-07-01 07:50:13 +02:00
parent 480a5672b0
commit 6e03e7dca2
11 changed files with 71 additions and 70 deletions

View File

@ -1764,7 +1764,7 @@ bool CheckClass::isMemberVar(const Scope *scope, const Token *tok) const
}
// not found in this class
if (!scope->definedType->derivedFrom.empty() && !scope->definedType->hasCircularDependencies()) {
if (!scope->definedType->derivedFrom.empty()) {
// check each base class
for (std::size_t i = 0; i < scope->definedType->derivedFrom.size(); ++i) {
// find the base class
@ -1794,7 +1794,7 @@ bool CheckClass::isMemberFunc(const Scope *scope, const Token *tok) const
const Type *derivedFrom = scope->definedType->derivedFrom[i].type;
// find the function in the base class
if (derivedFrom && derivedFrom->classScope && !derivedFrom->hasCircularDependencies()) {
if (derivedFrom && derivedFrom->classScope) {
if (isMemberFunc(derivedFrom->classScope, tok))
return true;
}
@ -1817,7 +1817,7 @@ bool CheckClass::isConstMemberFunc(const Scope *scope, const Token *tok) const
const Type *derivedFrom = scope->definedType->derivedFrom[i].type;
// find the function in the base class
if (derivedFrom && derivedFrom->classScope && !derivedFrom->hasCircularDependencies()) {
if (derivedFrom && derivedFrom->classScope) {
if (isConstMemberFunc(derivedFrom->classScope, tok))
return true;
}

View File

@ -41,7 +41,8 @@ namespace {
<< "fgetgrent" << "ecvt" << "gcvt" << "getservent" << "gethostent" << "getgrent" << "fcvt" ;
}
std::string CheckNonReentrantFunctions::generateErrorMessage(const std::string& function) {
std::string CheckNonReentrantFunctions::generateErrorMessage(const std::string& function)
{
return std::string("Non reentrant function '") + function + "' called. " +
"For threadsafe applications it is recommended to use the reentrant replacement function '" + function + "_r'.";
}
@ -83,7 +84,8 @@ void CheckNonReentrantFunctions::nonReentrantFunctions()
}
//---------------------------------------------------------------------------
void CheckNonReentrantFunctions::getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const {
void CheckNonReentrantFunctions::getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const
{
CheckNonReentrantFunctions c(0, settings, errorLogger);
std::set<std::string>::const_iterator it(_nonReentrantFunctions.begin()), itend(_nonReentrantFunctions.end());
@ -92,7 +94,8 @@ void CheckNonReentrantFunctions::getErrorMessages(ErrorLogger *errorLogger, cons
}
}
std::string CheckNonReentrantFunctions::classInfo() const {
std::string CheckNonReentrantFunctions::classInfo() const
{
std::string info = "Warn if any of these non reentrant functions are used:\n";
std::set<std::string>::const_iterator it(_nonReentrantFunctions.begin()), itend(_nonReentrantFunctions.end());
for (; it!=itend; ++it) {

View File

@ -849,8 +849,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
if (found && found->findDependency(&(*it))) {
// circular dependency
//_tokenizer->syntaxError(nullptr);
}
else {
} else {
it->derivedFrom[i].type = found;
}
}
@ -2062,7 +2061,8 @@ bool Type::hasCircularDependencies(std::set<BaseInfo>* anchestors) const
return false;
}
bool Type::findDependency(const Type* anchestor) const {
bool Type::findDependency(const Type* anchestor) const
{
if (this==anchestor)
return true;
for (std::vector<BaseInfo>::const_iterator parent=derivedFrom.begin(); parent!=derivedFrom.end(); ++parent) {

View File

@ -824,8 +824,7 @@ const Token * Token::findClosingBracket() const
closing = closing->link();
if (!closing)
return nullptr; // #6803
}
else if (Token::Match(closing, "}|]|)|;"))
} else if (Token::Match(closing, "}|]|)|;"))
break;
else if (closing->str() == "<")
++depth;

View File

@ -148,8 +148,7 @@ private:
// run alternate check first. It should only ensure stability
try {
checkCodeInternal(code, alternatefilename);
}
catch(InternalError& ) {
} catch (InternalError&) {
}
return checkCodeInternal(code, filename);