Commit 95a423d0 by Geoff Lang

Unexpected tokens after conditionals should be an error instead of a warning.

Fixes: dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_if_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_if_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_else_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_else_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_endif_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_endif_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifdef_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifdef_fragment dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifndef_vertex dEQP-GLES2.functional.shaders.preprocessor.invalid_conditionals.tokens_after_ifndef_fragment BUG=angleproject:989 Change-Id: I6511f7082c98206fb623775d81329b6bc7673c1a Reviewed-on: https://chromium-review.googlesource.com/267638Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent d3c29f57
...@@ -52,6 +52,7 @@ class Diagnostics ...@@ -52,6 +52,7 @@ class Diagnostics
PP_CONDITIONAL_ELIF_WITHOUT_IF, PP_CONDITIONAL_ELIF_WITHOUT_IF,
PP_CONDITIONAL_ELIF_AFTER_ELSE, PP_CONDITIONAL_ELIF_AFTER_ELSE,
PP_CONDITIONAL_UNTERMINATED, PP_CONDITIONAL_UNTERMINATED,
PP_CONDITIONAL_UNEXPECTED_TOKEN,
PP_INVALID_EXTENSION_NAME, PP_INVALID_EXTENSION_NAME,
PP_INVALID_EXTENSION_BEHAVIOR, PP_INVALID_EXTENSION_BEHAVIOR,
PP_INVALID_EXTENSION_DIRECTIVE, PP_INVALID_EXTENSION_DIRECTIVE,
...@@ -67,7 +68,6 @@ class Diagnostics ...@@ -67,7 +68,6 @@ class Diagnostics
PP_WARNING_BEGIN, PP_WARNING_BEGIN,
PP_EOF_IN_DIRECTIVE, PP_EOF_IN_DIRECTIVE,
PP_CONDITIONAL_UNEXPECTED_TOKEN,
PP_UNRECOGNIZED_PRAGMA, PP_UNRECOGNIZED_PRAGMA,
PP_WARNING_END PP_WARNING_END
}; };
......
...@@ -492,7 +492,7 @@ void DirectiveParser::parseElse(Token *token) ...@@ -492,7 +492,7 @@ void DirectiveParser::parseElse(Token *token)
block.skipGroup = block.foundValidGroup; block.skipGroup = block.foundValidGroup;
block.foundValidGroup = true; block.foundValidGroup = true;
// Warn if there are extra tokens after #else. // Check if there are extra tokens after #else.
mTokenizer->lex(token); mTokenizer->lex(token);
if (!isEOD(token)) if (!isEOD(token))
{ {
...@@ -556,7 +556,7 @@ void DirectiveParser::parseEndif(Token *token) ...@@ -556,7 +556,7 @@ void DirectiveParser::parseEndif(Token *token)
mConditionalStack.pop_back(); mConditionalStack.pop_back();
// Warn if there are tokens after #endif. // Check if there are tokens after #endif.
mTokenizer->lex(token); mTokenizer->lex(token);
if (!isEOD(token)) if (!isEOD(token))
{ {
...@@ -925,7 +925,7 @@ int DirectiveParser::parseExpressionIf(Token *token) ...@@ -925,7 +925,7 @@ int DirectiveParser::parseExpressionIf(Token *token)
macroExpander.lex(token); macroExpander.lex(token);
expressionParser.parse(token, &expression); expressionParser.parse(token, &expression);
// Warn if there are tokens after #if expression. // Check if there are tokens after #if expression.
if (!isEOD(token)) if (!isEOD(token))
{ {
mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN, mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
...@@ -953,7 +953,7 @@ int DirectiveParser::parseExpressionIfdef(Token *token) ...@@ -953,7 +953,7 @@ int DirectiveParser::parseExpressionIfdef(Token *token)
MacroSet::const_iterator iter = mMacroSet->find(token->text); MacroSet::const_iterator iter = mMacroSet->find(token->text);
int expression = iter != mMacroSet->end() ? 1 : 0; int expression = iter != mMacroSet->end() ? 1 : 0;
// Warn if there are tokens after #ifdef expression. // Check if there are tokens after #ifdef expression.
mTokenizer->lex(token); mTokenizer->lex(token);
if (!isEOD(token)) if (!isEOD(token))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment