Mesa (master): glsl: Consider "__" in identifers as reserved.

Eric Anholt anholt at kemper.freedesktop.org
Wed Oct 5 19:49:37 UTC 2011


Module: Mesa
Branch: master
Commit: 684b701c124cf258ba9012adf51357e072ae61f9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=684b701c124cf258ba9012adf51357e072ae61f9

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct  3 16:27:59 2011 -0700

glsl: Consider "__" in identifers as reserved.

Fixes double-underscore-*.frag.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/ast_to_hir.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 91a2231..4f8a548 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -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




More information about the mesa-commit mailing list