summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2014-02-18 09:36:08 -0800
committerIan Romanick <ian.d.romanick@intel.com>2014-02-19 15:08:50 -0800
commit2c85fd5a964a78c9f7a93994fb79f1723c6f45b5 (patch)
tree5c3a318c34435a92e7f35f10981fefabaed8ef1a
parent0bd78926304e72ef3566e977d0cb5a959d86b809 (diff)
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@intel.com> Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Tested-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Tested-by: Darius Spitznagel <d.spitznagel@goodbytez.de> Cc: Tapani Pälli <lemody@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870 Bugzilla: Khronos #11702
-rw-r--r--src/glsl/ast_to_hir.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 6de73f4764b..6549ca7af43 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2928,10 +2928,17 @@ validate_identifier(const char *identifier, YYLTYPE loc,
2928 * "In addition, all identifiers containing two 2928 * "In addition, all identifiers containing two
2929 * consecutive underscores (__) are reserved as 2929 * consecutive underscores (__) are reserved as
2930 * possible future keywords." 2930 * possible future keywords."
2931 *
2932 * The intention is that names containing __ are reserved for internal
2933 * use by the implementation, and names prefixed with GL_ are reserved
2934 * for use by Khronos. Names simply containing __ are dangerous to use,
2935 * but should be allowed.
2936 *
2937 * A future version of the GLSL specification will clarify this.
2931 */ 2938 */
2932 _mesa_glsl_error(&loc, state, 2939 _mesa_glsl_warning(&loc, state,
2933 "identifier `%s' uses reserved `__' string", 2940 "identifier `%s' uses reserved `__' string",
2934 identifier); 2941 identifier);
2935 } 2942 }
2936} 2943}
2937 2944