PP: Rationalize return values of MacroExpand.
This results in better error recovery, including fewer crashes on badly formed PP input.
This commit is contained in:
parent
9cc81de096
commit
802c62bca4
8 changed files with 78 additions and 32 deletions
|
|
@ -1061,8 +1061,17 @@ int TPpContext::tokenize(TPpToken& ppToken)
|
|||
continue;
|
||||
|
||||
// expand macros
|
||||
if (token == PpAtomIdentifier && MacroExpand(&ppToken, false, true) != 0)
|
||||
continue;
|
||||
if (token == PpAtomIdentifier) {
|
||||
switch (MacroExpand(&ppToken, false, true)) {
|
||||
case MacroExpandNotStarted:
|
||||
break;
|
||||
case MacroExpandError:
|
||||
return EndOfInput;
|
||||
case MacroExpandStarted:
|
||||
case MacroExpandUndef:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch (token) {
|
||||
case PpAtomIdentifier:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue