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
(cherry picked from commit 2c85fd5a96)
This commit is contained in:
Ian Romanick 2014-02-18 09:36:08 -08:00 committed by Carl Worth
parent de6068a218
commit cf7daac483

View file

@ -2803,10 +2803,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);
}
}