Restore blue-painting of macro arg expansions to prevent recursion

This commit is contained in:
Rangi42
2025-07-20 11:53:36 -04:00
parent cfe1f60e47
commit e3a5290dad
4 changed files with 16 additions and 0 deletions

View File

@@ -817,6 +817,11 @@ static int peek() {
shiftChar();
if (std::shared_ptr<std::string> str = readMacroArg(); str) {
beginExpansion(str, std::nullopt);
// Mark the entire macro arg expansion as "painted blue"
// so that macro args can't be recursive
// https://en.wikipedia.org/wiki/Painted_blue
lexerState->macroArgScanDistance += str->length();
}
} else if (c == '{' && !lexerState->disableInterpolation) {
// If character is an open brace, do symbol interpolation