<div dir="ltr">That sounds good to me, I will submit a v3 with those edits.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 28, 2016 at 9:19 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Monday, March 28, 2016 8:16:17 PM PDT Lars Hamre wrote:<br>
> NOTE: someone with access will need to commit this patch after the<br>
>       review process<br>
><br>
> Invalidates float suffixes for glsl 1.10<br>
><br>
> Fixes the following piglit tests:<br>
> tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-capital-f.vert<br>
> tests/spec/glsl-1.10/compiler/literals/invalid-float-suffix-f.vert`<br>
><br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=81585" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=81585</a><br>
><br>
> Signed-off-by: Lars Hamre <<a href="mailto:chemecse@gmail.com">chemecse@gmail.com</a>><br>
> Reviewed-by: Timothy Arceri <<a href="mailto:timothy.arceri@collabora.com">timothy.arceri@collabora.com</a>><br>
><br>
> ---<br>
>  src/compiler/glsl/glsl_lexer.ll | 13 +++++++++++--<br>
>  1 file changed, 11 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/<br>
glsl_lexer.ll<br>
> index 1f12265..0980f4f 100644<br>
> --- a/src/compiler/glsl/glsl_lexer.ll<br>
> +++ b/src/compiler/glsl/glsl_lexer.ll<br>
> @@ -472,8 +472,17 @@ layout           {<br>
>  \.[0-9]+([eE][+-]?[0-9]+)?[fF]?              |<br>
>  [0-9]+\.([eE][+-]?[0-9]+)?[fF]?              |<br>
>  [0-9]+[eE][+-]?[0-9]+[fF]?           {<br>
> -                         yylval->real = _mesa_strtof(yytext, NULL);<br>
> -                         return FLOATCONSTANT;<br>
> +                         struct _mesa_glsl_parse_state *state = yyextra;<br>
> +                         char suffix = yytext[strlen(yytext) - 1];<br>
> +                         if (!state->is_version(120, 0) &&<br>
> +                             (suffix == 'f' || suffix == 'F')) {<br>
> +                             _mesa_glsl_error(yylloc, state,<br>
> +                                              "Float suffixes are invalid in GLSL<br>
1.10");<br>
> +                             return ERROR_TOK;<br>
> +                         } else {<br>
> +                             yylval->real = _mesa_strtof(yytext, NULL);<br>
> +                             return FLOATCONSTANT;<br>
> +                         }<br>
<br>
</div></div>Hi Lars,<br>
<br>
Good catch!  Would it also work to do:<br>
<span class=""><br>
                    if (!state->is_version(120, 0) &&<br>
</span><span class="">                        (suffix == 'f' || suffix == 'F')) {<br>
</span>                        _mesa_glsl_error(yylloc, state,<br>
<span class="">                                         "Float suffixes are invalid in GLSL 1.10");<br>
            }<br>
</span><span class="">                    yylval->real = _mesa_strtof(yytext, NULL);<br>
</span>                    return FLOATCONSTANT;<br>
<br>
In other words, raise the error and fail the compile, but parse the<br>
float literal as intended.  I think returning ERROR_TOK is likely to<br>
make the parser hit bison-generated "Expected <SOME TOKENS>, got <SOME<br>
OTHER TOKENS>" errors that are pretty cryptic.  Parsing the number in<br>
the obvious manner would let the compile proceed normally, so we don't<br>
get cascading errors that might be confusing.<br>
<br>
That patch would get a:<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
<span class=""><br>
>                       }<br>
><br>
>  [0-9]+\.[0-9]+([eE][+-]?[0-9]+)?(lf|LF)      |<br>
> --<br>
> 2.5.5<br>
><br>
</span>> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
><br>
<br>
</blockquote></div><br></div>