glsl: Consider "__" in identifers as reserved.
authorEric Anholt <eric@anholt.net>
Mon, 3 Oct 2011 23:27:59 +0000 (16:27 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 5 Oct 2011 19:49:17 +0000 (12:49 -0700)
Fixes double-underscore-*.frag.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast_to_hir.cpp

index 91a2231605d1468ee218fe4938de910cf7277214..4f8a5482bed587faf3d14922d2d444797d1e7e84 100644 (file)
@@ -2803,6 +2803,19 @@ ast_declarator_list::hir(exec_list *instructions,
            _mesa_glsl_error(& loc, state,
                             "identifier `%s' uses reserved `gl_' prefix",
                             decl->identifier);
+        else if (state->language_version >= 130 &&
+                 strstr(decl->identifier, "__")) {
+           /* From page 14 (page 20 of the PDF) of the GLSL 1.10
+            * spec:
+            *
+            *     "In addition, all identifiers containing two
+            *      consecutive underscores (__) are reserved as
+            *      possible future keywords."
+            */
+           _mesa_glsl_error(& loc, state,
+                            "identifier `%s' uses reserved `__' string",
+                            decl->identifier);
+        }
 
         /* Add the variable to the symbol table.  Note that the initializer's
          * IR was already processed earlier (though it hasn't been emitted