Skip to content

Commit

Permalink
Merge pull request danmar#554 from Dmitry-Me/moveDeclaartionToFirstUse
Browse files Browse the repository at this point in the history
Move declaration to where it's first needed
  • Loading branch information
amai2012 committed Mar 18, 2015
2 parents 63fc592 + 15a847c commit e5e7c5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tokenize.cpp
Expand Up @@ -9228,7 +9228,6 @@ void Tokenizer::simplifyAttribute()
}

else if (Token::Match(tok->tokAt(2), "( unused|__unused__|used|__used__ )")) {
const std::string &attribute(tok->strAt(3));
Token *vartok = nullptr;

// check if after variable name
Expand All @@ -9242,6 +9241,7 @@ void Tokenizer::simplifyAttribute()
vartok = tok->next()->link()->next();

if (vartok) {
const std::string &attribute(tok->strAt(3));
if (attribute.find("unused") != std::string::npos)
vartok->isAttributeUnused(true);
else
Expand All @@ -9250,7 +9250,6 @@ void Tokenizer::simplifyAttribute()
}

else if (Token::Match(tok->tokAt(2), "( pure|__pure__|const|__const__|noreturn|__noreturn__|nothrow|__nothrow__ )")) {
const std::string &attribute(tok->strAt(3));
Token *functok = nullptr;

// type func(...) __attribute__((attribute));
Expand All @@ -9267,6 +9266,7 @@ void Tokenizer::simplifyAttribute()
}

if (functok) {
const std::string &attribute(tok->strAt(3));
if (attribute.find("pure") != std::string::npos)
functok->isAttributePure(true);
else if (attribute.find("const") != std::string::npos)
Expand Down

0 comments on commit e5e7c5d

Please sign in to comment.