bump simplecpp to rev c49c716dfc6abc0ee23234fa413a69a08e1dc4e8
This commit is contained in:
parent
0422d05a34
commit
1484ceeffb
|
@ -1265,6 +1265,19 @@ private:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int numberOfHash = 1;
|
||||||
|
const Token *hashToken = tok->next;
|
||||||
|
while (sameline(tok,hashToken) && hashToken->op == '#') {
|
||||||
|
hashToken = hashToken->next;
|
||||||
|
++numberOfHash;
|
||||||
|
}
|
||||||
|
if (numberOfHash == 4) {
|
||||||
|
// # ## # => ##
|
||||||
|
output->push_back(newMacroToken("##", loc, isReplaced(expandedmacros)));
|
||||||
|
tok = hashToken;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
tok = tok->next;
|
tok = tok->next;
|
||||||
if (tok == endToken) {
|
if (tok == endToken) {
|
||||||
output->push_back(new Token(*tok->previous));
|
output->push_back(new Token(*tok->previous));
|
||||||
|
@ -1473,23 +1486,30 @@ private:
|
||||||
strAB = A->str + B->str;
|
strAB = A->str + B->str;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool removeComma = false;
|
const Token *nextTok = B->next;
|
||||||
|
|
||||||
if (varargs && tokensB.empty() && tok->previous->str == ",")
|
if (varargs && tokensB.empty() && tok->previous->str == ",")
|
||||||
removeComma = true;
|
output->deleteToken(A);
|
||||||
|
else {
|
||||||
output->deleteToken(A);
|
output->deleteToken(A);
|
||||||
|
|
||||||
if (!removeComma) {
|
|
||||||
TokenList tokens(files);
|
TokenList tokens(files);
|
||||||
tokens.push_back(new Token(strAB, tok->location));
|
tokens.push_back(new Token(strAB, tok->location));
|
||||||
// TODO: For functionLike macros, push the (...)
|
// for function like macros, push the (...)
|
||||||
|
if (tokensB.empty() && sameline(B,B->next) && B->next->op=='(') {
|
||||||
|
const std::map<TokenString,Macro>::const_iterator it = macros.find(strAB);
|
||||||
|
if (it != macros.end() && expandedmacros.find(strAB) == expandedmacros.end() && it->second.functionLike()) {
|
||||||
|
const Token *tok2 = appendTokens(&tokens, B->next, macros, expandedmacros, parametertokens);
|
||||||
|
if (tok2)
|
||||||
|
nextTok = tok2->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
expandToken(output, loc, tokens.cfront(), macros, expandedmacros, parametertokens);
|
expandToken(output, loc, tokens.cfront(), macros, expandedmacros, parametertokens);
|
||||||
for (Token *b = tokensB.front(); b; b = b->next)
|
for (Token *b = tokensB.front(); b; b = b->next)
|
||||||
b->location = loc;
|
b->location = loc;
|
||||||
output->takeTokens(tokensB);
|
output->takeTokens(tokensB);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B->next;
|
return nextTok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isReplaced(const std::set<std::string> &expandedmacros) const {
|
bool isReplaced(const std::set<std::string> &expandedmacros) const {
|
||||||
|
|
Loading…
Reference in New Issue