[Mesa-dev] [PATCH 2/3] glsl: Only warn for macro names containing __

Kenneth Graunke kenneth at whitecape.org
Tue Feb 18 16:12:59 PST 2014


On 02/18/2014 10:19 AM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> 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>
> Cc: Tapani Pälli <lemody at gmail.com>
> Cc: Kenneth Graunke <kenneth at whitecape.org>
> Cc: Darius Spitznagel <d.spitznagel at goodbytez.de>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
> Bugzilla: Khronos #11702
> ---
>  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 6de73f4..6549ca7 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,
>         *     "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);
>     }
>  }
>  
> 

All three patches are:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140218/dc6eb25f/attachment.pgp>


More information about the mesa-dev mailing list