[Mesa-dev] [PATCH] glsl/glcpp: allow undefining __VERSION__ and GL_

Kenneth Graunke kenneth at whitecape.org
Wed Aug 26 01:14:19 PDT 2015


On Wednesday, August 26, 2015 04:55:32 PM Dave Airlie wrote:
> On 26 August 2015 at 16:48, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> > On Wed, Aug 26, 2015 at 2:38 AM, Dave Airlie <airlied at gmail.com> wrote:
> >> From: Dave Airlie <airlied at redhat.com>
> >>
> >> GL33-CTS.shaders.preprocessor.definitions.*
> >> has 4 tests the undefine these,
> >>
> >> I can't find anything in the spec saying that isn't correct.
> >>
> >> Signed-off-by: Dave Airlie <airlied at redhat.com>
> >> ---
> >>  src/glsl/glcpp/glcpp-parse.y | 4 +---
> >>  1 file changed, 1 insertion(+), 3 deletions(-)
> >>
> >> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
> >> index 18e50af..77010b4 100644
> >> --- a/src/glsl/glcpp/glcpp-parse.y
> >> +++ b/src/glsl/glcpp/glcpp-parse.y
> >> @@ -289,9 +289,7 @@ control_line_success:
> >>         } IDENTIFIER NEWLINE {
> >>                 macro_t *macro;
> >>                 if (strcmp("__LINE__", $4) == 0
> >> -                   || strcmp("__FILE__", $4) == 0
> >> -                   || strcmp("__VERSION__", $4) == 0
> >> -                   || strncmp("GL_", $4, 3) == 0)
> >
> > From GLSL 4.50 page 12, section 3.3:
> >
> > All macro
> > names prefixed with “GL_” (“GL” followed by a single underscore) are
> > also reserved, and defining such a
> > name results in a compile-time error. That said I don't see anything
> > about redefining __FILE__.
> 
> Okay that must be new language brought it at some point, at least 4.2
> has older language
> which means it should be conditional on #version on whether GL_ can be done.
> 
> uggh, maybe I can try again :-)
> 
> Dave.

FWIW, a lot of the preprocessor changes are more-or-less clarifications
of ill-defined behavior, rather than intentional changes.  So, you might
be able to argue that the newer behavior is "right" and should be done
everywhere, rather than trying to predicate things on a #version.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150826/a5d68117/attachment.sig>


More information about the mesa-dev mailing list