[Mesa-dev] [PATCH] glsl: Consider "__" in identifers as reserved in GLSL 1.30+.
Eric Anholt
eric at anholt.net
Tue Oct 4 17:36:07 PDT 2011
On Tue, 04 Oct 2011 12:11:54 -0700, Ian Romanick <idr at freedesktop.org> wrote:
> On 10/04/2011 10:39 AM, Eric Anholt wrote:
> > On Mon, 03 Oct 2011 17:02:29 -0700, Kenneth Graunke<kenneth at whitecape.org> wrote:
> >> On 10/03/2011 04:51 PM, Eric Anholt wrote:
> >>> ---
> >>> src/glsl/ast_to_hir.cpp | 6 ++++++
> >>> 1 files changed, 6 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> >>> index 91a2231..99ca321 100644
> >>> --- a/src/glsl/ast_to_hir.cpp
> >>> +++ b/src/glsl/ast_to_hir.cpp
> >>> @@ -2803,6 +2803,12 @@ 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, "__")) {
> >>> + _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
> >>
> >> That text is present in 1.10 and ES as well, so you should probably just
> >> drop the version check.
> >>
> >> With that change,
> >> Reviewed-by: Kenneth Graunke<kenneth at whitecape.org>
> >
> > I see that text for preprocessor, but 1.10 and 1.20 didn't have text for
> > it in identifier names in section 3.7 where it is in 1.30. Can you
> > cite?
>
> Page 17 (page 23 of the PDF) of the GLSL ES 1.0.17 spec says:
>
> "In addition, all identifiers containing two consecutive
> underscores (__) are reserved as possible future keywords."
>
> Page 11 (page 17 of the PDF) of the GLSL 1.20 spec says the same thing.
> It's cleverly hidden in the section about keywords.
Oh, cool. I'll quote this in the code. Shall we move these tests out
to 1.10 instead of 1.30?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111004/6c3a9193/attachment.pgp>
More information about the mesa-dev
mailing list