Mesa (10.1): glsl: Only warn for macro names containing __
Ian Romanick
idr at kemper.freedesktop.org
Thu Feb 20 21:41:22 UTC 2014
Module: Mesa
Branch: 10.1
Commit: b498fb95867f2b939c8e257a5cda959e42eae7b5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b498fb95867f2b939c8e257a5cda959e42eae7b5
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Tue Feb 18 09:36:08 2014 -0800
glsl: Only warn for macro names containing __
>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."
The intention is that names containing __ are reserved for internal use
by the implementation, and names prefixed with GL_ are reserved for use
by Khronos. Names simply containing __ are dangerous to use, but should
be allowed.
Per the Khronos bug mentioned below, a future version of the GLSL
specification will clarify this.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: "9.2 10.0 10.1" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Tested-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Tested-by: Darius Spitznagel <d.spitznagel at goodbytez.de>
Cc: Tapani Pälli <lemody at gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
Bugzilla: Khronos #11702
(cherry picked from commit 2c85fd5a964a78c9f7a93994fb79f1723c6f45b5)
---
src/glsl/ast_to_hir.cpp | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 8d096ad..624b813 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2853,10 +2853,17 @@ validate_identifier(const char *identifier, YYLTYPE loc,
* "In addition, all identifiers containing two
* consecutive underscores (__) are reserved as
* possible future keywords."
+ *
+ * The intention is that names containing __ are reserved for internal
+ * use by the implementation, and names prefixed with GL_ are reserved
+ * for use by Khronos. Names simply containing __ are dangerous to use,
+ * but should be allowed.
+ *
+ * A future version of the GLSL specification will clarify this.
*/
- _mesa_glsl_error(&loc, state,
- "identifier `%s' uses reserved `__' string",
- identifier);
+ _mesa_glsl_warning(&loc, state,
+ "identifier `%s' uses reserved `__' string",
+ identifier);
}
}
More information about the mesa-commit
mailing list