Validate that there are no tokens following #undef on the same line.
Fixes:
dEQP-GLES2.functional.shaders.preprocessor.definitions.undefine_object_invalid_syntax_vertex
dEQP-GLES2.functional.shaders.preprocessor.definitions.undefine_object_invalid_syntax_fragment
dEQP-GLES2.functional.shaders.preprocessor.invalid_definitions.undef_non_identifier_2_vertex
dEQP-GLES2.functional.shaders.preprocessor.invalid_definitions.undef_non_identifier_2_fragment
BUG=angleproject:989
Change-Id: I279a38aaae8010017ef6e3f1aa139ae03f374680
Reviewed-on: https://chromium-review.googlesource.com/267397
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/compiler/preprocessor/DirectiveParser.cpp b/src/compiler/preprocessor/DirectiveParser.cpp
index 7803ee8..55ff3f6 100644
--- a/src/compiler/preprocessor/DirectiveParser.cpp
+++ b/src/compiler/preprocessor/DirectiveParser.cpp
@@ -435,6 +435,12 @@
}
mTokenizer->lex(token);
+ if (!isEOD(token))
+ {
+ mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
+ token->location, token->text);
+ skipUntilEOD(mTokenizer, token);
+ }
}
void DirectiveParser::parseIf(Token *token)