Check for reserved prefixes (gl_, webgl_, and _webgl_) in struct and field names. GLES2 and WebGL both require this for all identifiers - variable, function, struct, and field names. ANGLE was only validating variable and function names.
BUG=11
Review URL: http://codereview.appspot.com/1856046
git-svn-id: https://angleproject.googlecode.com/svn/trunk@347 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/glslang.y b/src/compiler/glslang.y
index 9ab9962..a297ad2 100644
--- a/src/compiler/glslang.y
+++ b/src/compiler/glslang.y
@@ -1749,6 +1749,9 @@
struct_specifier
: STRUCT IDENTIFIER LEFT_BRACE struct_declaration_list RIGHT_BRACE {
+ if (parseContext->reservedErrorCheck($2.line, *$2.string))
+ parseContext->recover();
+
TType* structure = new TType($4, *$2.string);
TVariable* userTypeDef = new TVariable($2.string, *structure, true);
if (! parseContext->symbolTable.insert(*userTypeDef)) {
@@ -1821,11 +1824,17 @@
struct_declarator
: IDENTIFIER {
+ if (parseContext->reservedErrorCheck($1.line, *$1.string))
+ parseContext->recover();
+
$$.type = new TType(EbtVoid, EbpUndefined);
$$.line = $1.line;
$$.type->setFieldName(*$1.string);
}
| IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
+ if (parseContext->reservedErrorCheck($1.line, *$1.string))
+ parseContext->recover();
+
$$.type = new TType(EbtVoid, EbpUndefined);
$$.line = $1.line;
$$.type->setFieldName(*$1.string);