preprocessor: bail out code in expandMacros
This commit is contained in:
parent
449dcc2a60
commit
c279f83664
|
@ -481,6 +481,8 @@ std::string Preprocessor::expandMacros(std::string code)
|
||||||
tokenizer.tokenize(istr, "");
|
tokenizer.tokenize(istr, "");
|
||||||
if (! tokenizer.tokens())
|
if (! tokenizer.tokens())
|
||||||
continue;
|
continue;
|
||||||
|
if (! tokenizer.tokens()->isName())
|
||||||
|
continue;
|
||||||
|
|
||||||
// Extract macro parameters
|
// Extract macro parameters
|
||||||
std::vector<std::string> macroparams;
|
std::vector<std::string> macroparams;
|
||||||
|
@ -602,6 +604,7 @@ std::string Preprocessor::expandMacros(std::string code)
|
||||||
// Insert macro code..
|
// Insert macro code..
|
||||||
if (!macroparams.empty())
|
if (!macroparams.empty())
|
||||||
++pos2;
|
++pos2;
|
||||||
|
|
||||||
code.erase(pos1, pos2 - pos1);
|
code.erase(pos1, pos2 - pos1);
|
||||||
code.insert(pos1, macrocode);
|
code.insert(pos1, macrocode);
|
||||||
pos1 += macrocode.length();
|
pos1 += macrocode.length();
|
||||||
|
|
Loading…
Reference in New Issue