GLSL: Fix #396: Error when 'defined' comes from macro expansion.

This commit is contained in:
John Kessenich 2017-06-07 17:15:38 -06:00
parent 65755667d5
commit 2eb135506a
4 changed files with 24 additions and 1 deletions

View file

@ -393,6 +393,14 @@ int TPpContext::eval(int token, int precedence, bool shortCircuit, int& res, boo
TSourceLoc loc = ppToken->loc; // because we sometimes read the newline before reporting the error
if (token == PpAtomIdentifier) {
if (strcmp("defined", ppToken->name) == 0) {
if (isMacroInput()) {
if (parseContext.relaxedErrors())
parseContext.ppWarn(ppToken->loc, "nonportable when expanded from macros for preprocessor expression",
"defined", "");
else
parseContext.ppError(ppToken->loc, "cannot use in preprocessor expression when expanded from macros",
"defined", "");
}
bool needclose = 0;
token = scanToken(ppToken);
if (token == '(') {