[Mesa-dev] [PATCH] glcpp: initializes version to -1

Eric Engestrom eric.engestrom at imgtec.com
Fri Nov 4 14:09:35 UTC 2016


On Friday, 2016-11-04 13:22:07 +0100, Juan A. Suarez Romero wrote:
> Shader can define #version as an integer, including 0.
> 
> Initializes version to -1 to know later if shader has defined a #version
> or not.
> 
> It fixes 4 piglit tests:
>   spec/glsl-1.10/compiler/version-0.frag: crash pass
>   spec/glsl-1.10/compiler/version-0.vert: crash pass
>   spec/glsl-es-3.00/compiler/version-0.frag: crash pass
>   spec/glsl-es-3.00/compiler/version-0.vert: crash pass
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97420
> ---
>  src/compiler/glsl/glcpp/glcpp-parse.y | 8 ++++----
>  src/compiler/glsl/glcpp/glcpp.h       | 2 +-
>  src/compiler/glsl/glsl_lexer.ll       | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
[snip]
> diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
> index b473af7..7d1d616 100644
> --- a/src/compiler/glsl/glsl_lexer.ll
> +++ b/src/compiler/glsl/glsl_lexer.ll
> @@ -249,7 +249,7 @@ HASH		^{SPC}#{SPC}
>  				   yylval->identifier = linear_strdup(mem_ctx, yytext);
>  				   return IDENTIFIER;
>  				}
> -<PP>[1-9][0-9]*			{
> +<PP>[0-9][0-9]*			{

I'm not familiar with flex, but with regexes I've worked with that would
be equivalent to:
	<PP>[0-9]+			{
:)

>  				    yylval->n = strtol(yytext, NULL, 10);
>  				    return INTCONSTANT;
>  				}
> -- 
> 2.7.4
> 


More information about the mesa-dev mailing list