Expand macros, skipping empty expansions, to get to the first real token in those expansions.
| 580 | |
| 581 | // Expand macros, skipping empty expansions, to get to the first real token in those expansions. |
| 582 | int TPpContext::evalToToken(int token, bool shortCircuit, int& res, bool& err, TPpToken* ppToken) |
| 583 | { |
| 584 | while (token == PpAtomIdentifier && strcmp("defined", ppToken->name) != 0) { |
| 585 | switch (MacroExpand(ppToken, true, false)) { |
| 586 | case MacroExpandNotStarted: |
| 587 | case MacroExpandError: |
| 588 | parseContext.ppError(ppToken->loc, "can't evaluate expression", "preprocessor evaluation", ""); |
| 589 | err = true; |
| 590 | res = 0; |
| 591 | break; |
| 592 | case MacroExpandStarted: |
| 593 | break; |
| 594 | case MacroExpandUndef: |
| 595 | if (! shortCircuit && parseContext.isEsProfile()) { |
| 596 | const char* message = "undefined macro in expression not allowed in es profile"; |
| 597 | if (parseContext.relaxedErrors()) |
| 598 | parseContext.ppWarn(ppToken->loc, message, "preprocessor evaluation", ppToken->name); |
| 599 | else |
| 600 | parseContext.ppError(ppToken->loc, message, "preprocessor evaluation", ppToken->name); |
| 601 | } |
| 602 | break; |
| 603 | } |
| 604 | token = scanToken(ppToken); |
| 605 | if (err) |
| 606 | break; |
| 607 | } |
| 608 | |
| 609 | return token; |
| 610 | } |
| 611 | |
| 612 | // Handle #if |
| 613 | int TPpContext::CPPif(TPpToken* ppToken) |
nothing calls this directly
no test coverage detected